lib/jeweler/generator.rb in namelessjon-jeweler-0.6.5 vs lib/jeweler/generator.rb in namelessjon-jeweler-0.7.2

- old
+ new

@@ -19,12 +19,13 @@ end class GitInitFailed < StandardError end class Generator - attr_accessor :target_dir, :user_name, :user_email, - :github_repo_name, :github_remote, :github_url, :github_username, :github_token, + attr_accessor :target_dir, :user_name, :user_email, :summary, + :github_repo_name, :github_remote, :github_url, + :github_username, :github_token, :lib_dir, :constant_name, :file_name_prefix, :config, :test_style, :repo, :should_create_repo def initialize(github_repo_name, options = {}) check_user_git_config() @@ -41,10 +42,11 @@ self.target_dir = options[:directory] || self.github_repo_name self.lib_dir = File.join(target_dir, 'lib') self.constant_name = self.github_repo_name.split(/[-_]/).collect{|each| each.capitalize }.join self.file_name_prefix = self.github_repo_name.gsub('-', '_') self.should_create_repo = options[:create_repo] + self.summary = options[:summary] || 'TODO' end def run create_files gitify @@ -94,23 +96,23 @@ def check_user_git_config self.config = read_git_config unless config.has_key? 'user.name' - raise NoGitUserName, %Q{No user.name set in ~/.gitconfig. Set it with: git config --global user.name 'Your Name Here'} + raise NoGitUserName end unless config.has_key? 'user.email' - raise NoGitUserEmail, %Q{No user.name set in ~/.gitconfig. Set it with: git config --global user.name 'Your Name Here'} + raise NoGitUserEmail end unless config.has_key? 'github.user' - raise NoGitHubUser, %Q{No github.user set in ~/.gitconfig. Set it with: git config --global github.user 'Your username here'} + raise NoGitHubUser end unless config.has_key? 'github.token' - raise NoGitHubToken, %Q{No github.token set in ~/.gitconfig. Set it with: git config --global github.token 'Your token here'} + raise NoGitHubToken end self.user_name = config['user.name'] self.user_email = config['user.email'] self.github_username = config['github.user'] @@ -159,9 +161,10 @@ def create_and_push_repo Net::HTTP.post_form URI.parse('http://github.com/repositories'), 'login' => github_username, 'token' => github_token, + 'repository[description]' => summary, 'repository[name]' => github_repo_name sleep 2 @repo.push('origin') end