Class: Sincli::Generators::Application
- Inherits:
-
Object
- Object
- Sincli::Generators::Application
- Defined in:
- lib/sincli/generators/application.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #create ⇒ Object
- #create_app_dir ⇒ Object
- #create_assets ⇒ Object
- #create_config ⇒ Object
- #create_models_and_controllers ⇒ Object
- #create_root_dir ⇒ Object
- #create_root_files ⇒ Object
- #create_views ⇒ Object
-
#initialize(name, options) ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize(name, options) ⇒ Application
Returns a new instance of Application.
6 7 8 9 10 |
# File 'lib/sincli/generators/application.rb', line 6 def initialize(name, ) @name = name @options = @options.delete(:db) if @options[:no_database] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sincli/generators/application.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/sincli/generators/application.rb', line 4 def @options end |
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sincli/generators/application.rb', line 12 def create create_root_dir create_root_files create_config create_app_dir create_views create_assets create_models_and_controllers Dir.chdir('..') Executions.new(name, ).execute end |
#create_app_dir ⇒ Object
38 39 40 41 |
# File 'lib/sincli/generators/application.rb', line 38 def create_app_dir Dir.mkdir 'app' Dir.chdir 'app' end |
#create_assets ⇒ Object
49 50 51 52 53 |
# File 'lib/sincli/generators/application.rb', line 49 def create_assets return if [:api_only] Assets.new(name, ).generate end |
#create_config ⇒ Object
28 29 30 |
# File 'lib/sincli/generators/application.rb', line 28 def create_config Config.new(name, ).generate end |
#create_models_and_controllers ⇒ Object
55 56 57 |
# File 'lib/sincli/generators/application.rb', line 55 def create_models_and_controllers ModelsAndControllers.new(name, ).generate end |
#create_root_dir ⇒ Object
32 33 34 35 36 |
# File 'lib/sincli/generators/application.rb', line 32 def create_root_dir dir_name = name.dash_case dir = Dir.mkdir(dir_name) Dir.chdir(dir_name) end |