gemfury 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -76,7 +76,8 @@ module Gemfury
76
76
  :ssl => { :verify => false },
77
77
  :headers => {
78
78
  :accept => 'application/json',
79
- :user_agent => user_agent
79
+ :user_agent => user_agent,
80
+ :x_gem_version => Gemfury::VERSION
80
81
  }
81
82
  }.merge(options)
82
83
 
@@ -96,11 +97,20 @@ module Gemfury
96
97
 
97
98
  def ensure_successful_response!(response)
98
99
  unless response.success?
99
- raise(case response.status
100
- when 401 then Gemfury::Unauthorized
101
- when 404 then Gemfury::NotFound
102
- else Gemfury::Error
103
- end)
100
+ error = (response.body || {})['error'] || {}
101
+ error_class = case response.status
102
+ when 401 then Gemfury::Unauthorized
103
+ when 404 then Gemfury::NotFound
104
+ when 400
105
+ case error['type']
106
+ when 'GemVersionError' then Gemfury::InvalidGemVersion
107
+ else Gemfury::Error
108
+ end
109
+ else
110
+ Gemfury::Error
111
+ end
112
+
113
+ raise(error_class, error['message'])
104
114
  end
105
115
  end
106
116
  end
@@ -8,26 +8,11 @@ module Gemfury
8
8
  if args.include?(:authorization)
9
9
  raise Unauthorized unless authenticated?
10
10
  end
11
-
12
- # Check version requirement
13
- ensure_gem_compatibility! if self.check_gem_version
14
11
  end
15
12
 
16
13
  def authenticated?
17
14
  self.user_api_key && !self.user_api_key.empty?
18
15
  end
19
-
20
- def ensure_gem_compatibility!
21
- response = connection.get('status/version')
22
- ensure_successful_response!(response)
23
-
24
- current = Gem::Version.new(Gemfury::VERSION)
25
- version = Gem::Requirement.new(response.body['version'])
26
-
27
- unless version.satisfied_by?(current)
28
- raise InvalidGemVersion.new('Please update your gem')
29
- end
30
- end
31
16
  end
32
17
  end
33
18
  end
@@ -74,7 +74,7 @@ class Gemfury::Command::App < Thor
74
74
 
75
75
  private
76
76
  def client
77
- options = { :check_gem_version => true }
77
+ options = {}
78
78
  options[:user_api_key] = @user_api_key if @user_api_key
79
79
  Gemfury::Client.new(options)
80
80
  end
@@ -6,8 +6,7 @@ module Gemfury
6
6
  :user_api_key,
7
7
  :adapter,
8
8
  :endpoint,
9
- :user_agent,
10
- :check_gem_version].freeze
9
+ :user_agent].freeze
11
10
 
12
11
  # The adapter that will be used to connect if none is set
13
12
  DEFAULT_ADAPTER = :net_http
@@ -22,9 +21,6 @@ module Gemfury
22
21
  # Default user API key
23
22
  DEFAULT_API_KEY = nil
24
23
 
25
- # Default to skip the gem version check on API calls
26
- DEFAULT_VERSION_CHECK = false
27
-
28
24
  # @private
29
25
  attr_accessor *VALID_OPTIONS_KEYS
30
26
 
@@ -51,7 +47,6 @@ module Gemfury
51
47
  self.adapter = DEFAULT_ADAPTER
52
48
  self.endpoint = DEFAULT_ENDPOINT
53
49
  self.user_agent = DEFAULT_USER_AGENT
54
- self.check_gem_version = DEFAULT_VERSION_CHECK
55
50
  self
56
51
  end
57
52
  end
@@ -1,3 +1,3 @@
1
1
  module Gemfury
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-27 00:00:00.000000000Z
12
+ date: 2011-09-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
16
- requirement: &70230727723760 !ruby/object:Gem::Requirement
16
+ requirement: &70204899099800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70230727723760
24
+ version_requirements: *70204899099800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70230727723260 !ruby/object:Gem::Requirement
27
+ requirement: &70204899099160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.14.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70230727723260
35
+ version_requirements: *70204899099160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: launchy
38
- requirement: &70230727722760 !ruby/object:Gem::Requirement
38
+ requirement: &70204899098700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.4.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70230727722760
46
+ version_requirements: *70204899098700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
- requirement: &70230727722280 !ruby/object:Gem::Requirement
49
+ requirement: &70204899029120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70230727722280
57
+ version_requirements: *70204899029120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: faraday
60
- requirement: &70230727721720 !ruby/object:Gem::Requirement
60
+ requirement: &70204899028440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.7.4
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70230727721720
68
+ version_requirements: *70204899028440
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: faraday_middleware
71
- requirement: &70230727721160 !ruby/object:Gem::Requirement
71
+ requirement: &70204899027600 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.7.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70230727721160
79
+ version_requirements: *70204899027600
80
80
  description: ! 'Client library and command-line tool to manage your gems on http://gemfury.com
81
81
 
82
82
  '