lib/stackfu/commands/deploy_command.rb in stackfu-0.1.4 vs lib/stackfu/commands/deploy_command.rb in stackfu-0.1.5

- old
+ new

@@ -1,8 +1,9 @@ module StackFu::Commands class DeployCommand < Command include StackFu::ApiHooks + aliases :dep # error_messages :missing_subcommand => "You have to tell what you want to deploy and to which server." # subcommand :script, :required_parameters => [:plugin_name, :server] def default(parameters, options) @@ -92,20 +93,21 @@ end server_id = server.id server.id = server.slug begin - deployment = server.post(:deploy, {}, { :id => server_id, :script_id => target.slug, :params => params }.to_json) + deployment = Script.new(:id => target.slug).post(:deploy, {}, { :server_ids => [server.slug], :params => params }.to_json) rescue ActiveResource::ClientError if $!.message =~ /406/ puts "Error: ".foreground(:red) + "Cannot deploy - there is another deploy queued or running for this server." return else raise end end - deployment = JSON.parse(deployment.body) + deployments = JSON.parse(deployment.body) + deployment = deployments.first if options[:"no-follow"] puts "Your deployment have been submitted" return end \ No newline at end of file