lib/nucleon/action/create.rb in nucleon-0.1.1 vs lib/nucleon/action/create.rb in nucleon-0.1.2
- old
+ new
@@ -1,51 +1,46 @@
module Nucleon
module Action
-class Create < Plugin::Action
-
- #-----------------------------------------------------------------------------
- # Create action interface
+class Create < Nucleon.plugin_class(:action)
- def normalize
- super('nucleon create [ <project:::reference> ]')
-
- codes :project_failure => 20
- end
+ include Mixin::Action::Project
#-----------------------------------------------------------------------------
- # Action operations
+ # Settings
- def parse(parser)
- parser.option_str(:path, Dir.pwd,
- '--path PROJECT_DIR',
- 'nucleon.core.actions.create.options.path'
- )
- parser.option_str(:revision, :master,
- '--revision REVISION/BRANCH',
- 'nucleon.core.actions.create.options.revision'
- )
- parser.arg_str(:reference,
- 'github:::coralnexus/puppet-cloud-template',
- 'nucleon.core.actions.create.options.reference'
- )
+ def configure
+ super do
+ codes :project_failure
+
+ register :path, :str, Dir.pwd
+
+ project_config
+ end
end
#---
+
+ def arguments
+ [ :project_reference ]
+ end
+
+ #-----------------------------------------------------------------------------
+ # Operations
def execute
- super do |node, network, status|
- info('nucleon.core.actions.create.start')
+ super do |node, network|
+ info('nucleon.actions.create.start')
project = Nucleon.project(extended_config(:project, {
:create => true,
:directory => settings[:path],
- :url => settings[:reference],
+ :url => settings[:project_reference],
:revision => settings[:revision],
:pull => true
- }))
+ }), settings[:project_provider])
- project ? status : code.project_failure
+ myself.status = code.project_failure unless project
end
end
end
end
end