Class: Butterfly::Stub::Base
- Inherits:
-
RubiGen::Base
- Object
- RubiGen::Base
- Butterfly::Stub::Base
- Defined in:
- lib/base.rb
Overview
extend Base class wwith base functionality for the code stub generator generator
Direct Known Subclasses
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#after_generate ⇒ Object
do some final things after generation.
-
#initialize(runtime_args, runtime_options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(runtime_args, runtime_options = {}) ⇒ Base
Returns a new instance of Base.
60 61 62 63 64 65 66 67 68 |
# File 'lib/base.rb', line 60 def initialize(runtime_args, = {}) super @destination_root = File.(args.shift) @name = base_name @author = ENV['USER'] @target = @destination_root @group = @destination_root.match(/\/(\w+)_generators\//)[1] @date = Time.now.strftime("%Y-%m-%d") end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
58 59 60 |
# File 'lib/base.rb', line 58 def @author end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
58 59 60 |
# File 'lib/base.rb', line 58 def date @date end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
58 59 60 |
# File 'lib/base.rb', line 58 def group @group end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
58 59 60 |
# File 'lib/base.rb', line 58 def name @name end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
58 59 60 |
# File 'lib/base.rb', line 58 def target @target end |
Instance Method Details
#after_generate ⇒ Object
do some final things after generation
71 72 73 74 75 |
# File 'lib/base.rb', line 71 def after_generate info = File.read(File.join(spec.path, 'INFO')) rescue '' template = ERB.new(info, nil, '<>') puts "\n#{template.result(binding)}" end |