Class: Hyper::Generator
- Inherits:
-
Object
- Object
- Hyper::Generator
- Includes:
- Term::ANSIColor
- Defined in:
- lib/hyper/generator.rb
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.
7 8 9 10 |
# File 'lib/hyper/generator.rb', line 7 def initialize(name, = {}) @name = name @options = end |
Instance Method Details
#cannot_generate? ⇒ Boolean
24 25 26 |
# File 'lib/hyper/generator.rb', line 24 def cannot_generate? File.directory?(destination_folder) && !@options[:force] end |
#generate ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hyper/generator.rb', line 12 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 |