Buildr to Artifactory Release


/ Published in: Ruby
Save to your folder(s)

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/


Copy this code and paste it in your HTML
  1. module URI
  2. class HTTP
  3. protected
  4. def write_internal(options, &block)
  5. puts "Uploading to #{self}" if Rake.application.options.trace
  6. Net::HTTP.start(host, port) do |http|
  7. req=Net::HTTP::Put.new(path)
  8. req.basic_auth user, password unless user.nil?
  9. request_data=""
  10. while chunk = yield(32*4096)
  11. request_data+=chunk
  12. end
  13.  
  14. resp, response_data=http.request(req, request_data)
  15. unless resp.is_a?(Net::HTTPOK)
  16. fail "Server returned failing response for upload to
  17. #{self}: #{resp}\n#{response_data}"
  18. end
  19. end#def write_internal
  20.  
  21. end
  22. end
  23. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.