Sha256: 39d9784559a45a2c3926b8cc45e576bc5cb326b4b0f04d9f7fb03513cad81e4c

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

require 'net/http'
require 'uri'
require 'active_support'

module HoptoadTasks
  def self.deploy(opts = {})
    if HoptoadNotifier.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 => HoptoadNotifier.api_key}
    opts.each {|k,v| params["deploy[#{k}]"] = v }

    url = URI.parse("http://#{HoptoadNotifier.host}/deploys.txt")
    response = Net::HTTP.post_form(url, params)
    puts response.body
    return Net::HTTPSuccess === response
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
markbates-hoptoad_notifier-1.2.0.1 lib/hoptoad_tasks.rb
markbates-hoptoad_notifier-1.2.0.2 lib/hoptoad_tasks.rb