package_cloud 0.2.33 → 0.2.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09c1d89b6d9533a6974cd926ae0fd37c2baee5ec
4
- data.tar.gz: bb9e92a7fb5ea19c67878f928c0ce2a544d79b6d
3
+ metadata.gz: 642ced8d136425be09627da60884e938d5499574
4
+ data.tar.gz: 6522da38442c8e0c36889bb34e8a99a8284b97b1
5
5
  SHA512:
6
- metadata.gz: e37535b42a7e1ecf525cb088f4f7953ff994ee1fbf0f5260b03dd7e1b6664f54535410b4b4ba22bcf5e2b9e7f93b1fc39a7c1067b357f40dc805d4a68333698a
7
- data.tar.gz: 3ea8fd07a37b92d58144a87192214ac2d1a73d2b3258f32edbe6efc55876483fba99810eb2e7eb27ce34f7b20151cc87c2de4c2b1ac33e483bccf723fe00bc13
6
+ metadata.gz: 9628525e042176ea0a32f5793148560f552ee80e60168f426a670b2a3c6c9dc2dab95a33b6cbfa5185ca3916e53968b9b716ee74d8c7d5ef68fd9798cf479bff
7
+ data.tar.gz: 612870dab5c457616be75a877a7a07b99beed3b3a8fc5fc1192eb52327380545075947dd826eae34204e91c2b535ad5b7d59b2e8e3976451a37fdbbb51108c76
data/lib/package_cloud.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "package_cloud/version"
2
2
  require "cgi"
3
+ require 'rainbow/ext/string'
3
4
 
4
5
  module PackageCloud
5
6
  autoload :Auth, "package_cloud/auth"
@@ -1,4 +1,3 @@
1
- require "colorize"
2
1
  require "thor"
3
2
  require "logger"
4
3
  require "benchmark"
@@ -21,7 +21,7 @@ module PackageCloud
21
21
 
22
22
  puts "\nIf you don't see your distribution or version here, email us at support@packagecloud.io."
23
23
  else
24
- puts "No distributions exist for #{package_type}.".red
24
+ puts "No distributions exist for #{package_type}.".color(:red)
25
25
  puts "That either means that we don't support #{package_type} or that it doesn't require a distribution/version."
26
26
  exit(1)
27
27
  end
@@ -32,7 +32,7 @@ module PackageCloud
32
32
 
33
33
  print "Attempting to yank package at #{repo_name}/#{dist}/#{package_name}..."
34
34
  packages = repo.yank(dist, package_name)
35
- puts "done!".green
35
+ puts "done!".color(:green)
36
36
  end
37
37
 
38
38
  desc "push user/repo[/distro/version] /path/to/packages",
@@ -48,7 +48,7 @@ module PackageCloud
48
48
  exts = package_files.map { |f| f.split(".").last }.uniq
49
49
 
50
50
  if package_files.length > 1 && exts.length > 1
51
- 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)
51
+ 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.".color(:red))
52
52
  end
53
53
 
54
54
  invalid_packages = package_files.select do |f|
@@ -56,11 +56,11 @@ module PackageCloud
56
56
  end
57
57
 
58
58
  if !options.has_key?("skip-file-ext-validation") && invalid_packages.any?
59
- message = "I don't know how to push these packages:\n\n".red
59
+ message = "I don't know how to push these packages:\n\n".color(:red)
60
60
  invalid_packages.each do |p|
61
61
  message << " #{p}\n"
62
62
  end
63
- message << "\npackage_cloud only supports debs, gems, jars, python packages, and rpms.".red
63
+ message << "\npackage_cloud only supports debs, gems, jars, python packages, and rpms.".color(:red)
64
64
  abort(message)
65
65
  end
66
66
 
@@ -70,7 +70,7 @@ module PackageCloud
70
70
  end
71
71
 
72
72
  if answer != "y"
73
- abort("Aborting...".red)
73
+ abort("Aborting...".color(:red))
74
74
  end
