Class: Stipa::Generators::Base
- Inherits:
-
Object
- Object
- Stipa::Generators::Base
- Defined in:
- lib/stipa/generators/base.rb
Constant Summary collapse
- GEM_JS =
File.('../../js', __dir__)
- GEM_MEDIA =
File.('../../../media', __dir__)
- GEM_ROOT =
File.('../..', GEM_JS)
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(name) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(name) ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/stipa/generators/base.rb', line 14 def initialize(name) @name = name @target = File.(name, Dir.pwd) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/stipa/generators/base.rb', line 12 def name @name end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
12 13 14 |
# File 'lib/stipa/generators/base.rb', line 12 def target @target end |
Instance Method Details
#generate ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stipa/generators/base.rb', line 19 def generate abort "Error: '#{name}' already exists." if Dir.exist?(target) say "Creating #{name} (#{template_name})..." make_dirs write_files post_generate init_git say end |