Class: DefaultArtifactRepository
- Inherits:
-
Object
- Object
- DefaultArtifactRepository
- Defined in:
- lib/conan/repository.rb
Constant Summary collapse
- @@artifact_repository_url =
'http://nexus.mtnsatcloud.com/nexus'
- @@artifact_repository_local_api_url =
"#{@@artifact_repository_url}/service/local/artifact/maven"
Instance Method Summary collapse
- #downloadArtifact(output_dir, group_id, artifact_id, extension, version, sha1_hash) ⇒ Object
- #downloadNewRelicAgent(output_dir, nr_version, sha1_hash) ⇒ Object
- #resolveArtifact(group_id, artifact_id, extension, version = 'LATEST') ⇒ Object
Instance Method Details
#downloadArtifact(output_dir, group_id, artifact_id, extension, version, sha1_hash) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/conan/repository.rb', line 14 def downloadArtifact(output_dir, group_id, artifact_id, extension, version, sha1_hash) if (extension == 'jar') # put jars in a parent directory output_dir = File.join(output_dir, "#{artifact_id}") end url="#{@@artifact_repository_local_api_url}/content?r=releases&g=#{group_id}&a=#{artifact_id}&v=#{version}&e=#{extension}" target_file = File.join(output_dir, "#{artifact_id}.#{extension}") HttpUtil.download(url, target_file, "#{artifact_id}-#{version}.#{extension}", sha1_hash) # extract tar balls if (extension == 'tar.gz') dir = "#{output_dir}/#{artifact_id}" FileUtils.rm_rf dir FileUtils.mkdir_p dir `tar -xf #{target_file} -C #{dir}` # TODO fail if tar doesn't work # extract deploy artifacts elsif (extension == 'jar') # templates dir = "#{output_dir}/deploy-templates" FileUtils.rm_rf dir FileUtils.mkdir_p dir c = "unzip -j #{target_file} 'META-INF/deploy/templates/*.erb' -d '#{dir}'" system(c) or raise "unzip failed: #{c}" # new relic extensions dir = "#{output_dir}/extensions" FileUtils.rm_rf dir FileUtils.mkdir_p dir c = "unzip -j #{target_file} 'META-INF/deploy/extensions/*.yml' -d '#{dir}'" system(c) # extensions are optional, it's ok if this one fails end end |
#downloadNewRelicAgent(output_dir, nr_version, sha1_hash) ⇒ Object
49 50 51 52 53 |
# File 'lib/conan/repository.rb', line 49 def downloadNewRelicAgent(output_dir, nr_version, sha1_hash) url = "#{@@artifact_repository_url}/content/groups/public/com/newrelic/agent/java/newrelic-agent/#{nr_version}/newrelic-agent-#{nr_version}.jar" target_file = File.join(output_dir, "newrelic.jar") HttpUtil.download(url, target_file, "newrelic-agent-#{nr_version}.jar", sha1_hash) end |
#resolveArtifact(group_id, artifact_id, extension, version = 'LATEST') ⇒ Object
8 9 10 11 |
# File 'lib/conan/repository.rb', line 8 def resolveArtifact(group_id, artifact_id, extension, version='LATEST') # we only care about the releases repo, no snapshots please RestClient.get("#{@@artifact_repository_local_api_url}/resolve?r=releases&g=#{group_id}&a=#{artifact_id}&v=#{version}&e=#{extension}") end |