class PackageCloud::CLI::Repository
Public Instance Methods
create(repo_name)
click to toggle source
# File lib/package_cloud/cli/repository.rb, line 7 def create(repo_name) config.read_or_create client = Client.new(config) print "Looking for repository at #{repo_name}... " repo = client.create_repo(repo_name, options[:private]) print "success!\n".color(:green) puts "Your repository has been created at:" puts " #{repo["url"]}" end
install(repo, package_type)
click to toggle source
# 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
list()
click to toggle source
# File lib/package_cloud/cli/repository.rb, line 20 def list repos = client.repositories if repos.length == 0 puts "You have no repositories at the moment. Create one!" else puts "Your repositories:" puts "" repos.each_with_index do |repo, i| puts " #{repo.fqname} (#{repo.private_human})" puts " last push: #{repo.last_push_human} | packages: #{repo.package_count_human}" puts "" unless i == repos.length - 1 end end end