lib/simple_deploy/cli/clone.rb in simple_deploy-0.5.5 vs lib/simple_deploy/cli/clone.rb in simple_deploy-0.5.6

- old
+ new

@@ -18,10 +18,11 @@ opt :environment, "Set the target environment", :type => :string opt :source_name, "Stack name for the stack to clone", :type => :string opt :new_name, "Stack name for the new stack", :type => :string opt :attributes, "= separated attribute and it's value", :type => :string, :multi => true + opt :template, "Path to a new template file", :type => :string end CLI::Shared.valid_options? :provided => @opts, :required => [:environment, :source_name, :new_name] @@ -29,11 +30,15 @@ :logger => logger cloned_attributes = filter_attributes source_stack.attributes new_attributes = merge_attributes cloned_attributes, override_attributes - template_file = Tempfile.new("#{@opts[:new_name]}_template.json").path - File::open(template_file, 'w') { |f| f.write source_stack.template.to_json } + if @opts[:template] + template_file = @opts[:template] + else + template_file = Tempfile.new("#{@opts[:new_name]}_template.json").path + File::open(template_file, 'w') { |f| f.write source_stack.template.to_json } + end new_stack.create :attributes => new_attributes, :template => template_file end