Class: Hanami::Commands::New::Abstract
- Inherits:
-
Object
- Object
- Hanami::Commands::New::Abstract
- Includes:
- Generators::Generatable
- Defined in:
- lib/hanami/commands/new/abstract.rb
Constant Summary collapse
- DEFAULT_ARCHITECTURE =
'container'.freeze
- DEFAULT_APPLICATION_BASE_URL =
'/'.freeze
Instance Attribute Summary collapse
-
#database_config ⇒ Object
readonly
Returns the value of attribute database_config.
-
#hanami_model_version ⇒ Object
readonly
Returns the value of attribute hanami_model_version.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#target_path ⇒ Object
readonly
Returns the value of attribute target_path.
-
#template_engine ⇒ Object
readonly
Returns the value of attribute template_engine.
-
#test_framework ⇒ Object
readonly
Returns the value of attribute test_framework.
Instance Method Summary collapse
-
#initialize(options, name) ⇒ Abstract
constructor
A new instance of Abstract.
- #start ⇒ Object
Methods included from Generators::Generatable
#add_mapping, #argument_blank?, #destroy, #generator, #map_templates, #post_process_templates, #process_templates, #template_options, #template_source_path
Constructor Details
#initialize(options, name) ⇒ Abstract
Returns a new instance of Abstract.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hanami/commands/new/abstract.rb', line 23 def initialize(, name) @options = Hanami::Utils::Hash.new().symbolize! @name = name @options[:database] ||= Hanami::Generators::DatabaseConfig::DEFAULT_ENGINE assert_name! assert_architecture! @hanami_model_version = '~> 0.7' @database_config = Hanami::Generators::DatabaseConfig.new([:database], project_name) @test_framework = Hanami::Generators::TestFramework.new(hanamirc, @options[:test]) @template_engine = Hanami::Generators::TemplateEngine.new(hanamirc, @options[:template]) end |
Instance Attribute Details
#database_config ⇒ Object (readonly)
Returns the value of attribute database_config.
20 21 22 |
# File 'lib/hanami/commands/new/abstract.rb', line 20 def database_config @database_config end |
#hanami_model_version ⇒ Object (readonly)
Returns the value of attribute hanami_model_version.
20 21 22 |
# File 'lib/hanami/commands/new/abstract.rb', line 20 def hanami_model_version @hanami_model_version end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/hanami/commands/new/abstract.rb', line 20 def @options end |
#target_path ⇒ Object (readonly)
Returns the value of attribute target_path.
20 21 22 |
# File 'lib/hanami/commands/new/abstract.rb', line 20 def target_path @target_path end |
#template_engine ⇒ Object (readonly)
Returns the value of attribute template_engine.
20 21 22 |
# File 'lib/hanami/commands/new/abstract.rb', line 20 def template_engine @template_engine end |
#test_framework ⇒ Object (readonly)
Returns the value of attribute test_framework.
20 21 22 |
# File 'lib/hanami/commands/new/abstract.rb', line 20 def test_framework @test_framework end |
Instance Method Details
#start ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/hanami/commands/new/abstract.rb', line 38 def start FileUtils.mkdir_p(project_directory) Dir.chdir(project_directory) do @target_path = Pathname.pwd super end end |