package_cloud 0.2.19 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/package_cloud/cli.rb +12 -1
- data/lib/package_cloud/cli/distro.rb +5 -1
- data/lib/package_cloud/cli/entry.rb +49 -39
- data/lib/package_cloud/repository.rb +2 -2
- data/lib/package_cloud/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c0bb5c1a5dd0a5b2fb88d991e59bab6ccce8554
|
4
|
+
data.tar.gz: 5619e3ec3060eafa464a436a767a75641b70e5e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 147e37c0ee59d977a5bb4ccdb06b7462f44c27882546d741740106557971f96107ba8ea24f0503ac2b9fae3565601518812971b9da6ff63cccbfd041653b6377
|
7
|
+
data.tar.gz: 77a12451e17c30770a191300a2b5c8c0a551858a9e3d66260822a5e1182c5e3c2e653882b8fe8ed0232588912d3f9709c211926e2c97cb8be65b7f2d5014be4c
|
data/lib/package_cloud/cli.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require "colorize"
|
2
2
|
require "thor"
|
3
|
+
require "logger"
|
4
|
+
require "benchmark"
|
3
5
|
|
4
6
|
module PackageCloud
|
5
|
-
module CLI
|
7
|
+
module CLI
|
6
8
|
autoload :Distro, "package_cloud/cli/distro"
|
7
9
|
autoload :Entry, "package_cloud/cli/entry"
|
8
10
|
autoload :MasterToken, "package_cloud/cli/master_token"
|
@@ -12,9 +14,18 @@ module PackageCloud
|
|
12
14
|
class Base < Thor
|
13
15
|
class_option "config"
|
14
16
|
class_option "url"
|
17
|
+
class_option "verbose"
|
15
18
|
|
16
19
|
private
|
17
20
|
def config
|
21
|
+
$logger = ::Logger.new(STDOUT)
|
22
|
+
$verbose = !!options[:verbose]
|
23
|
+
if $verbose
|
24
|
+
$logger.level = ::Logger::DEBUG
|
25
|
+
$logger.debug("verbose mode enabled")
|
26
|
+
else
|
27
|
+
$logger.level = ::Logger::WARN
|
28
|
+
end
|
18
29
|
@config ||= begin
|
19
30
|
ConfigFile.new(options[:config] || "~/.packagecloud",
|
20
31
|
options[:url] || "https://packagecloud.io").tap(&:read_or_create)
|
@@ -4,7 +4,11 @@ module PackageCloud
|
|
4
4
|
desc "list package_type",
|
5
5
|
"list available distros and versions for package_type"
|
6
6
|
def list(package_type)
|
7
|
-
distros =
|
7
|
+
distros = nil
|
8
|
+
measurement = Benchmark.measure {
|
9
|
+
distros = client.distributions[package_type]
|
10
|
+
}
|
11
|
+
$logger.debug("distro list request timing: #{measurement}")
|
8
12
|
if distros
|
9
13
|
puts "Listing distributions for #{package_type}:"
|
10
14
|
distros.each do |distro|
|
@@ -40,60 +40,70 @@ module PackageCloud
|
|
40
40
|
option "skip-file-ext-validation", :type => :boolean
|
41
41
|
option "yes", :type => :boolean
|
42
42
|
def push(repo, package_file, *package_files)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
exts = package_files.map { |f| f.split(".").last }.uniq
|
43
|
+
total_time = Benchmark.measure do
|
44
|
+
ARGV.clear # otherwise gets explodes
|
45
|
+
package_files << package_file
|
47
46
|
|
48
|
-
|
49
|
-
abort("You can't push multiple packages of different types at the same time.\nFor example, use *.deb to push all your debs at once.".red)
|
50
|
-
end
|
51
|
-
|
52
|
-
invalid_packages = package_files.select do |f|
|
53
|
-
!["gem", "deb", "rpm", "dsc"].include?(f.split(".").last)
|
54
|
-
end
|
47
|
+
exts = package_files.map { |f| f.split(".").last }.uniq
|
55
48
|
|
56
|
-
|
57
|
-
|
58
|
-
invalid_packages.each do |p|
|
59
|
-
message << " #{p}\n"
|
49
|
+
if package_files.length > 1 && exts.length > 1
|
50
|
+
abort("You can't push multiple packages of different types at the same time.\nFor example, use *.deb to push all your debs at once.".red)
|
60
51
|
end
|
61
|
-
message << "\npackage_cloud only supports debs, gems, and rpms.".red
|
62
|
-
abort(message)
|
63
|
-
end
|
64
52
|
|
65
|
-
|
66
|
-
|
67
|
-
s == "y" || s == "n"
|
53
|
+
invalid_packages = package_files.select do |f|
|
54
|
+
!["gem", "deb", "rpm", "dsc"].include?(f.split(".").last)
|
68
55
|
end
|
69
56
|
|
70
|
-
if
|
71
|
-
|
57
|
+
if !options.has_key?("skip-file-ext-validation") && invalid_packages.any?
|
58
|
+
message = "I don't know how to push these packages:\n\n".red
|
59
|
+
invalid_packages.each do |p|
|
60
|
+
message << " #{p}\n"
|
61
|
+
end
|
62
|
+
message << "\npackage_cloud only supports debs, gems, and rpms.".red
|
63
|
+
abort(message)
|
72
64
|
end
|
73
|
-
end
|
74
65
|
|
75
|
-
|
76
|
-
|
66
|
+
if !options.has_key?("yes") && exts.first == "gem" && package_files.length > 1
|
67
|
+
answer = get_valid("Are you sure you want to push #{package_files.length} packages? (y/n)") do |s|
|
68
|
+
s == "y" || s == "n"
|
69
|
+
end
|
77
70
|
|
78
|
-
|
79
|
-
|
71
|
+
if answer != "y"
|
72
|
+
abort("Aborting...".red)
|
73
|
+
end
|
74
|
+
end
|
80
75
|
|
81
|
-
|
82
|
-
|
83
|
-
print "success!\n"
|
76
|
+
validator = Validator.new(client)
|
77
|
+
dist_id = validator.distribution_id(repo, package_files, exts.first)
|
84
78
|
|
85
|
-
|
86
|
-
|
87
|
-
ext = f.split(".").last
|
79
|
+
# strip os/dist
|
80
|
+
split_repo = repo.split("/")[0..1].join("/")
|
88
81
|
|
89
|
-
|
90
|
-
|
91
|
-
|
82
|
+
print "Looking for repository at #{split_repo}... "
|
83
|
+
client_repo = nil
|
84
|
+
measurement = Benchmark.measure do
|
85
|
+
client_repo = client.repository(split_repo)
|
92
86
|
end
|
87
|
+
print "success!\n"
|
88
|
+
$logger.debug("repository lookup request timing: #{measurement}")
|
89
|
+
|
90
|
+
package_files.each do |f|
|
91
|
+
files = nil
|
92
|
+
ext = f.split(".").last
|
93
93
|
|
94
|
-
|
95
|
-
|
94
|
+
if ext == "dsc"
|
95
|
+
print "Checking source package #{f}... "
|
96
|
+
files = parse_and_verify_dsc(client_repo, f, dist_id)
|
97
|
+
end
|
98
|
+
|
99
|
+
print "Pushing #{f}... "
|
100
|
+
measurement = Benchmark.measure do
|
101
|
+
client_repo.create_package(f, dist_id, files, ext)
|
102
|
+
end
|
103
|
+
$logger.debug("create package request timing: #{measurement}")
|
104
|
+
end
|
96
105
|
end
|
106
|
+
$logger.debug("push command total timing: #{total_time}")
|
97
107
|
end
|
98
108
|
|
99
109
|
desc "version",
|
@@ -12,7 +12,7 @@ module PackageCloud
|
|
12
12
|
begin
|
13
13
|
resp = RestClient::Request.execute(:method => 'post',
|
14
14
|
:url => url,
|
15
|
-
:timeout =>
|
15
|
+
:timeout => nil,
|
16
16
|
:payload => { :package => {:package_file => file_data,
|
17
17
|
:distro_version_id => dist_id}})
|
18
18
|
resp = JSON.parse(resp)
|
@@ -46,7 +46,7 @@ module PackageCloud
|
|
46
46
|
begin
|
47
47
|
RestClient::Request.execute(:method => 'post',
|
48
48
|
:url => url,
|
49
|
-
:timeout =>
|
49
|
+
:timeout => nil,
|
50
50
|
:payload => { :package => params })
|
51
51
|
print "success!\n".green
|
52
52
|
rescue RestClient::UnprocessableEntity => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: package_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Damato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.4.
|
162
|
+
rubygems_version: 2.4.8
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: https://packagecloud.io
|