Module: Rip::Sh::Gem
Instance Method Summary collapse
Instance Method Details
#check? ⇒ Boolean
6 7 8 |
# File 'lib/rip/sh/gem.rb', line 6 def check? `which #{gembin}`.strip.any? end |
#dependencies(name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rip/sh/gem.rb', line 18 def dependencies(name) if rgem("dependency #{name} --remote") =~ /(Gem #{name}-.*?)(Gem|\z)/m $1.split("\n").grep(/runtime\s*\)/).map do |line| line =~ /([\w-]+)\s*\([~><=]+\s*((?:\d+\.?)+\d+|\d)/ source, version = $1, $2 if source Package.for(source, version) else nil end end.compact else [] end end |
#gembin ⇒ Object
34 35 36 |
# File 'lib/rip/sh/gem.rb', line 34 def gembin ENV['GEMBIN'] || 'gem' end |
#rgem(command) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rip/sh/gem.rb', line 10 def rgem(command) Timeout.timeout(30) do `#{gembin} #{command} 2> /dev/null` end rescue Timeout::Error '' end |