Class: Hanami::CLI::Commands::New Private
- Defined in:
- lib/hanami/cli/commands/new.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: App, DatabaseConfig, TemplateEngine, TestFramework
Constant Summary collapse
- DEFAULT_APPLICATION_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'web'.freeze
- DEFAULT_APPLICATION_BASE_URL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/'.freeze
Instance Method Summary collapse
-
#call(project:, **options) ⇒ Object
private
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength.
Methods inherited from Command
Constructor Details
This class inherits a constructor from Hanami::CLI::Commands::Command
Instance Method Details
#call(project:, **options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/hanami/cli/commands/new.rb', line 284 def call(project:, **) project = Utils::String.underscore(project) database_config = DatabaseConfig.new([:database], project) test_framework = TestFramework.new(hanamirc, [:test]) template_engine = TemplateEngine.new(hanamirc, [:template]) [:project] = project context = Context.new( project: project, database: database_config.type, database_config_hash: database_config.to_hash, database_config: database_config, test_framework: test_framework, template_engine: template_engine, test: .fetch(:test), application_name: .fetch(:application_name), application_base_url: .fetch(:application_base_url), hanami_head: .fetch(:hanami_head), hanami_model_version: '~> 1.1', code_reloading: code_reloading?, hanami_version: hanami_version, project_module: Utils::String.classify(project), options: ) assert_project_name!(context) directory = project_directory(project) files.mkdir(directory) Dir.chdir(directory) do generate_application_templates(context) generate_empty_directories(context) generate_test_templates(context) generate_sql_templates(context) generate_git_templates(context) init_git generate_app(context) end end |