Class: Jeweler::Generator
- Inherits:
-
Object
- Object
- Jeweler::Generator
- Defined in:
- lib/jeweler/generator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#constant_name ⇒ Object
Returns the value of attribute constant_name.
-
#file_name_prefix ⇒ Object
Returns the value of attribute file_name_prefix.
-
#github_remote ⇒ Object
Returns the value of attribute github_remote.
-
#github_repo_name ⇒ Object
Returns the value of attribute github_repo_name.
-
#github_token ⇒ Object
Returns the value of attribute github_token.
-
#github_url ⇒ Object
Returns the value of attribute github_url.
-
#github_username ⇒ Object
Returns the value of attribute github_username.
-
#lib_dir ⇒ Object
Returns the value of attribute lib_dir.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#should_create_repo ⇒ Object
Returns the value of attribute should_create_repo.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#target_dir ⇒ Object
Returns the value of attribute target_dir.
-
#test_style ⇒ Object
Returns the value of attribute test_style.
-
#user_email ⇒ Object
Returns the value of attribute user_email.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
Instance Method Summary collapse
-
#initialize(github_repo_name, options = {}) ⇒ Generator
constructor
A new instance of Generator.
- #run ⇒ Object
- #test_dir ⇒ Object
- #testspec ⇒ Object
Constructor Details
#initialize(github_repo_name, options = {}) ⇒ Generator
Returns a new instance of Generator.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/jeweler/generator.rb', line 30 def initialize(github_repo_name, = {}) check_user_git_config() if github_repo_name.nil? raise NoGitHubRepoNameGiven end self.github_repo_name = github_repo_name self.github_remote = "[email protected]:#{github_username}/#{github_repo_name}.git" self.github_url = "http://github.com/#{github_username}/#{github_repo_name}" self.test_style = [:test_style] || :shoulda self.target_dir = [: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 = [:create_repo] self.summary = [:summary] || 'TODO' end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def config @config end |
#constant_name ⇒ Object
Returns the value of attribute constant_name.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def constant_name @constant_name end |
#file_name_prefix ⇒ Object
Returns the value of attribute file_name_prefix.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def file_name_prefix @file_name_prefix end |
#github_remote ⇒ Object
Returns the value of attribute github_remote.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def github_remote @github_remote end |
#github_repo_name ⇒ Object
Returns the value of attribute github_repo_name.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def github_repo_name @github_repo_name end |
#github_token ⇒ Object
Returns the value of attribute github_token.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def github_token @github_token end |
#github_url ⇒ Object
Returns the value of attribute github_url.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def github_url @github_url end |
#github_username ⇒ Object
Returns the value of attribute github_username.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def github_username @github_username end |
#lib_dir ⇒ Object
Returns the value of attribute lib_dir.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def lib_dir @lib_dir end |
#repo ⇒ Object
Returns the value of attribute repo.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def repo @repo end |
#should_create_repo ⇒ Object
Returns the value of attribute should_create_repo.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def should_create_repo @should_create_repo end |
#summary ⇒ Object
Returns the value of attribute summary.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def summary @summary end |
#target_dir ⇒ Object
Returns the value of attribute target_dir.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def target_dir @target_dir end |
#test_style ⇒ Object
Returns the value of attribute test_style.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def test_style @test_style end |
#user_email ⇒ Object
Returns the value of attribute user_email.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def user_email @user_email end |
#user_name ⇒ Object
Returns the value of attribute user_name.
24 25 26 |
# File 'lib/jeweler/generator.rb', line 24 def user_name @user_name end |
Instance Method Details
#run ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/jeweler/generator.rb', line 50 def run create_files gitify puts "Jeweler has prepared your gem in #{github_repo_name}" if should_create_repo create_and_push_repo puts "Jeweler has pushed your repo to #{github_url}" enable_gem_for_repo puts "Jeweler has enabled gem building for your repo" end end |
#test_dir ⇒ Object
71 72 73 |
# File 'lib/jeweler/generator.rb', line 71 def test_dir File.join(target_dir, testspec) end |
#testspec ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/jeweler/generator.rb', line 62 def testspec case test_style when :shoulda 'test' when :bacon 'spec' end end |