9
10
11
12
13
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
48
49
50
51
|
# File 'lib/gem_syslibs.rb', line 9
def check
data = []
definition = Bundler.definition
definition.validate_ruby!
deps = definition.dependencies
missing = []
deps.each do |g|
exists = %x(gem list -i #{g.name})
missing << g.name if exists.chop == "false"
end
req = HTTParty.post(ENDPOINT,
body: {
packages: missing,
os: PLATFORM.chop,
})
success_data = JSON.parse req.body
if success_data.size > 0
if success_data.include? 'message'
puts success_data['message']
else
libs =""
packages =""
success_data.each do |r|
libs << r["libs"].join(" ")+" "
packages << r["package"]['name']+" "
end
puts "you have to install the following system libraries #{libs} for #{packages} package(s)\n"
if PLATFORM == "Linux"
puts "Run this command in terminal sudo apt-get install #{libs}"
else
puts "Run this command in terminal brew install #{libs}"
end
end
else
puts "No system libraries needed."
end
end
|