Class: Hyper::Generator
- Inherits:
-
Object
- Object
- Hyper::Generator
- Includes:
- Term::ANSIColor
- Defined in:
- lib/hyper/generator.rb
Constant Summary collapse
- TEMPLATE_PATH =
Path to template directory
File.(File.dirname(__FILE__) + '/../../template')
Instance Method Summary collapse
- #cannot_generate? ⇒ Boolean
- #generate ⇒ Object
-
#initialize(name, options = {}) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(name, options = {}) ⇒ Generator
Returns a new instance of Generator.
10 11 12 13 |
# File 'lib/hyper/generator.rb', line 10 def initialize(name, = {}) @name = name @options = end |
Instance Method Details
#cannot_generate? ⇒ Boolean
27 28 29 |
# File 'lib/hyper/generator.rb', line 27 def cannot_generate? File.directory?(destination_folder) && !@options[:force] end |
#generate ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hyper/generator.rb', line 15 def generate if cannot_generate? error "#{@name} exists (use --force to overwrite)" else create_destination_folder template_contents.each do |path| generate_component(path) end end end |