-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathget_package.rb
More file actions
29 lines (21 loc) · 603 Bytes
/
Copy pathget_package.rb
File metadata and controls
29 lines (21 loc) · 603 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'json'
require 'optparse'
zip = false
OptionParser.new do |opts|
opts.banner = 'Usage: ruby get_package.rb [-z]'
opts.on('-z', '--[no-]zip', 'Get the cpack zip package if available') do |v|
zip = true
end
opts.parse!
end
json = `conan list -f json mtconnect_agent/*:*`
desc = JSON.parse(json)
name, = desc.first[1].first
package, = desc.first[1].first[1].first[1].first[1]['packages'].keys
package_dir = `conan cache path #{name}:#{package}`.strip
if (zip)
file, = Dir["#{package_dir}/*"].select { |f| f =~ %r{/agent[^/]+\.zip$} }
print file
else
print package_dir
end