Class: Thor::Actions::NewProject
- Inherits:
-
Object
- Object
- Thor::Actions::NewProject
- Includes:
- Angus::FileHandler, Angus::HelperMethods
- Defined in:
- lib/angus/generator/thor/new_project.rb
Overview
:nodoc:
Constant Summary collapse
- FILE_MAPPINGS =
{ 'services/service.rb.erb' => -> command, app_name { File.join(Angus::CommandProcessor::SERVICES_DIR, "#{command.underscore(command.classify(app_name))}.rb") }, 'resources/resource.rb.erb' => -> command, name { "#{command.underscore(command.classify(name))}.rb" }, 'definitions/operations.yml.erb' => -> command, _ { File.join(command.resource_name, 'operations.yml') } }
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#base ⇒ Object
Returns the value of attribute base.
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(base, name, config) ⇒ NewProject
constructor
Creates a new project.
- #invoke! ⇒ Object
- #mapping ⇒ Object
- #revoke! ⇒ Object
Methods included from Angus::FileHandler
#copy_erb_file, #filename_resolver, #is_erb?
Methods included from Angus::HelperMethods
#classify, #pluralize, #underscore
Constructor Details
#initialize(base, name, config) ⇒ NewProject
Creates a new project.
35 36 37 38 39 |
# File 'lib/angus/generator/thor/new_project.rb', line 35 def initialize(base, name, config) @base, @config = base, { :verbose => true }.merge(config) self.app_name = name end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
30 31 32 |
# File 'lib/angus/generator/thor/new_project.rb', line 30 def app_name @app_name end |
#base ⇒ Object
Returns the value of attribute base.
30 31 32 |
# File 'lib/angus/generator/thor/new_project.rb', line 30 def base @base end |
#config ⇒ Object
Returns the value of attribute config.
30 31 32 |
# File 'lib/angus/generator/thor/new_project.rb', line 30 def config @config end |
Instance Method Details
#invoke! ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/angus/generator/thor/new_project.rb', line 41 def invoke! base.empty_directory(app_name) new_app_directories.each do |directory| base.empty_directory(File.join(app_name, directory)) end new_app_files.each do |file| if is_erb?(file) copy_erb_file(file, app_name) else base.copy_file(file, File.join(app_name, file)) end end end |
#mapping ⇒ Object
61 62 63 |
# File 'lib/angus/generator/thor/new_project.rb', line 61 def mapping FILE_MAPPINGS end |
#revoke! ⇒ Object
57 58 59 |
# File 'lib/angus/generator/thor/new_project.rb', line 57 def revoke! end |