Class: Grapethor::New
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Grapethor::New
- Includes:
- Utils, Thor::Actions
- Defined in:
- lib/grapethor/generators/new.rb
Constant Summary
Constants included from Utils
Utils::ATTRS_MAP, Utils::CONFIG_FILENAME, Utils::TEST_FRAMEWORK_DIRNAME
Instance Attribute Summary collapse
-
#app_copyright ⇒ Object
readonly
Returns the value of attribute app_copyright.
-
#app_db ⇒ Object
readonly
Returns the value of attribute app_db.
-
#app_license ⇒ Object
readonly
Returns the value of attribute app_license.
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#app_orm ⇒ Object
readonly
Returns the value of attribute app_orm.
-
#app_path ⇒ Object
readonly
Returns the value of attribute app_path.
-
#app_prefix ⇒ Object
readonly
Returns the value of attribute app_prefix.
-
#app_ruby ⇒ Object
readonly
Returns the value of attribute app_ruby.
-
#app_server ⇒ Object
readonly
Returns the value of attribute app_server.
-
#app_test_framework ⇒ Object
readonly
Returns the value of attribute app_test_framework.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#app_copyright ⇒ Object (readonly)
Returns the value of attribute app_copyright.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_copyright @app_copyright end |
#app_db ⇒ Object (readonly)
Returns the value of attribute app_db.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_db @app_db end |
#app_license ⇒ Object (readonly)
Returns the value of attribute app_license.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_license @app_license end |
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_name @app_name end |
#app_orm ⇒ Object (readonly)
Returns the value of attribute app_orm.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_orm @app_orm end |
#app_path ⇒ Object (readonly)
Returns the value of attribute app_path.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_path @app_path end |
#app_prefix ⇒ Object (readonly)
Returns the value of attribute app_prefix.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_prefix @app_prefix end |
#app_ruby ⇒ Object (readonly)
Returns the value of attribute app_ruby.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_ruby @app_ruby end |
#app_server ⇒ Object (readonly)
Returns the value of attribute app_server.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_server @app_server end |
#app_test_framework ⇒ Object (readonly)
Returns the value of attribute app_test_framework.
8 9 10 |
# File 'lib/grapethor/generators/new.rb', line 8 def app_test_framework @app_test_framework end |
Class Method Details
.exit_on_failure? ⇒ Boolean
22 23 24 |
# File 'lib/grapethor/generators/new.rb', line 22 def self.exit_on_failure? true end |
.source_root ⇒ Object
27 28 29 |
# File 'lib/grapethor/generators/new.rb', line 27 def self.source_root File.join(__dir__, '..') end |
Instance Method Details
#create_new ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/grapethor/generators/new.rb', line 110 def create_new report("Creating new application...") do directory 'templates/new', File.join(app_path, app_name) chmod File.join(app_path, app_name, 'bin', 'console'), 0755 chmod File.join(app_path, app_name, 'bin', 'setup'), 0755 chmod File.join(app_path, app_name, 'bin', 'server'), 0755 directory "templates/#{app_db}", "#{app_path}/#{app_name}" directory "templates/#{app_test_framework}", "#{app_path}/#{app_name}" directory "templates/docker", "#{app_path}/#{app_name}" if app_docker? directory "templates/license/#{app_license}", "#{app_path}/#{app_name}" directory "templates/swagger", "#{app_path}/#{app_name}" if app_swagger? end end |
#parse_args_and_opts ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/grapethor/generators/new.rb', line 94 def parse_args_and_opts @app_name = name @app_path = [:path] @app_prefix = [:prefix] @app_server = [:server] @app_test_framework = [:test] @app_db = [:db] @app_orm = [:orm] @app_docker = [:docker] @app_license = [:license] @app_copyright = [:copyright] || "Author of #{app_name}" @app_ruby = [:ruby] @app_swagger = [:swagger] end |