package_cloud 0.2.14 → 0.2.18

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: 2655c95f8dc351944fba6b48e8f79ad2588e8f90
4
- data.tar.gz: f5ca6132273493347e386234aa519b2dcdcfe23d
3
+ metadata.gz: 717b1a77ab0eea52d0f4b2244c87135b55b66374
4
+ data.tar.gz: 3e2ecc77bbd4f5ff991e133d42c8d3df827f8ddd
5
5
  SHA512:
6
- metadata.gz: 0d3e9e5d9ba796750129655266f156bf8cab576707ec5b5fa7882f8e85aa9c4a772f8055518923d1318089f1e06c7ad2e008e5cbd511eb716d13c624c54ffc28
7
- data.tar.gz: ac033aa6f94c073c960683ed23b2ebb1101510397b19442142bc4ddf9f01d349edba822dfe863d0a856c7b89efed0d0dfd0a4668d20e03ebceda824b34117b7f
6
+ metadata.gz: 012867097d708d6008cef77d83a523d3908fd41b1e1336e60ad713b77338d78f508de71ad3b77a770dc5d89e96f91109854a31d4c3651f67122fc09c43033155
7
+ data.tar.gz: 1da97bacc9f97cad031c5f63a5c7db47a706683b5676b3c139d150dcfe1b06b339804c7128bf3ccb3a37a55b89f42f75ea419336fea0e019a0a103823ab27dbb
@@ -17,17 +17,22 @@ module PackageCloud
17
17
  if ENV["PACKAGECLOUD_TOKEN"]
18
18
  @token = ENV["PACKAGECLOUD_TOKEN"]
19
19
  @url = URI(ENV["PACKAGECLOUD_URL"]) if ENV["PACKAGECLOUD_URL"]
20
+ output_host_and_token
20
21
  assert_reasonable_gem_version
21
22
  elsif File.exist?(@filename)
22
23
  attrs = JSON.parse(File.read(@filename))
23
24
  @token = attrs["token"] if attrs.has_key?("token")
24
25
  @url = URI(attrs["url"]) if attrs.has_key?("url")
26
+ fix_config_file!
27
+ output_host_and_token
25
28
  assert_reasonable_gem_version
26
29
  else
27
30
  puts "No config file exists at #{@filename}. Login to create one."
28
31
 
29
32
  @token = login_from_console
33
+ print "Got your token. Writing a config file to #{@filename}... "
30
34
  write
35
+ puts "success!"
31
36
  end
32
37
  end
33
38
 
@@ -67,10 +72,8 @@ module PackageCloud
67
72
  end
68
73
 
69
74
  def write
70
- print "Got your token. Writing a config file to #{@filename}... "
71
- attrs = {url => url.to_s, :token => @token}
75
+ attrs = {:url => url.to_s, :token => @token}
72
76
  File.open(@filename, "w", 0600) { |f| f << JSON.dump(attrs); f << "\r\n" }
73
- puts "success!"
74
77
  end
75
78
 
76
79
  def assert_reasonable_gem_version
@@ -81,5 +84,24 @@ module PackageCloud
81
84
  $stderr << "[WARNING] There's a newer version of the package_cloud gem. Install it when you get a chance!\n"
82
85
  end
83
86
  end
87
+
88
+ def output_host_and_token
89
+ token = @token[-4..-1].rjust(10, '*')
90
+ puts "Using #{@url} with token:#{token}"
91
+ end
92
+
93
+ ## package_cloud versions prior to 0.2.17 have a bug in the
94
+ ## config where the url is used verbatim as the key, instead of "url",
95
+ ## this attempts to fix the config file
96
+ def fix_config_file!
97
+ if File.exists?(@filename) && File.writable?(@filename)
98
+ attrs = JSON.parse(File.read(@filename))
99
+ if !attrs.has_key?("url")
100
+ ## overwrite the config file if "url" key not found
101
+ write
102
+ end
103
+ end
104
+ end
105
+
84
106
  end
85
107
  end
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "2"
4
- PATCH_VERSION = "14"
4
+ PATCH_VERSION = "18"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
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.14
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -159,8 +159,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.4.1
162
+ rubygems_version: 2.2.0
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: https://packagecloud.io
166
166
  test_files: []
167
+ has_rdoc: