Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- URL='http://10.10.10.10:8081/nexus/service/local/artifact/maven/content'
- GROUP='com.daveops'
- REPO='main'
- USER='admin'
- PWD='admin123'
- basedir = '.'
- files = Dir.glob('*.rpm')
- files.each do |rpm|
- # get RPM version
- rev = /((\d+\.\d+\.?)(\d+)?)/
- ver = rpm.match rev
- # get RPM name
- ren = /^.+?(?=-\d+)/
- name = rpm.match ren
- # @ is causing problems in exec
- file = "@" + rpm
- command = "curl --raw --noproxy 10.50.1.24 -v -F 'r=#{REPO}' -F 'hasPom=false' -F 'e=rpm' -F 'g=#{GROUP}' -F 'v=#{ver}' -F 'a=#{name}' -F 'p=pom' -F 'file=#{file}' -u '#{USER}:#{PWD}' #{URL}"
- exec ( "#{command}" )
- end
- ---
- # Output
- $ ./test.rb
- * Adding handle: conn: 0x2203628
- * Adding handle: send: 0
- * Adding handle: recv: 0
- * Curl_addHandleToPipeline: length: 1
- * - Conn 0 (0x2203628) send_pipe: 1, recv_pipe: 0
- * About to connect() to proxy lon02-proxy-01.corp.monitise.net port 3128 (#0)
- * Trying 10.75.193.97...
- * Connected to lon02-proxy-01.corp.monitise.net (10.75.193.97) port 3128 (#0)
- * Server auth using Basic with user ''admin'
- * couldn't open file "ant-1.8.2.rpm'"
- * Connection #0 to host lon02-proxy-01.corp.monitise.net left intact
- curl: (26) couldn't open file "ant-1.8.2.rpm'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement