Class: Bueller::Generator
- Inherits:
-
Object
- Object
- Bueller::Generator
- Defined in:
- lib/bueller/generator.rb,
lib/bueller/generator/options.rb,
lib/bueller/generator/rdoc_mixin.rb,
lib/bueller/generator/riot_mixin.rb,
lib/bueller/generator/yard_mixin.rb,
lib/bueller/generator/application.rb,
lib/bueller/generator/bacon_mixin.rb,
lib/bueller/generator/rspec_mixin.rb,
lib/bueller/generator/github_mixin.rb,
lib/bueller/generator/shindo_mixin.rb,
lib/bueller/generator/shoulda_mixin.rb,
lib/bueller/generator/minitest_mixin.rb,
lib/bueller/generator/testspec_mixin.rb,
lib/bueller/generator/testunit_mixin.rb,
lib/bueller/generator/micronaut_mixin.rb
Overview
Generator for creating a bueller-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
-
#create_remote_repo ⇒ Object
(also: #create_remote_repo?)
Returns the value of attribute create_remote_repo.
-
#description ⇒ Object
Returns the value of attribute description.
-
#development_dependencies ⇒ Object
Returns the value of attribute development_dependencies.
-
#documentation_framework ⇒ Object
Returns the value of attribute documentation_framework.
-
#git_remote ⇒ Object
Returns the value of attribute git_remote.
-
#github_token ⇒ Object
Returns the value of attribute github_token.
-
#github_username ⇒ Object
Returns the value of attribute github_username.
-
#homepage ⇒ Object
Returns the value of attribute homepage.
-
#options ⇒ Object
Returns the value of attribute options.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#setup_gemcutter ⇒ Object
Returns the value of attribute setup_gemcutter.
-
#setup_rubyforge ⇒ Object
(also: #setup_rubyforge?)
Returns the value of attribute setup_rubyforge.
-
#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.
-
#use_cucumber ⇒ Object
(also: #use_cucumber?)
Returns the value of attribute use_cucumber.
-
#use_reek ⇒ Object
(also: #use_reek?)
Returns the value of attribute use_reek.
-
#use_roodi ⇒ Object
(also: #use_roodi?)
Returns the value of attribute use_roodi.
-
#user_email ⇒ Object
Returns the value of attribute user_email.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
Class Method Summary collapse
Instance Method Summary collapse
- #constant_name ⇒ Object
- #feature_filename ⇒ Object
- #features_dir ⇒ Object
- #features_steps_dir ⇒ Object
- #features_support_dir ⇒ Object
- #file_name_prefix ⇒ Object
-
#initialize(options = {}) ⇒ Generator
constructor
A new instance of Generator.
- #lib_dir ⇒ Object
- #lib_filename ⇒ Object
- #require_name ⇒ Object
- #run ⇒ Object
- #steps_filename ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Generator
Returns a new instance of Generator.
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 |
# File 'lib/bueller/generator.rb', line 66 def initialize( = {}) self. = self.project_name = [:project_name] if self.project_name.nil? || self.project_name.squeeze.strip == "" raise NoGitHubRepoNameGiven end self.development_dependencies = [] self.testing_framework = [:testing_framework] self.documentation_framework = [:documentation_framework] begin generator_mixin_name = "#{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] || self.project_name self.summary = [:summary] || 'TODO: one-line summary of your gem' self.description = [:description] || 'TODO: detailed description of your gem' self.use_cucumber = [:use_cucumber] self.use_reek = [:use_reek] self.use_roodi = [:use_roodi] self.setup_gemcutter = [:gemcutter] self.setup_rubyforge = [:rubyforge] development_dependencies << 'cucumber' if use_cucumber? development_dependencies << 'bueller' development_dependencies << 'reek' if use_reek? development_dependencies << 'roodi' if 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
#create_remote_repo ⇒ Object Also known as: create_remote_repo?
Returns the value of attribute create_remote_repo.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def create_remote_repo @create_remote_repo end |
#description ⇒ Object
Returns the value of attribute description.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def description @description end |
#development_dependencies ⇒ Object
Returns the value of attribute development_dependencies.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def development_dependencies @development_dependencies end |
#documentation_framework ⇒ Object
Returns the value of attribute documentation_framework.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def documentation_framework @documentation_framework end |
#git_remote ⇒ Object
Returns the value of attribute git_remote.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def git_remote @git_remote end |
#github_token ⇒ Object
Returns the value of attribute github_token.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def github_token @github_token end |
#github_username ⇒ Object
Returns the value of attribute github_username.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def github_username @github_username end |
#homepage ⇒ Object
Returns the value of attribute homepage.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def homepage @homepage end |
#options ⇒ Object
Returns the value of attribute options.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def @options end |
#project_name ⇒ Object
Returns the value of attribute project_name.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def project_name @project_name end |
#repo ⇒ Object
Returns the value of attribute repo.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def repo @repo end |
#setup_gemcutter ⇒ Object
Returns the value of attribute setup_gemcutter.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def setup_gemcutter @setup_gemcutter end |
#setup_rubyforge ⇒ Object Also known as: setup_rubyforge?
Returns the value of attribute setup_rubyforge.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def setup_rubyforge @setup_rubyforge end |
#summary ⇒ Object
Returns the value of attribute summary.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def summary @summary end |
#target_dir ⇒ Object
Returns the value of attribute target_dir.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def target_dir @target_dir end |
#testing_framework ⇒ Object
Returns the value of attribute testing_framework.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def testing_framework @testing_framework end |
#use_cucumber ⇒ Object Also known as: use_cucumber?
Returns the value of attribute use_cucumber.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def use_cucumber @use_cucumber end |
#use_reek ⇒ Object Also known as: use_reek?
Returns the value of attribute use_reek.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def use_reek @use_reek end |
#use_roodi ⇒ Object Also known as: use_roodi?
Returns the value of attribute use_roodi.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def use_roodi @use_roodi end |
#user_email ⇒ Object
Returns the value of attribute user_email.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def user_email @user_email end |
#user_name ⇒ Object
Returns the value of attribute user_name.
45 46 47 |
# File 'lib/bueller/generator.rb', line 45 def user_name @user_name end |
Class Method Details
.run(options = {}) ⇒ Object
61 62 63 64 |
# File 'lib/bueller/generator.rb', line 61 def self.run( = {}) generator = self.new() generator.run end |
Instance Method Details
#constant_name ⇒ Object
132 133 134 |
# File 'lib/bueller/generator.rb', line 132 def constant_name self.project_name.split(/[-_]/).collect{|each| each.capitalize }.join end |
#feature_filename ⇒ Object
152 153 154 |
# File 'lib/bueller/generator.rb', line 152 def feature_filename "#{project_name}.feature" end |
#features_dir ⇒ Object
160 161 162 |
# File 'lib/bueller/generator.rb', line 160 def features_dir 'features' end |
#features_steps_dir ⇒ Object
168 169 170 |
# File 'lib/bueller/generator.rb', line 168 def features_steps_dir File.join(features_dir, 'step_definitions') end |
#features_support_dir ⇒ Object
164 165 166 |
# File 'lib/bueller/generator.rb', line 164 def features_support_dir File.join(features_dir, 'support') end |
#file_name_prefix ⇒ Object
144 145 146 |
# File 'lib/bueller/generator.rb', line 144 def file_name_prefix self.project_name.gsub('-', '_') end |
#lib_dir ⇒ Object
148 149 150 |
# File 'lib/bueller/generator.rb', line 148 def lib_dir 'lib' end |
#lib_filename ⇒ Object
136 137 138 |
# File 'lib/bueller/generator.rb', line 136 def lib_filename "#{project_name}.rb" end |
#require_name ⇒ Object
140 141 142 |
# File 'lib/bueller/generator.rb', line 140 def require_name self.project_name end |
#run ⇒ Object
122 123 124 125 126 127 128 129 130 |
# File 'lib/bueller/generator.rb', line 122 def run create_files create_version_control $stdout.puts "Bueller has prepared your gem in #{target_dir}" if create_remote_repo? create_and_push_repo $stdout.puts "Bueller has pushed your repo to #{homepage}" end end |
#steps_filename ⇒ Object
156 157 158 |
# File 'lib/bueller/generator.rb', line 156 def steps_filename "#{project_name}_steps.rb" end |