Method: PackageCloud::CLI::Repository#install

Defined in:
lib/package_cloud/cli/repository.rb

#install(repo, package_type) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/package_cloud/cli/repository.rb', line 37

def install(repo, package_type)
  if Process.uid != 0 && package_type != "gem"
    abort("You have to run install as root.".color(:red))
  end

  print "Locating repository at #{repo}... "
  repo = client.repository(repo)
  print "success!\n"
  script = repo.install_script(package_type)
  pid = fork { exec("/bin/bash", script.path) }
  Process.waitpid(pid)
  script.unlink
end