75
75
  end
76
76
 
@@ -135,7 +135,7 @@ module PackageCloud
135
135
  begin
136
136
  client_repo.create_package(f, dist_id, files, ext)
137
137
  rescue RestClient::UnprocessableEntity => e
138
- print "error (skipping):\n".yellow
138
+ print "error (skipping):\n".color(:yellow)
139
139
  json = JSON.parse(e.response)
140
140
  json.each do |k,v|
141
141
  puts "\n\t#{k}: #{v.join(", ")}\n"
@@ -148,7 +148,7 @@ module PackageCloud
148
148
  begin
149
149
  client_repo.create_package(f, dist_id, files, ext)
150
150
  rescue RestClient::UnprocessableEntity => e
151
- print "error:\n".red
151
+ print "error:\n".color(:red)
152
152
  json = JSON.parse(e.response)
153
153
  json.each do |k,v|
154
154
  if v.is_a? String
@@ -173,14 +173,14 @@ module PackageCloud
173
173
  files.each do |f|
174
174
  filepath = File.join(dir, f["filename"])
175
175
  if !File.exists?(filepath)
176
- print "Unable to find file name: #{f["filename"]} for source package: #{filepath}\n".red
177
- abort("Aborting...".red)
176
+ print "Unable to find file name: #{f["filename"]} for source package: #{filepath}\n".color(:red)
177
+ abort("Aborting...".color(:red))
178
178
  end
179
179
 
180
180
  disk_size = File.stat(filepath).size
181
181
  if disk_size != f["size"]
182
- print "File #{f["filename"]} has size: #{disk_size}, expected: #{f["size"]}\n".red
183
- abort("Aborting...".red)
182
+ print "File #{f["filename"]} has size: #{disk_size}, expected: #{f["size"]}\n".color(:red)
183
+ abort("Aborting...".color(:red))
184
184
  end
185
185
 
186
186
  print "Found DSC package file #{f["filename"]} for upload\n"
@@ -31,7 +31,7 @@ module PackageCloud
31
31
 
32
32
  print "Attempting to create token named #{token_name}... "
33
33
  resp = repo.create_master_token(token_name)
34
- print "success!\n".green
34
+ print "success!\n".color(:green)
35
35
  print "Master token #{resp['name']} with value #{resp['value']} created.\n"
36
36
  end
37
37
 
@@ -41,7 +41,7 @@ module PackageCloud
41
41
  ARGV.clear # otherwise gets explodes
42
42
 
43
43
  if token_name == "default"
44
- abort("You can't delete the default master_token.".red)
44
+ abort("You can't delete the default master_token.".color(:red))
45
45
  end
46
46
 
47
47
  print "Looking for repository at #{repo_name}... "
@@ -61,12 +61,12 @@ module PackageCloud
61
61
  if answer == "y"
62
62
  print "Attempting to destroy token named #{token_name}... "
63
63
  token.destroy
64
- print "success!\n".green
64
+ print "success!\n".color(:green)
65
65
  else
66
- puts "Aborting...".red
66
+ puts "Aborting...".color(:red)
67
67
  end
68
68
  else
69
- puts "Wasn't able to find a token named #{token_name}.".red
69
+ puts "Wasn't able to find a token named #{token_name}.".color(:red)
70
70
  exit(1)
71
71
  end
72
72
  end
@@ -10,21 +10,21 @@ module PackageCloud
10
10
  given_master_token, given_read_token = master_and_read_token.split("/")
11
11
 
12
12
  if given_master_token.nil? || given_read_token.nil?
13
- print "invalid master token and/or read token!\n".red
13
+ print "invalid master token and/or read token!\n".color(:red)
14
14
  exit(127)
15
15
  end
16
16
 
17
17
  master_token = repo.master_tokens.detect { |t| t.name == given_master_token }
18
18
 
19
19
  if master_token.nil?
20
- print "couldn't find master token named #{given_master_token}\n".red
20
+ print "couldn't find master token named #{given_master_token}\n".color(:red)
21
21
  exit(127)
