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 +4 -4
- data/lib/package_cloud/config_file.rb +25 -3
- data/lib/package_cloud/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 717b1a77ab0eea52d0f4b2244c87135b55b66374
|
4
|
+
data.tar.gz: 3e2ecc77bbd4f5ff991e133d42c8d3df827f8ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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.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:
|
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.
|
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:
|