Class: Nucleon::Action::Project::Add
- Inherits:
-
Object
- Object
- Nucleon::Action::Project::Add
- Includes:
- Mixin::Action::Project, Mixin::Action::Push
- Defined in:
- lib/nucleon/action/project/add.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
-
#arguments ⇒ Object
—.
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Action operations.
Methods included from Mixin::Action::Push
#push, #push_config, #push_ignore
Methods included from Mixin::Action::Project
#project_config, #project_ignore, #project_load
Class Method Details
.describe ⇒ Object
Info
13 14 15 |
# File 'lib/nucleon/action/project/add.rb', line 13 def self.describe super(:project, :add, 700) end |
Instance Method Details
#arguments ⇒ Object
40 41 42 |
# File 'lib/nucleon/action/project/add.rb', line 40 def arguments [ :sub_path, :sub_reference ] end |
#configure ⇒ Object
Settings
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/nucleon/action/project/add.rb', line 20 def configure super do codes :project_failure, :add_failure, :push_failure register_str :path, Dir.pwd register_str :sub_path, nil register_project :sub_reference, nil register_bool :editable project_config push_config end end |
#execute ⇒ Object
Action operations
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/nucleon/action/project/add.rb', line 47 def execute super do info('start') if project = project_load(settings[:path], false) sub_info = project.translate_reference(settings[:sub_reference], settings[:editable]) sub_path = settings[:sub_path] if sub_info sub_url = sub_info[:url] sub_revision = sub_info[:revision] else sub_url = settings[:sub_reference] sub_revision = nil end if project.add_subproject(sub_path, sub_url, sub_revision) myself.status = code.push_failure unless push(project) else myself.status = code.add_failure end else myself.status = code.project_failure end end end |