Class: Ductr::CLI::NewProjectGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Ductr::CLI::NewProjectGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/ductr/cli/new_project_generator.rb
Overview
Thor generator to create a new project
Class Method Summary collapse
-
.source_root ⇒ String
The templates source used to create a new project.
Instance Method Summary collapse
-
#gen_bin ⇒ void
Creates the bin file for the project.
-
#gen_config ⇒ void
Creates files in the ‘config` folder.
-
#gen_root ⇒ void
Creates files in the project’s root.
-
#init ⇒ void
Doing some setup before generating file, creates the project directory and sets it as destination for the generator.
Class Method Details
.source_root ⇒ String
The templates source used to create a new project
21 22 23 |
# File 'lib/ductr/cli/new_project_generator.rb', line 21 def self.source_root "#{__dir__}/templates/project" end |
Instance Method Details
#gen_bin ⇒ void
This method returns an undefined value.
Creates the bin file for the project
57 58 59 |
# File 'lib/ductr/cli/new_project_generator.rb', line 57 def gen_bin copy_file "bin_ductr.rb", "bin/ductr" end |
#gen_config ⇒ void
This method returns an undefined value.
Creates files in the ‘config` folder
66 67 68 69 70 |
# File 'lib/ductr/cli/new_project_generator.rb', line 66 def gen_config copy_file "config_app.rb", "config/app.rb" copy_file "config_development.yml", "config/development.yml" copy_file "config_environment_development.rb", "config/environment/development.rb" end |
#gen_root ⇒ void
This method returns an undefined value.
Creates files in the project’s root
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ductr/cli/new_project_generator.rb', line 41 def gen_root copy_file "gemfile.rb", "Gemfile" copy_file "rubocop.yml", ".rubocop.yml" create_file "config/initializers/.gitkeep" create_file "lib/.gitkeep" create_file "app/jobs/.gitkeep" create_file "app/pipelines/.gitkeep" create_file "app/schedulers/.gitkeep" end |
#init ⇒ void
This method returns an undefined value.
Doing some setup before generating file, creates the project directory and sets it as destination for the generator
31 32 33 34 |
# File 'lib/ductr/cli/new_project_generator.rb', line 31 def init empty_directory name self.destination_root = "#{destination_root}/#{name}" end |