module Rgem

Constants

API_URL
GEMFILE
VERSION

Public Class Methods

get_gem_file_path(project_path) click to toggle source
# File lib/rgem.rb, line 35
def self.get_gem_file_path(project_path)
  project_path = Dir.getwd() if !project_path
  File.absolute_path(GEMFILE, project_path)
end
get_os_info() click to toggle source
# File lib/rgem.rb, line 40
def self.get_os_info
  os_info = {}
  os_info["os"] = RbConfig::CONFIG["target_os"]
  os_info["cpu"] = RbConfig::CONFIG["target_cpu"]
  os_info
end
install(gems) click to toggle source
# File lib/rgem.rb, line 28
def self.install(gems)
  cmd = "sudo apt install ";
  gems.each do |gem| cmd += gem + " " end
  puts cmd
  system(cmd)
end
install_gems(project_path) click to toggle source
# File lib/rgem.rb, line 19
def self.install_gems(project_path)
  sys_dep = []
  gems = list_gems project_path
  gems.each do |gem|
    sys_dep = sys_dep + gem["sysDep"]
  end
  install sys_dep
end
list_gems(project_path) click to toggle source
# File lib/rgem.rb, line 11
def self.list_gems(project_path)
  gem_file_path  = get_gem_file_path project_path
  gems = Parser.parse gem_file_path
  os_info = get_os_info
  response = Request.post("#{API_URL}/api/gems/many/list", { gems: gems, os_info: os_info })
  JSON.parse(response.body)
end