We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

narkisr on 04/19/08


Tagged

ruby Buildr Artifactory


Versions (?)


Buildr to Artifactory Release


Published in: Ruby 


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/


  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 

You need to login to post a comment.