Class: Appleseed::Generator
- Inherits:
-
Object
- Object
- Appleseed::Generator
- Defined in:
- lib/appleseed/options.rb,
lib/appleseed/generator.rb,
lib/appleseed/application.rb,
lib/appleseed/generator/github_mixin.rb
Defined Under Namespace
Modules: GithubMixin Classes: Application, Options
Instance Attribute Summary collapse
-
#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.
-
#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.
-
#should_create_github_repository ⇒ Object
Returns the value of attribute should_create_github_repository.
-
#should_create_heroku_deployment ⇒ Object
Returns the value of attribute should_create_heroku_deployment.
-
#should_setup_rubyforge ⇒ Object
Returns the value of attribute should_setup_rubyforge.
-
#should_use_bundler ⇒ Object
Returns the value of attribute should_use_bundler.
-
#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.
-
#template_url ⇒ Object
Returns the value of attribute template_url.
-
#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
- #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.
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/appleseed/generator.rb', line 43 def initialize( = {}) self. = self.project_name = [:project_name] if self.project_name.nil? || self.project_name.squeeze.strip == "" raise NoGitHubRepoNameGiven end self.target_dir = self.project_name self.summary = [:summary] || 'TODO: one-line summary of your web site' self.description = [:description] || 'TODO: longer description of your web site' self.template_url = [:template_url] || 'http://github.com/endymion/appleseed/raw/master/templates/default.rb' # self.template_url = options[:template_url] || 'http://localhost/projects/appleseed/templates/default.rb' 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 self.should_create_heroku_deployment = ![:no_heroku] end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def description @description end |
#development_dependencies ⇒ Object
Returns the value of attribute development_dependencies.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def development_dependencies @development_dependencies end |
#documentation_framework ⇒ Object
Returns the value of attribute documentation_framework.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def documentation_framework @documentation_framework end |
#git_remote ⇒ Object
Returns the value of attribute git_remote.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def git_remote @git_remote end |
#homepage ⇒ Object
Returns the value of attribute homepage.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def homepage @homepage end |
#options ⇒ Object
Returns the value of attribute options.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def @options end |
#project_name ⇒ Object
Returns the value of attribute project_name.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def project_name @project_name end |
#repo ⇒ Object
Returns the value of attribute repo.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def repo @repo end |
#should_create_github_repository ⇒ Object
Returns the value of attribute should_create_github_repository.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def should_create_github_repository @should_create_github_repository end |
#should_create_heroku_deployment ⇒ Object
Returns the value of attribute should_create_heroku_deployment.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def should_create_heroku_deployment @should_create_heroku_deployment end |
#should_setup_rubyforge ⇒ Object
Returns the value of attribute should_setup_rubyforge.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def should_setup_rubyforge @should_setup_rubyforge end |
#should_use_bundler ⇒ Object
Returns the value of attribute should_use_bundler.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def should_use_bundler @should_use_bundler end |
#should_use_cucumber ⇒ Object
Returns the value of attribute should_use_cucumber.
31 32 33 |
# File 'lib/appleseed/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/appleseed/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/appleseed/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/appleseed/generator.rb', line 31 def summary @summary end |
#target_dir ⇒ Object
Returns the value of attribute target_dir.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def target_dir @target_dir end |
#template_url ⇒ Object
Returns the value of attribute template_url.
31 32 33 |
# File 'lib/appleseed/generator.rb', line 31 def template_url @template_url end |
#testing_framework ⇒ Object
Returns the value of attribute testing_framework.
31 32 33 |
# File 'lib/appleseed/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/appleseed/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/appleseed/generator.rb', line 31 def user_name @user_name end |
Instance Method Details
#constant_name ⇒ Object
88 89 90 |
# File 'lib/appleseed/generator.rb', line 88 def constant_name self.project_name.split(/[-_]/).collect{|each| each.capitalize }.join end |
#feature_filename ⇒ Object
108 109 110 |
# File 'lib/appleseed/generator.rb', line 108 def feature_filename "#{project_name}.feature" end |
#features_dir ⇒ Object
116 117 118 |
# File 'lib/appleseed/generator.rb', line 116 def features_dir 'features' end |
#features_steps_dir ⇒ Object
124 125 126 |
# File 'lib/appleseed/generator.rb', line 124 def features_steps_dir File.join(features_dir, 'step_definitions') end |
#features_support_dir ⇒ Object
120 121 122 |
# File 'lib/appleseed/generator.rb', line 120 def features_support_dir File.join(features_dir, 'support') end |
#file_name_prefix ⇒ Object
100 101 102 |
# File 'lib/appleseed/generator.rb', line 100 def file_name_prefix self.project_name.gsub('-', '_') end |
#lib_dir ⇒ Object
104 105 106 |
# File 'lib/appleseed/generator.rb', line 104 def lib_dir 'lib' end |
#lib_filename ⇒ Object
92 93 94 |
# File 'lib/appleseed/generator.rb', line 92 def lib_filename "#{project_name}.rb" end |
#require_name ⇒ Object
96 97 98 |
# File 'lib/appleseed/generator.rb', line 96 def require_name self.project_name end |
#run ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/appleseed/generator.rb', line 74 def run create_files create_version_control $stdout.puts "Appleseed has prepared your new web application project in #{target_dir}" if should_create_github_repository create_and_push_repo $stdout.puts "Appleseed has pushed your git repository to #{git_remote}" end if should_create_heroku_deployment create_and_push_deployment $stdout.puts "Appleseed has pushed your web application to heroku" end end |
#steps_filename ⇒ Object
112 113 114 |
# File 'lib/appleseed/generator.rb', line 112 def steps_filename "#{project_name}_steps.rb" end |