Class: Merb::GeneratorBase
- Inherits:
-
RubiGen::Base
- Object
- RubiGen::Base
- Merb::GeneratorBase
- Includes:
- GeneratorHelpers
- Defined in:
- lib/merb-gen/base.rb
Constant Summary collapse
- DEFAULT_SHEBANG =
File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
Instance Attribute Summary collapse
-
#assigns ⇒ Object
readonly
Returns the value of attribute assigns.
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#m ⇒ Object
readonly
Returns the value of attribute m.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(args, runtime_options = {}) ⇒ GeneratorBase
constructor
A new instance of GeneratorBase.
- #manifest ⇒ Object
Methods included from GeneratorHelpers
#copy_dirs, #copy_files, #interpolate_path, #relative
Constructor Details
#initialize(args, runtime_options = {}) ⇒ GeneratorBase
Returns a new instance of GeneratorBase.
12 13 14 15 16 17 18 |
# File 'lib/merb-gen/base.rb', line 12 def initialize(args, = {}) super usage if args.empty? self.class.use_component_sources! Merb.generator_scope @destination_root = Dir.pwd @choices ||= [] end |
Instance Attribute Details
#assigns ⇒ Object (readonly)
Returns the value of attribute assigns.
5 6 7 |
# File 'lib/merb-gen/base.rb', line 5 def assigns @assigns end |
#base ⇒ Object (readonly)
Returns the value of attribute base.
5 6 7 |
# File 'lib/merb-gen/base.rb', line 5 def base @base end |
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
5 6 7 |
# File 'lib/merb-gen/base.rb', line 5 def choices @choices end |
#m ⇒ Object (readonly)
Returns the value of attribute m.
5 6 7 |
# File 'lib/merb-gen/base.rb', line 5 def m @m end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/merb-gen/base.rb', line 5 def name @name end |
Instance Method Details
#manifest ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/merb-gen/base.rb', line 20 def manifest record do |m| @m = m ["spec"] = true unless ["test"] # Set directories that should be optional based on command-line args @choices = %w(test spec) # Set the assigns that should be used for path-interpolation and building templates @assigns = {:base_name => File.basename(@name), :test_type => ["spec"] ? "rspec" : "test_unit"} FileUtils.mkdir_p @name copy_dirs copy_files display_framework_selections end end |