Class: Sprout::GeneratorGenerator
- Inherits:
-
Sprout::Generator::Base
- Object
- Executable::Base
- Sprout::Generator::Base
- Sprout::GeneratorGenerator
- Defined in:
- lib/sprout/generators/generator/generator_generator.rb
Constant Summary
Constant Summary
Constants included from Executable
Executable::DEFAULT_FILE_EXPRESSION, Executable::DEFAULT_PREFIX, Executable::DEFAULT_SHORT_PREFIX
Instance Attribute Summary (collapse)
-
- (Object) bin
The name of the folder where binary or executable artifacts should be created by compiler tasks.
-
- (Object) extension
The default (primary) file extension for generated source files.
-
- (Object) fixtures
The name of the child folder of the test folder where fixtures should be generated.
-
- (Object) generators
The name of the folder where custom generators and templates will be found.
-
- (Object) lib
The name of the folder where external libraries will be installed.
-
- (Object) namespace
The default module that classes will be added to.
-
- (Object) test
The name of the folder where tests should be generated.
-
- (Object) unit
The name of the child folder of the test folder where unit tests should be generated.
-
- (Object) vendor
The name of the folder where external source code should be placed.
Attributes inherited from Sprout::Generator::Base
#destroy, #force, #input, #logger, #name, #path, #pkg_name, #pkg_version, #quiet, #show_template_paths, #templates
Attributes inherited from Executable::Base
#abort_on_failure, #default_prefix, #default_short_prefix, #executable, #param_hash, #params, #pkg_name, #pkg_version, #prerequisites, #rake_task_name
Instance Method Summary (collapse)
- - (Object) manifest
- - (Object) massage_input protected
Methods inherited from Sprout::Generator::Base
#create_template_paths, #default_search_paths, #directory, #do_show_template_paths, #execute, #file, #generator, inherited, #prepare_command, #resolve_template, #say, #template, #template_paths, #unexecute, #validate
Methods inherited from Executable::Base
add_param, add_param_alias, #binary_path, #binary_path=, #create_outer_task, #default_file_expression, #execute, #execute_delegate, #from_hash, #initialize, #initialize_defaults, #library_added, #parse!, #parse_extra_options!, #parse_rake_task_arg, #prepare, set, static_default_value_collection, static_parameter_collection, #stderr, #stderr=, #stdout, #stdout=, #system_execute, #to_hash, #to_help, #to_rake, #to_shell, #update_rake_task_name_from_args
Methods included from Concern
#append_features, extended, #included
Constructor Details
This class inherits a constructor from Sprout::Executable::Base
Instance Attribute Details
- (Object) bin
The name of the folder where binary or executable artifacts should be created by compiler tasks.
42 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 42 add_param :bin, String, { :default => 'bin' } |
- (Object) extension
The default (primary) file extension for generated source files. This should hint at the project type.
47 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 47 add_param :extension, String, { :default => '.as' } |
- (Object) fixtures
The name of the child folder of the test folder where fixtures should be generated.
32 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 32 add_param :fixtures, String, { :default => 'fixtures' } |
- (Object) generators
The name of the folder where custom generators and templates will be found.
18 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 18 add_param :generators, String, { :default => 'generators' } |
- (Object) lib
The name of the folder where external libraries will be installed.
13 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 13 add_param :lib, String, { :default => 'lib' } |
- (Object) namespace
The default module that classes will be added to.
8 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 8 add_param :namespace, String, { :default => ''} |
- (Object) test
The name of the folder where tests should be generated.
22 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 22 add_param :test, String, { :default => 'test' } |
- (Object) unit
The name of the child folder of the test folder where unit tests should be generated.
27 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 27 add_param :unit, String, { :default => 'unit' } |
- (Object) vendor
The name of the folder where external source code should be placed.
37 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 37 add_param :vendor, String, { :default => 'vendor' } |
Instance Method Details
- (Object) manifest
49 50 51 52 53 54 55 56 57 58 59 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 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 49 def manifest massage_input directory bin do template "#{input.dash_case}", "generator_executable" end directory lib do #We need to add a folder with the same name as the module to be used in order to faux namespace our generators to avoid collisions from super classes directory namespace do directory generators do template "#{input.snake_case}_generator.rb", "generator_class.rb" directory "templates" do template "#{input.camel_case}#{extension}", "generator_template" end end end end directory test do directory unit do template "#{input.snake_case}_generator_test.rb", "generator_test.rb" template "test_helper.rb", "generator_test_helper.rb" end directory fixtures do directory "generators" end end if !File.exists? 'Gemfile' template 'Gemfile', 'generator_gemfile' else say "[INFO] It seems you already have a Gemfile in this project, please be sure it has the following content:" say '' say ' gem "sprout", ">= #{Sprout::VERSION::STRING}"' say '' say ' group :development do' say ' gem "shoulda"' say ' gem "mocha"' say ' end' say '' end end |
- (Object) massage_input (protected)
95 96 97 98 |
# File 'lib/sprout/generators/generator/generator_generator.rb', line 95 def massage_input self.input = input.gsub(/_generator$/, '') self.input = input.gsub(/Generator$/, '') end |