Class: Jeweler::Generator
- Inherits:
-
Object
- Object
- Jeweler::Generator
- Defined in:
- lib/jeweler/generator.rb,
lib/jeweler/generator/options.rb,
lib/jeweler/generator/application.rb,
lib/jeweler/generator/bacon_mixin.rb,
lib/jeweler/generator/rspec_mixin.rb,
lib/jeweler/generator/shoulda_mixin.rb,
lib/jeweler/generator/minitest_mixin.rb,
lib/jeweler/generator/testunit_mixin.rb,
lib/jeweler/generator/micronaut_mixin.rb
Defined Under Namespace
Modules: BaconMixin, MicronautMixin, MinitestMixin, RspecMixin, ShouldaMixin, TestunitMixin Classes: Application, Options
Constant Summary collapse
- DEFAULT_TESTING_FRAMEWORK =
:shoulda
- DEFAULT_DOCUMENTATION_FRAMEWORK =
:rdoc
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#documentation_framework ⇒ Object
Returns the value of attribute documentation_framework.
-
#github_token ⇒ Object
Returns the value of attribute github_token.
-
#github_username ⇒ Object
Returns the value of attribute github_username.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#should_create_repo ⇒ Object
Returns the value of attribute should_create_repo.
-
#should_setup_rubyforge ⇒ Object
Returns the value of attribute should_setup_rubyforge.
-
#should_use_cucumber ⇒ Object
Returns the value of attribute should_use_cucumber.
-
#should_use_reek ⇒ Object
Returns the value of attribute should_use_reek.
-
#should_use_roodi ⇒ Object
Returns the value of attribute should_use_roodi.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#target_dir ⇒ Object
Returns the value of attribute target_dir.
-
#testing_framework ⇒ Object
Returns the value of attribute testing_framework.
-
#user_email ⇒ Object
Returns the value of attribute user_email.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
Instance Method Summary collapse
- #constant_name ⇒ Object
- #doc_task ⇒ Object
- #feature_filename ⇒ Object
- #features_dir ⇒ Object
- #features_steps_dir ⇒ Object
- #features_support_dir ⇒ Object
- #file_name_prefix ⇒ Object
- #git_remote ⇒ Object
-
#initialize(project_name, options = {}) ⇒ Generator
constructor
A new instance of Generator.
- #lib_dir ⇒ Object
- #lib_filename ⇒ Object
- #project_homepage ⇒ Object
- #require_name ⇒ Object
- #run ⇒ Object
- #steps_filename ⇒ Object
Constructor Details
#initialize(project_name, options = {}) ⇒ Generator
Returns a new instance of Generator.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/jeweler/generator.rb', line 42 def initialize(project_name, = {}) if project_name.nil? || project_name.squeeze.strip == "" raise NoGitHubRepoNameGiven end self.project_name = project_name self.testing_framework = ([:testing_framework] || DEFAULT_TESTING_FRAMEWORK).to_sym self.documentation_framework = [:documentation_framework] || DEFAULT_DOCUMENTATION_FRAMEWORK begin generator_mixin_name = "#{self.testing_framework.to_s.capitalize}Mixin" generator_mixin = self.class.const_get(generator_mixin_name) extend generator_mixin rescue NameError => e raise ArgumentError, "Unsupported testing framework (#{testing_framework})" end self.target_dir = [:directory] || self.project_name self.should_create_repo = [:create_repo] self.summary = [:summary] || 'TODO: one-line summary of your gem' self.description = [:description] || 'TODO: longer description of your gem' self.should_use_cucumber = [:use_cucumber] self.should_use_reek = [:use_reek] self.should_use_roodi = [:use_roodi] self.should_setup_rubyforge = [:rubyforge] use_user_git_config end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def description @description end |
#documentation_framework ⇒ Object
Returns the value of attribute documentation_framework.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def documentation_framework @documentation_framework end |
#github_token ⇒ Object
Returns the value of attribute github_token.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def github_token @github_token end |
#github_username ⇒ Object
Returns the value of attribute github_username.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def github_username @github_username end |
#project_name ⇒ Object
Returns the value of attribute project_name.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def project_name @project_name end |
#repo ⇒ Object
Returns the value of attribute repo.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def repo @repo end |
#should_create_repo ⇒ Object
Returns the value of attribute should_create_repo.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def should_create_repo @should_create_repo end |
#should_setup_rubyforge ⇒ Object
Returns the value of attribute should_setup_rubyforge.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def should_setup_rubyforge @should_setup_rubyforge end |
#should_use_cucumber ⇒ Object
Returns the value of attribute should_use_cucumber.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def should_use_cucumber @should_use_cucumber end |
#should_use_reek ⇒ Object
Returns the value of attribute should_use_reek.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def should_use_reek @should_use_reek end |
#should_use_roodi ⇒ Object
Returns the value of attribute should_use_roodi.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def should_use_roodi @should_use_roodi end |
#summary ⇒ Object
Returns the value of attribute summary.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def summary @summary end |
#target_dir ⇒ Object
Returns the value of attribute target_dir.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def target_dir @target_dir end |
#testing_framework ⇒ Object
Returns the value of attribute testing_framework.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def testing_framework @testing_framework end |
#user_email ⇒ Object
Returns the value of attribute user_email.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def user_email @user_email end |
#user_name ⇒ Object
Returns the value of attribute user_name.
31 32 33 |
# File 'lib/jeweler/generator.rb', line 31 def user_name @user_name end |
Instance Method Details
#constant_name ⇒ Object
94 95 96 |
# File 'lib/jeweler/generator.rb', line 94 def constant_name self.project_name.split(/[-_]/).collect{|each| each.capitalize }.join end |
#doc_task ⇒ Object
134 135 136 137 138 139 140 |
# File 'lib/jeweler/generator.rb', line 134 def doc_task case documentation_framework when :yard then "yardoc" else documentation_framework.to_s end end |
#feature_filename ⇒ Object
114 115 116 |
# File 'lib/jeweler/generator.rb', line 114 def feature_filename "#{project_name}.feature" end |
#features_dir ⇒ Object
122 123 124 |
# File 'lib/jeweler/generator.rb', line 122 def features_dir 'features' end |
#features_steps_dir ⇒ Object
130 131 132 |
# File 'lib/jeweler/generator.rb', line 130 def features_steps_dir File.join(features_dir, 'step_definitions') end |
#features_support_dir ⇒ Object
126 127 128 |
# File 'lib/jeweler/generator.rb', line 126 def features_support_dir File.join(features_dir, 'support') end |
#file_name_prefix ⇒ Object
106 107 108 |
# File 'lib/jeweler/generator.rb', line 106 def file_name_prefix self.project_name.gsub('-', '_') end |
#git_remote ⇒ Object
86 87 88 |
# File 'lib/jeweler/generator.rb', line 86 def git_remote "[email protected]:#{github_username}/#{project_name}.git" end |
#lib_dir ⇒ Object
110 111 112 |
# File 'lib/jeweler/generator.rb', line 110 def lib_dir 'lib' end |
#lib_filename ⇒ Object
98 99 100 |
# File 'lib/jeweler/generator.rb', line 98 def lib_filename "#{project_name}.rb" end |
#project_homepage ⇒ Object
90 91 92 |
# File 'lib/jeweler/generator.rb', line 90 def project_homepage "http://github.com/#{github_username}/#{project_name}" end |
#require_name ⇒ Object
102 103 104 |
# File 'lib/jeweler/generator.rb', line 102 def require_name self.project_name end |
#run ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/jeweler/generator.rb', line 74 def run create_files gitify $stdout.puts "Jeweler has prepared your gem in #{target_dir}" if should_create_repo create_and_push_repo $stdout.puts "Jeweler has pushed your repo to #{project_homepage}" enable_gem_for_repo $stdout.puts "Jeweler has enabled gem building for your repo" end end |
#steps_filename ⇒ Object
118 119 120 |
# File 'lib/jeweler/generator.rb', line 118 def steps_filename "#{project_name}_steps.rb" end |