22
22
  end
23
23
 
24
24
  read_token = master_token.read_tokens.detect { |t| t.name == given_read_token }
25
25
 
26
26
  if read_token.nil?
27
- print "couldn't find read token named #{given_read_token} for #{given_master_token}\n".red
27
+ print "couldn't find read token named #{given_read_token} for #{given_master_token}\n".color(:red)
28
28
  exit(127)
29
29
  end
30
30
 
@@ -36,4 +36,4 @@ module PackageCloud
36
36
  end
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -10,7 +10,7 @@ module PackageCloud
10
10
 
11
11
  print "Looking for repository at #{repo_name}... "
12
12
  repo = client.create_repo(repo_name, options[:private])
13
- print "success!\n".green
13
+ print "success!\n".color(:green)
14
14
  puts "Your repository has been created at:"
15
15
  puts " #{repo["url"]}"
16
16
  end
@@ -36,7 +36,7 @@ module PackageCloud
36
36
  "install user/repo for package_type"
37
37
  def install(repo, package_type)
38
38
  if Process.uid != 0 && package_type != "gem"
39
- abort("You have to run install as root.".red)
39
+ abort("You have to run install as root.".color(:red))
40
40
  end
41
41
 
42
42
  print "Locating repository at #{repo}... "
@@ -13,7 +13,7 @@ module PackageCloud
13
13
  attrs = JSON.parse(RestClient.get(url))
14
14
  attrs.map { |a| Repository.new(a, @config) }
15
15
  rescue RestClient::ResourceNotFound => e
16
- print "failed!\n".red
16
+ print "failed!\n".color(:red)
17
17
  exit(127)
18
18
  end
19
19
  end
@@ -24,13 +24,13 @@ module PackageCloud
24
24
  begin
25
25
  attrs = JSON.parse(RestClient.get(url))
26
26
  if attrs["error"] == "not_found"
27
- print "failed... Repository #{user}/#{repo} not found!\n".red
27
+ print "failed... Repository #{user}/#{repo} not found!\n".color(:red)
28
28
  exit(127)
29
29
  end
30
30
 
31
31
  Repository.new(attrs, @config)
32
32
  rescue RestClient::ResourceNotFound => e
33
- print "failed!\n".red
33
+ print "failed!\n".color(:red)
34
34
  exit(127)
35
35
  end
36
36
  end
@@ -40,7 +40,7 @@ module PackageCloud
40
40
  begin
41
41
  JSON.parse(RestClient.post(url, :repository => {:name => name, :private => priv == "private" ? "1" : "0"}))
42
42
  rescue RestClient::UnprocessableEntity => e
43
- print "error!\n".red
43
+ print "error!\n".color(:red)
44
44
  json = JSON.parse(e.response)
45
45
  json.each do |k,v|
46
46
  puts "\n\t#{k}: #{v.join(", ")}\n"
@@ -55,7 +55,7 @@ module PackageCloud
55
55
  begin
56
56
  JSON.parse(RestClient.get(url))
57
57
  rescue RestClient::ResourceNotFound => e
58
- print "failed!\n".red
58
+ print "failed!\n".color(:red)
59
59
  exit(127)
60
60
  end
61
61
  end
@@ -65,7 +65,7 @@ module PackageCloud
65
65
  begin
66
66
  JSON.parse(RestClient.get(url))
67
67
  rescue RestClient::ResourceNotFound => e
68
- print "failed!\n".red
68
+ print "failed!\n".color(:red)
69
69
  exit(127)
70
70
  end
71
71
  end
@@ -55,7 +55,7 @@ module PackageCloud
55
55
  message = "It appears your locale is set to #{default_encoding}, " +
56
56
  "please use UTF-8 instead. Run the 'locale' command to get" +
57
57
  "more info or e-mail support@packagecloud.io for help"
58
- abort(message.red)
58
+ abort(message.color(:red))
59
59
  end
