37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/jenkins/plugin/tools/release.rb', line 37
def run
cred = Jenkins::CiOrg::Credential.new
if !cred.has_credential? then
raise Exception.new("no credential available to connect to jenkins-ci.org. Please create ~/.jenkins-ci.org. See https://wiki.jenkins-ci.org/display/JENKINS/Dot+Jenkins+Ci+Dot+Org")
end
proxy = if ENV['HTTP_PROXY'] || ENV['http_proxy']
proxy_uri = URI.parse(ENV['HTTP_PROXY'] || ENV['http_proxy'])
Net::HTTP::Proxy(proxy_uri.host,
proxy_uri.port,
proxy_uri.user,
proxy_uri.password)
else
Net::HTTP
end
http = proxy.new("repo.jenkins-ci.org")
puts @snapshot ? "deploying as a snapshot. Run with the --release option to release it for real when you are ready" : "deploying as a release"
puts "Generating POM"
version = @snapshot ? @spec.version+"-SNAPSHOT" : @spec.version
pom = ERB.new(File.read(File.dirname(__FILE__)+"/templates/release-pom.xml.erb")).result(binding)
path = "/#{@snapshot?'snapshots':'releases'}/org/jenkins-ci/ruby-plugins/#{@spec.name}/#{version}/#{@spec.name}-#{version}"
req = Net::HTTP::Put.new("#{path}.pom")
req.body = pom
req.basic_auth(cred.user_name,cred.password)
check_error(http.request(req))
puts "Uploading #{@hpi}"
File.open(@hpi,'r') do |f|
req = Net::HTTP::Put.new("#{path}.hpi")
req.body_stream = f
req.basic_auth(cred.user_name,cred.password)
req.content_length = File.size(@hpi)
check_error(http.request(req))
end
puts "See http://maven.jenkins-ci.org"+File.dirname(path)
end
|