Class: Adva::Generators::App
- Inherits:
-
Object
- Object
- Adva::Generators::App
- Defined in:
- lib/adva/generators/app.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :core_dir => File.('../../../..', __FILE__), :target => File.('.'), :template => File.('../templates/app/app_template.rb', __FILE__), :engines => [:all], :resources => false, :migrate => false, :bundle => false, :force => false }
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ App
constructor
A new instance of App.
- #invoke(&block) ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ App
Returns a new instance of App.
24 25 26 27 28 |
# File 'lib/adva/generators/app.rb', line 24 def initialize(name, = {}) @options = .reverse_merge!(DEFAULT_OPTIONS) @name = name || File.basename( File.('../', core_dir) ) raise ArgumentError, "#{core_dir.inspect} is not a directory" unless File.directory?(core_dir) end |
Instance Method Details
#invoke(&block) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/adva/generators/app.rb', line 30 def invoke(&block) if force? || build? build generate_resources if generate_resources? bundle if bundle? load_environment if block_given? || migrate? exec(&block) if block_given? install migrate if migrate? else load_environment end end |