Return to Snippet

Revision: 5988
at April 19, 2008 07:19 by narkisr


Initial Code
module URI
  class HTTP
    protected
    def write_internal(options, &block)
      puts "Uploading to #{self}" if Rake.application.options.trace
      Net::HTTP.start(host, port) do |http|
        req=Net::HTTP::Put.new(path)
        req.basic_auth user, password unless user.nil?
        request_data=""
        while chunk = yield(32*4096)
          request_data+=chunk
        end

        resp, response_data=http.request(req, request_data)
        unless resp.is_a?(Net::HTTPOK)
          fail "Server returned failing response for upload to
#{self}: #{resp}\n#{response_data}"
        end
      end#def write_internal

    end
  end
end

Initial URL


Initial Description
This example shows how to release artifacts into Artifactory by using Buildr, the origin of this code is http://groups.google.com/group/buildr-talk/

Initial Title
Buildr to Artifactory Release

Initial Tags
ruby

Initial Language
Ruby