60
60
  end
61
61
 
@@ -79,7 +79,7 @@ module PackageCloud
79
79
  def assert_reasonable_gem_version
80
80
  gem_version = Client.new(self).gem_version
81
81
  if gem_version["minor"] != MINOR_VERSION
82
- abort("This gem is out of date. Please update it!".red)
82
+ abort("This gem is out of date. Please update it!".color(:red))
83
83
  elsif gem_version["patch"] > PATCH_VERSION
84
84
  $stderr << "[WARNING] There's a newer version of the package_cloud gem. Install it when you get a chance!\n"
85
85
  end
@@ -19,7 +19,7 @@ module PackageCloud
19
19
  print "success!\n"
20
20
  resp["files"]
21
21
  rescue RestClient::UnprocessableEntity => e
22
- print "error:\n".red
22
+ print "error:\n".color(:red)
23
23
  json = JSON.parse(e.response)
24
24
  json.each do |k,v|
25
25
  puts "\n\t#{k}: #{v.join(", ")}\n"
@@ -47,7 +47,7 @@ module PackageCloud
47
47
  :url => url,
48
48
  :timeout => -1,
49
49
  :payload => { :package => params })
50
- print "success!\n".green
50
+ print "success!\n".color(:green)
51
51
  end
52
52
 
53
53
  def install_script(type)
@@ -68,7 +68,7 @@ module PackageCloud
68
68
  resp = RestClient.post(url, :master_token => {:name => name})
69
69
  resp = JSON.parse(resp)
70
70
  rescue RestClient::UnprocessableEntity => e
71
- print "error:\n".red
71
+ print "error:\n".color(:red)
72
72
  json = JSON.parse(e.response)
73
73
  json.each do |k,v|
74
74
  puts "\n\t#{k}: #{v.join(", ")}\n"
@@ -84,7 +84,7 @@ module PackageCloud
84
84
  url = PackageCloud::Util.compute_url(@config.base_url, paths["self"] + "/" + [dist, package_name].compact.join("/"))
85
85
  RestClient.delete(url)
86
86
  rescue RestClient::ResourceNotFound => e
87
- print "error:\n".red
87
+ print "error:\n".color(:red)
88
88
  json = JSON.parse(e.response)
89
89
  json.each do |k,v|
90
90
  puts "\n\t#{k}: #{v.join(", ")}\n"
@@ -95,7 +95,7 @@ module PackageCloud
95
95
  end
96
96
 
97
97
  def private_human
98
- send(:private) ? "private".red : "public".green
98
+ send(:private) ? "private".color(:red) : "public".color(:green)
99
99
  end
100
100
  end
101
101
  end
@@ -96,7 +96,7 @@ module PackageCloud
96
96
  answer = get_valid("(y/n)") { |sel| sel == "y" || sel == "n" }
97
97
 
98
98
  if answer == "y"
99
- print "\nContinuing...".green
99
+ print "\nContinuing...".color(:green)
100
100
  puts " Note that next time you can push directly to #{os_shortcut} by specifying #{shortcut} on the commandline."
101
101
  version["id"]
102
102
  else
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "2"
4
- PATCH_VERSION = "33"
4
+ PATCH_VERSION = "35"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "highline", "1.6.20"
23
23
  spec.add_runtime_dependency "rest-client", "~> 1.6.7"
24
24
  spec.add_runtime_dependency "json_pure", "1.8.1"
25
- spec.add_runtime_dependency "colorize", "0.6.0"
25
+ spec.add_runtime_dependency "rainbow", "2.1.0"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.3"
28
28
  spec.add_development_dependency "rake"
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.33
4
+ version: 0.2.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.8.1
69
69
  - !ruby/object:Gem::Dependency
70
- name: colorize
70
+ name: rainbow
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.6.0
75
+ version: 2.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.6.0
82
+ version: 2.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 2.4.8
163
+ rubygems_version: 2.4.4
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: https://packagecloud.io