gemfury 0.4.20.beta3 → 0.4.20

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: 3abb2ed8257af5fc8e89726130003604cc57330b
4
- data.tar.gz: 6f8e7c740deb2457cb7ec9afa801599115511b79
3
+ metadata.gz: c694aba98d65385ee9ff199b2224633dbea7f805
4
+ data.tar.gz: 66378125693c7382a484fbe03ace6258ae6dcf1d
5
5
  SHA512:
6
- metadata.gz: 0c3b16e21dd5b5b14cb77e9a4385106b093685cf19a4453369d5f4f0355bacf2a1c663e9e90ac783f90e1f4dcd6f127d808edf035632ae9ce679a79403bcf5f0
7
- data.tar.gz: 23365a7eb73c33902e2371f75dd5154491580abc1d194f6c46c2bc2b13e4afff6fd9a5b5b9ff15326c5572f2cdb48eb4f79d2cafe127cded142a69f4eb5b6d6f
6
+ metadata.gz: de6a50353915de51c282f5109a2435b2b4c4fc09df9a5624813f5885743477f5fa70391ac456bc19deca1088e16f0fe7aeb34ada1d98a35ca9c5b09e248c4338
7
+ data.tar.gz: da3c807d72fde4f8020da870bc400c5d304d8d8d12fd94cc97bdc24db95816810f72432677611560e604481a28c774304100f48f4b4a50400472f6cfc305801f
@@ -1,8 +1,10 @@
1
+ gem "netrc", "~> 0.7.7"
1
2
  gem "multi_json", "~> 1.0"
2
3
  gem "faraday", ">= 0.7.4", "< 0.9.0.pre"
3
4
  gem "faraday_middleware", ">= 0.7", "< 0.10.0.pre"
4
5
 
5
6
  require 'cgi'
7
+ require 'netrc'
6
8
  require 'multi_json'
7
9
  require 'faraday_middleware'
8
10
  require 'faraday/request/multipart_with_file'
@@ -3,9 +3,12 @@ module Gemfury::Command::Authorization
3
3
 
4
4
  def wipe_credentials!
5
5
  FileUtils.rm(config_path, :force => true) # never raises exception
6
+ netrc_conf.delete(netrc_host)
7
+ netrc_conf.save
6
8
  end
7
9
 
8
10
  def has_credentials?
11
+ !!netrc_conf[netrc_host] ||
9
12
  read_config_file.key?(:gemfury_api_key)
10
13
  end
11
14
 
@@ -40,22 +43,32 @@ private
40
43
  # Request and save the API access token
41
44
  if !email.empty? && !passw.empty?
42
45
  @user_api_key = client.get_access_token(email, passw)
43
- write_credentials!
46
+ write_credentials!(email)
44
47
  end
45
48
  end
46
49
 
47
50
  def load_credentials!
51
+ # Get credentials from ~/.netrc
52
+ email, @user_api_key = netrc_conf[netrc_host]
53
+ # Legacy loading from ~/.gem/gemfury
48
54
  conf = read_config_file
49
55
  @user_api_key = conf[:gemfury_api_key] if conf[:gemfury_api_key]
50
56
  end
51
57
 
52
- def write_credentials!
53
- config = read_config_file.merge(:gemfury_api_key => @user_api_key)
54
- FileUtils.mkdir_p(File.dirname(config_path))
55
- File.open(config_path, 'w') { |f| f.write(YAML.dump(config)) }
58
+ def write_credentials!(email)
59
+ netrc_conf[netrc_host] = email, @user_api_key
60
+ netrc_conf.save
56
61
  end
57
62
 
58
63
  def read_config_file
59
64
  File.exist?(config_path) ? YAML.load_file(config_path) : {}
60
65
  end
66
+
67
+ def netrc_conf
68
+ @netrc ||= Netrc.read
69
+ end
70
+
71
+ def netrc_host
72
+ URI.parse(client.endpoint).host
73
+ end
61
74
  end
@@ -1,3 +1,3 @@
1
1
  module Gemfury
2
- VERSION = '0.4.20.beta3'
2
+ VERSION = '0.4.20'
3
3
  end
@@ -1,8 +1,2 @@
1
1
  require 'rubygems/command_manager'
2
2
  Gem::CommandManager.instance.register_command :fury
3
-
4
- # Step 1. Check whether ~/.gem/gemfury exists
5
-
6
- # Step 2. Check whether api_token is present
7
-
8
- # Step 3. Override Gem.sources to include source path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.20.beta3
4
+ version: 0.4.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2013-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - <
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: netrc
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.7.7
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: 0.7.7
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: multi_json
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -156,9 +170,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
170
  version: '0'
157
171
  required_rubygems_version: !ruby/object:Gem::Requirement
158
172
  requirements:
159
- - - '>'
173
+ - - '>='
160
174
  - !ruby/object:Gem::Version
161
- version: 1.3.1
175
+ version: '0'
162
176
  requirements: []
163
177
  rubyforge_project:
164
178
  rubygems_version: 2.0.14