lib/morph-cli.rb in morph-cli-0.2.2 vs lib/morph-cli.rb in morph-cli-0.2.4
- old
+ new
@@ -1,7 +1,8 @@
require "morph-cli/version"
require 'yaml'
+require 'find'
module MorphCLI
def self.execute(directory, development, env_config)
puts "Uploading and running..."
file = MorphCLI.create_tar(directory, MorphCLI.all_paths(directory))
@@ -21,11 +22,19 @@
else
puts http_response.body
exit(1)
end
end
+ if env_config.key?(:timeout)
+ timeout = env_config[:timeout]
+ else
+ timeout = 600 # 10 minutes should be "enough for everyone", right?
+ # Setting to nil will disable the timeout entirely.
+ # Default is 60 seconds.
+ end
result = RestClient::Request.execute(:method => :post, :url => "#{env_config[:base_url]}/run",
- :payload => {:api_key => env_config[:api_key], :code => file}, :block_response => block)
+ :payload => {:api_key => env_config[:api_key], :code => file}, :block_response => block,
+ :timeout => timeout)
end
def self.log(line)
unless line.empty?
a = JSON.parse(line)