Module: ErrornotTasks
- Defined in:
- lib/errornot_tasks.rb
Overview
Capistrano tasks for notifying Errornot of deploys
Class Method Summary collapse
-
.deploy(opts = {}) ⇒ Object
Alerts Errornot of a deploy.
Class Method Details
.deploy(opts = {}) ⇒ Object
Alerts Errornot of a deploy.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/errornot_tasks.rb', line 16 def self.deploy(opts = {}) raise NotImplementedError.new("it's not implemented in errornot now") # TODO: implement it in ErrorNot if ErrornotNotifier.configuration.api_key.blank? puts "I don't seem to be configured with an API key. Please check your configuration." return false end if opts[:rails_env].blank? puts "I don't know to which Rails environment you are deploying (use the TO=production option)." return false end params = {'api_key' => opts.delete(:api_key) || ErrornotNotifier.configuration.api_key} opts.each {|k,v| params["deploy[#{k}]"] = v } url = URI.parse("http://#{ErrornotNotifier.configuration.host}/deploys") proxy = Net::HTTP.Proxy(ErrornotNotifier.configuration.proxy_host, ErrornotNotifier.configuration.proxy_port, ErrornotNotifier.configuration.proxy_user, ErrornotNotifier.configuration.proxy_pass) response = proxy.post_form(url, params) puts response.body return Net::HTTPSuccess === response end |