Class: Rsyslibs::Dependencies
- Inherits:
-
Object
- Object
- Rsyslibs::Dependencies
- Defined in:
- lib/rsyslibs.rb
Class Method Summary collapse
- .install_syslibs ⇒ Object
- .print_friendly_syslibs ⇒ Object
- .project_dependencies ⇒ Object
- .system_dependencies ⇒ Object
Class Method Details
.install_syslibs ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rsyslibs.rb', line 38 def install_syslibs syslibs = JSON.parse(system_dependencies) return 'No libraries found.' if syslibs.empty? os_name = Rsyslibs::OperatingSystemInfo.os_name case os_name when 'MacOS' then syslibs.each { |lib| `brew install #{lib['name']}` } when 'Linux' then syslibs.each { |lib| `apt-get install #{lib['name']}` } else "I don't know how to install these libraries on this operating system :(" end end |
.print_friendly_syslibs ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rsyslibs.rb', line 22 def print_friendly_syslibs syslibs = JSON.parse(system_dependencies) return 'No libraries found.' if syslibs.empty? puts "#{syslibs.size} system libraries found..." puts '' syslibs.each_with_index do |lib, index| project_dependencies = lib['project_dependencies'].collect { |v| v['name'] }.join(', ') puts "#{index + 1}- #{lib['name']} for gems (#{project_dependencies}) on operating system #{lib['os']}." end puts '' puts "Run 'sudo apt-get install LIBRARY NAME' to install on Ubuntu and Debian-based distros." puts "Run 'brew install LIBRARY NAME' to install on macOS." syslibs end |
.project_dependencies ⇒ Object
18 19 20 |
# File 'lib/rsyslibs.rb', line 18 def project_dependencies Bundler.definition.dependencies.map(&:name) end |
.system_dependencies ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rsyslibs.rb', line 10 def system_dependencies payload = { project_dependencies: project_dependencies, os_info: os_info }.to_json parse_response(api(:post, '/lookup_syslibs', payload)) end |