Class: Ditty::Generators::ProjectGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Ditty::Generators::ProjectGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/ditty/generators/project_generator.rb
Instance Attribute Summary collapse
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
11 12 13 |
# File 'lib/ditty/generators/project_generator.rb', line 11 def folder @folder end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/ditty/generators/project_generator.rb', line 11 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
11 12 13 |
# File 'lib/ditty/generators/project_generator.rb', line 11 def namespace @namespace end |
Class Method Details
.source_root ⇒ Object
22 23 24 |
# File 'lib/ditty/generators/project_generator.rb', line 22 def self.source_root File.('../templates', __dir__) end |
Instance Method Details
#create_startup_files ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ditty/generators/project_generator.rb', line 26 def create_startup_files directory 'logs' directory 'pids' directory 'public' copy_file '.gitignore', './.gitignore' copy_file 'env.example', './.env' copy_file '.rubocop.yml', './.rubocop.yml' copy_file '.rspec', './.rspec' template 'lib/project.rb.erb', "lib/#{folder}.rb" copy_file 'application.rb', './application.rb' copy_file 'config.ru', './config.ru' copy_file 'Rakefile', './Rakefile' copy_file 'sidekiq.rb', './config/sidekiq.rb' copy_file 'sidekiq.yml', './config/sidekiq.yml' copy_file 'spec_helper.rb', './specs/spec_helper.rb' copy_file '../../../spec/support/api_shared_examples.rb', './specs/support/api_shared_examples.rb' copy_file '../../../spec/support/crud_shared_examples.rb', './specs/support/crud_shared_examples.rb' template 'settings.yml.erb', './config/settings.yml' end |
#setup ⇒ Object
15 16 17 18 19 20 |
# File 'lib/ditty/generators/project_generator.rb', line 15 def setup @name = File.basename(Dir.getwd) @folder = @name.underscore @namespace = folder.classify @name = @name.titleize end |