Class: Jeweler::Generator
- Inherits:
-
Object
- Object
- Jeweler::Generator
- Defined in:
- lib/jeweler/generator.rb,
lib/jeweler/generator/options.rb,
lib/jeweler/generator/yard_mixin.rb,
lib/jeweler/generator/riot_mixin.rb,
lib/jeweler/generator/rdoc_mixin.rb,
lib/jeweler/generator/bacon_mixin.rb,
lib/jeweler/generator/rspec_mixin.rb,
lib/jeweler/generator/application.rb,
lib/jeweler/generator/shindo_mixin.rb,
lib/jeweler/generator/github_mixin.rb,
lib/jeweler/generator/shoulda_mixin.rb,
lib/jeweler/generator/minitest_mixin.rb,
lib/jeweler/generator/testspec_mixin.rb,
lib/jeweler/generator/testunit_mixin.rb,
lib/jeweler/generator/micronaut_mixin.rb
Overview
Generator for creating a jeweler-enabled project
Defined Under Namespace
Modules: BaconMixin, GithubMixin, MicronautMixin, MinitestMixin, RdocMixin, RiotMixin, RspecMixin, ShindoMixin, ShouldaMixin, TestspecMixin, TestunitMixin, YardMixin Classes: Application, Options
Instance Attribute Summary (collapse)
-
- (Object) description
Returns the value of attribute description.
-
- (Object) development_dependencies
Returns the value of attribute development_dependencies.
-
- (Object) documentation_framework
Returns the value of attribute documentation_framework.
-
- (Object) git_remote
Returns the value of attribute git_remote.
-
- (Object) github_username
Returns the value of attribute github_username.
-
- (Object) homepage
Returns the value of attribute homepage.
-
- (Object) options
Returns the value of attribute options.
-
- (Object) project_name
Returns the value of attribute project_name.
-
- (Object) repo
Returns the value of attribute repo.
-
- (Object) should_create_remote_repo
Returns the value of attribute should_create_remote_repo.
-
- (Object) should_setup_rubyforge
Returns the value of attribute should_setup_rubyforge.
-
- (Object) should_use_bundler
Returns the value of attribute should_use_bundler.
-
- (Object) should_use_cucumber
Returns the value of attribute should_use_cucumber.
-
- (Object) should_use_reek
Returns the value of attribute should_use_reek.
-
- (Object) should_use_roodi
Returns the value of attribute should_use_roodi.
-
- (Object) summary
Returns the value of attribute summary.
-
- (Object) target_dir
Returns the value of attribute target_dir.
-
- (Object) testing_framework
Returns the value of attribute testing_framework.
-
- (Object) user_email
Returns the value of attribute user_email.
-
- (Object) user_name
Returns the value of attribute user_name.
Instance Method Summary (collapse)
- - (Object) constant_name
- - (Object) feature_filename
- - (Object) features_dir
- - (Object) features_steps_dir
- - (Object) features_support_dir
- - (Object) file_name_prefix
-
- (Generator) initialize(options = {})
constructor
A new instance of Generator.
- - (Object) lib_dir
- - (Object) lib_filename
- - (Object) require_name
- - (Object) run
- - (Object) steps_filename
Constructor Details
- (Generator) initialize(options = {})
A new instance of Generator
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/jeweler/generator.rb', line 60 def initialize( = {}) self. = extracted_directory = nil self.project_name = [:project_name] if self.project_name.nil? || self.project_name.squeeze.strip == "" raise NoGitHubRepoNameGiven else path = File.split(self.project_name) if path.size > 1 extracted_directory = File.join(path[0..-1]) self.project_name = path.last end end self.development_dependencies = [] self.testing_framework = [:testing_framework] self.documentation_framework = [: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 begin generator_mixin_name = "#{self.documentation_framework.to_s.capitalize}Mixin" generator_mixin = self.class.const_get(generator_mixin_name) extend generator_mixin rescue NameError => e raise ArgumentError, "Unsupported documentation framework (#{documentation_framework})" end self.target_dir = [:directory] || extracted_directory || self.project_name 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] self.should_use_bundler = [:use_bundler] development_dependencies << ["cucumber", ">= 0"] if should_use_cucumber # TODO make bundler optional? development_dependencies << ["bundler", "~> 1.0.0"] development_dependencies << ["jeweler", "~> #{Jeweler::Version::STRING}"] development_dependencies << ["rcov", ">= 0"] development_dependencies << ["reek", "~> 1.2.8"] if should_use_reek development_dependencies << ["roodi", "~> 2.1.0"] if should_use_roodi self.user_name = [:user_name] self.user_email = [:user_email] self.homepage = [:homepage] self.git_remote = [:git_remote] raise NoGitUserName unless self.user_name raise NoGitUserEmail unless self.user_email extend GithubMixin end |
Instance Attribute Details
- (Object) description
Returns the value of attribute description
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def description @description end |
- (Object) development_dependencies
Returns the value of attribute development_dependencies
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def development_dependencies @development_dependencies end |
- (Object) documentation_framework
Returns the value of attribute documentation_framework
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def documentation_framework @documentation_framework end |
- (Object) git_remote
Returns the value of attribute git_remote
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def git_remote @git_remote end |
- (Object) github_username
Returns the value of attribute github_username
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def github_username @github_username end |
- (Object) homepage
Returns the value of attribute homepage
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def homepage @homepage end |
- (Object) options
Returns the value of attribute options
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def @options end |
- (Object) project_name
Returns the value of attribute project_name
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def project_name @project_name end |
- (Object) repo
Returns the value of attribute repo
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def repo @repo end |
- (Object) should_create_remote_repo
Returns the value of attribute should_create_remote_repo
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def should_create_remote_repo @should_create_remote_repo end |
- (Object) should_setup_rubyforge
Returns the value of attribute should_setup_rubyforge
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def should_setup_rubyforge @should_setup_rubyforge end |
- (Object) should_use_bundler
Returns the value of attribute should_use_bundler
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def should_use_bundler @should_use_bundler end |
- (Object) should_use_cucumber
Returns the value of attribute should_use_cucumber
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def should_use_cucumber @should_use_cucumber end |
- (Object) should_use_reek
Returns the value of attribute should_use_reek
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def should_use_reek @should_use_reek end |
- (Object) should_use_roodi
Returns the value of attribute should_use_roodi
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def should_use_roodi @should_use_roodi end |
- (Object) summary
Returns the value of attribute summary
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def summary @summary end |
- (Object) target_dir
Returns the value of attribute target_dir
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def target_dir @target_dir end |
- (Object) testing_framework
Returns the value of attribute testing_framework
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def testing_framework @testing_framework end |
- (Object) user_email
Returns the value of attribute user_email
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def user_email @user_email end |
- (Object) user_name
Returns the value of attribute user_name
50 51 52 |
# File 'lib/jeweler/generator.rb', line 50 def user_name @user_name end |
Instance Method Details
- (Object) constant_name
137 138 139 |
# File 'lib/jeweler/generator.rb', line 137 def constant_name self.project_name.split(/[-_]/).collect{|each| each.capitalize }.join end |
- (Object) feature_filename
157 158 159 |
# File 'lib/jeweler/generator.rb', line 157 def feature_filename "#{project_name}.feature" end |
- (Object) features_dir
165 166 167 |
# File 'lib/jeweler/generator.rb', line 165 def features_dir 'features' end |
- (Object) features_steps_dir
173 174 175 |
# File 'lib/jeweler/generator.rb', line 173 def features_steps_dir File.join(features_dir, 'step_definitions') end |
- (Object) features_support_dir
169 170 171 |
# File 'lib/jeweler/generator.rb', line 169 def features_support_dir File.join(features_dir, 'support') end |
- (Object) file_name_prefix
149 150 151 |
# File 'lib/jeweler/generator.rb', line 149 def file_name_prefix self.project_name.gsub('-', '_') end |
- (Object) lib_dir
153 154 155 |
# File 'lib/jeweler/generator.rb', line 153 def lib_dir 'lib' end |
- (Object) lib_filename
141 142 143 |
# File 'lib/jeweler/generator.rb', line 141 def lib_filename "#{project_name}.rb" end |
- (Object) require_name
145 146 147 |
# File 'lib/jeweler/generator.rb', line 145 def require_name self.project_name end |
- (Object) run
127 128 129 130 131 132 133 134 135 |
# File 'lib/jeweler/generator.rb', line 127 def run create_files create_version_control $stdout.puts "Jeweler has prepared your gem in #{target_dir}" if should_create_remote_repo create_and_push_repo $stdout.puts "Jeweler has pushed your repo to #{git_remote}" end end |
- (Object) steps_filename
161 162 163 |
# File 'lib/jeweler/generator.rb', line 161 def steps_filename "#{project_name}_steps.rb" end |