gemfury 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,6 +50,14 @@ module Gemfury
50
50
  response.body
51
51
  end
52
52
 
53
+ # Delete a gem version
54
+ def yank_version(name, version, options = {})
55
+ ensure_ready!(:authorization)
56
+ response = connection.delete("gems/#{name}/versions/#{version}", options)
57
+ ensure_successful_response!(response)
58
+ response.body
59
+ end
60
+
53
61
  # Get Authentication token via email/password
54
62
  def get_access_token(email, password, options = {})
55
63
  ensure_ready!
@@ -90,6 +98,7 @@ module Gemfury
90
98
  unless response.success?
91
99
  raise(case response.status
92
100
  when 401 then Gemfury::Unauthorized
101
+ when 404 then Gemfury::NotFound
93
102
  else Gemfury::Error
94
103
  end)
95
104
  end
@@ -7,7 +7,7 @@ class Gemfury::Command::App < Thor
7
7
  shell.say Gemfury::VERSION
8
8
  end
9
9
 
10
- desc "push GEM" ,"Upload a new version of a gem"
10
+ desc "push GEM", "Upload a new version of a gem"
11
11
  def push(*gems)
12
12
  with_checks_and_rescues do
13
13
  gem_files = gems.map do |g|
@@ -28,7 +28,7 @@ class Gemfury::Command::App < Thor
28
28
  end
29
29
  end
30
30
 
31
- desc "list" ,"List your gems on Gemfury"
31
+ desc "list", "List your gems on Gemfury"
32
32
  def list
33
33
  with_checks_and_rescues do
34
34
  gems = client.list
@@ -41,7 +41,7 @@ class Gemfury::Command::App < Thor
41
41
  end
42
42
  end
43
43
 
44
- desc "versions GEM" ,"List all the available gem versions"
44
+ desc "versions GEM", "List all the available gem versions"
45
45
  def versions(gem_name)
46
46
  with_checks_and_rescues do
47
47
  versions = client.versions(gem_name)
@@ -52,6 +52,16 @@ class Gemfury::Command::App < Thor
52
52
  end
53
53
  end
54
54
 
55
+ desc "yank GEM", "Delete a gem version"
56
+ method_options %w(version -v) => :required
57
+ def yank(gem_name)
58
+ with_checks_and_rescues do
59
+ version = options[:version]
60
+ client.yank_version(gem_name, version)
61
+ shell.say "\n*** Yanked #{gem_name}-#{version} ***\n\n"
62
+ end
63
+ end
64
+
55
65
  private
56
66
  def client
57
67
  options = { :check_gem_version => true }
@@ -68,5 +78,9 @@ private
68
78
  else
69
79
  shell.say %q(No problem. You can also run "gem update gemfury")
70
80
  end
81
+ rescue Gemfury::NotFound => e
82
+ shell.say "Oops! Doesn't look like this exists", :red
83
+ rescue Exception => e
84
+ shell.say "Oops! Something went wrong. Looking into it ASAP!", :red
71
85
  end
72
86
  end
data/lib/gemfury/error.rb CHANGED
@@ -7,4 +7,7 @@ module Gemfury
7
7
 
8
8
  # Client#user_api_key is not defined or Gemfury returns 401
9
9
  class Unauthorized < Error; end
10
+
11
+ # Returned if something is not found
12
+ class NotFound < Error; end
10
13
  end
@@ -1,3 +1,3 @@
1
1
  module Gemfury
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
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.2.0
4
+ version: 0.3.0
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-14 00:00:00.000000000Z
12
+ date: 2011-09-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
16
- requirement: &70247840128140 !ruby/object:Gem::Requirement
16
+ requirement: &70113882589040 !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: *70247840128140
24
+ version_requirements: *70113882589040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70247840127440 !ruby/object:Gem::Requirement
27
+ requirement: &70113882587480 !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: *70247840127440
35
+ version_requirements: *70113882587480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: launchy
38
- requirement: &70247840126740 !ruby/object:Gem::Requirement
38
+ requirement: &70113882585340 !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: *70247840126740
46
+ version_requirements: *70113882585340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
- requirement: &70247840117380 !ruby/object:Gem::Requirement
49
+ requirement: &70113882580940 !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: *70247840117380
57
+ version_requirements: *70113882580940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: faraday
60
- requirement: &70247840116260 !ruby/object:Gem::Requirement
60
+ requirement: &70113882579240 !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: *70247840116260
68
+ version_requirements: *70113882579240
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: faraday_middleware
71
- requirement: &70247840113880 !ruby/object:Gem::Requirement
71
+ requirement: &70113882578300 !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: *70247840113880
79
+ version_requirements: *70113882578300
80
80
  description: ! 'Client library and command-line tool to manage your gems on http://gemfury.com
81
81
 
82
82
  '