gemcutter 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
7
+ gemspec
@@ -0,0 +1,99 @@
1
+ # gemcutter
2
+
3
+ This repository now contains only the `gemcutter` gem, which provides `gem
4
+ yank` and `gem webhook`. The Rails app has moved to
5
+ [rubygems/rubygems.org][rubygems]. Please update your links and remotes!
6
+
7
+ [rubygems]: https://github.com/rubygems/rubygems.org
8
+
9
+ ## <a name="installation"></a>Installation
10
+ gem install gemcutter
11
+
12
+ ## <a name="ci"></a>Build Status
13
+ [![Build Status](https://secure.travis-ci.org/rubygems/gemcutter.png)][ci]
14
+
15
+ [ci]: http://travis-ci.org/rubygems/gemcutter
16
+
17
+ ## <a name="dependencies"></a>Dependency Status
18
+ [![Dependency Status](https://gemnasium.com/rubygems/gemcutter.png)][gemnasium]
19
+
20
+ [gemnasium]: https://gemnasium.com/rubygems/gemcutter
21
+
22
+ ## <a name="contributing"></a>Contributing
23
+ In the spirit of [free software][free-sw], **everyone** is encouraged to help improve
24
+ this project.
25
+
26
+ [free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
27
+
28
+ Here are some ways *you* can contribute:
29
+
30
+ * by using alpha, beta, and prerelease versions
31
+ * by reporting bugs
32
+ * by suggesting new features
33
+ * by writing or editing documentation
34
+ * by writing specifications
35
+ * by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
36
+ * by refactoring code
37
+ * by closing [issues][]
38
+ * by reviewing patches
39
+
40
+ [issues]: https://github.com/rubygems/gemcutter/issues
41
+
42
+ ## <a name="issues"></a>Submitting an Issue
43
+ We use the [GitHub issue tracker][issues] to track bugs and features. Before
44
+ submitting a bug report or feature request, check to make sure it hasn't
45
+ already been submitted. You can indicate support for an existing issue by
46
+ voting it up. When submitting a bug report, please include a [gist][] that
47
+ includes a stack trace and any details that may be necessary to reproduce the
48
+ bug, including your gem version, Ruby version, and operating system. Ideally, a
49
+ bug report should include a pull request with failing specs.
50
+
51
+ [gist]: https://gist.github.com/
52
+
53
+ ## <a name="pulls"></a>Submitting a Pull Request
54
+ 1. Fork the project.
55
+ 2. Create a topic branch.
56
+ 3. Implement your feature or bug fix.
57
+ 4. Add tests for your feature or bug fix.
58
+ 5. Run `bundle exec rake test`. If your changes are not 100% covered, go back
59
+ to step 4.
60
+ 6. Commit and push your changes.
61
+ 7. Submit a pull request. Please do not include changes to the gemspec or
62
+ version. (If you want to create your own version for some reason, please do
63
+ so in a separate commit.)
64
+
65
+ ## <a name="versions"></a>Supported Ruby Versions
66
+ This library aims to support and is [tested against][ci] the following Ruby
67
+ implementations:
68
+
69
+ * Ruby 1.8.7
70
+ * Ruby 1.9.2
71
+ * Ruby 1.9.3
72
+ * [JRuby][]
73
+ * [Rubinius][]
74
+ * [Ruby Enterprise Edition][ree]
75
+
76
+ [jruby]: http://www.jruby.org/
77
+ [rubinius]: http://rubini.us/
78
+ [ree]: http://www.rubyenterpriseedition.com/
79
+
80
+ If something doesn't work on one of these interpreters, it should be considered
81
+ a bug.
82
+
83
+ This library may inadvertently work (or seem to work) on other Ruby
84
+ implementations, however support will only be provided for the versions listed
85
+ above.
86
+
87
+ If you would like this library to support another Ruby version, you may
88
+ volunteer to be a maintainer. Being a maintainer entails making sure all tests
89
+ run and pass on that implementation. When something breaks on your
90
+ implementation, you will be personally responsible for providing patches in a
91
+ timely fashion. If critical issues for a particular implementation exist at the
92
+ time of a major release, support for that Ruby version may be dropped.
93
+
94
+ ## <a name="license"></a>License
95
+
96
+ Gemcutter is released under the MIT license. Please check the [LICENSE][] file
97
+ for more details.
98
+
99
+ [license]: https://github.com/rubygems/gemcutter/blob/master/MIT-LICENSE
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
- require 'rake'
2
- require 'rake/testtask'
1
+ #!/usr/bin/env rake
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
3
5
 
4
- task :default => [:test]
6
+ task :default => :test
5
7
 
8
+ require 'rake/testtask'
6
9
  Rake::TestTask.new(:test) do |t|
7
10
  t.libs << "test"
8
11
  t.test_files = FileList['test/*_test.rb']
@@ -0,0 +1,3 @@
1
+ module Gemcutter
2
+ VERSION = '0.7.1'.freeze unless defined? ::Gemcutter::VERSION
3
+ end
@@ -16,9 +16,9 @@ class Gem::Commands::YankCommand < Gem::Command
16
16
  end
17
17
 
18
18
  def usage
19
- "#{program_name} GEM -v VERSION [-p PLATFORM] [--undo]"
19
+ "#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]"
20
20
  end
21
-
21
+
22
22
  def initialize
23
23
  super 'yank', description
24
24
  add_version_option("remove")
@@ -26,18 +26,25 @@ class Gem::Commands::YankCommand < Gem::Command
26
26
  add_option('--undo') do |value, options|
27
27
  options[:undo] = true
28
28
  end
29
+
30
+ add_option('-k', '--key KEY_NAME',
31
+ 'Use API key from your gem credentials file') do |value, options|
32
+ options[:key] = value
33
+ end
29
34
  end
30
35
 
31
36
  def execute
32
37
  sign_in
33
38
  version = get_version_from_requirements(options[:version])
34
39
  platform = get_platform_from_requirements(options)
35
-
40
+ api_key = Gem.configuration.rubygems_api_key
41
+ api_key = Gem.configuration.api_keys[options[:key].to_sym] if options[:key]
42
+
36
43
  if !version.nil?
37
44
  if options[:undo]
38
- unyank_gem(version, platform)
45
+ unyank_gem(version, platform, api_key)
39
46
  else
40
- yank_gem(version, platform)
47
+ yank_gem(version, platform, api_key)
41
48
  end
42
49
  else
43
50
  say "A version argument is required: #{usage}"
@@ -45,21 +52,21 @@ class Gem::Commands::YankCommand < Gem::Command
45
52
  end
46
53
  end
47
54
 
48
- def yank_gem(version, platform)
55
+ def yank_gem(version, platform, api_key)
49
56
  say "Yanking gem from RubyGems.org..."
50
- yank_api_request(:delete, version, platform, "api/v1/gems/yank")
57
+ yank_api_request(:delete, version, platform, "api/v1/gems/yank", api_key)
51
58
  end
52
-
53
- def unyank_gem(version, platform)
59
+
60
+ def unyank_gem(version, platform, api_key)
54
61
  say "Unyanking gem from RubyGems.org..."
55
- yank_api_request(:put, version, platform, "api/v1/gems/unyank")
62
+ yank_api_request(:put, version, platform, "api/v1/gems/unyank", api_key)
56
63
  end
57
-
64
+
58
65
  private
59
- def yank_api_request(method, version, platform, api)
66
+ def yank_api_request(method, version, platform, api, api_key)
60
67
  name = get_one_gem_name
61
68
  response = rubygems_api_request(method, api) do |request|
62
- request.add_field("Authorization", Gem.configuration.rubygems_api_key)
69
+ request.add_field("Authorization", api_key)
63
70
  request.set_form_data({'gem_name' => name, 'version' => version, 'platform' => platform})
64
71
  end
65
72
  say response.body
@@ -72,7 +79,7 @@ class Gem::Commands::YankCommand < Gem::Command
72
79
  nil
73
80
  end
74
81
  end
75
-
82
+
76
83
  def get_platform_from_requirements(requirements)
77
84
  Gem.platforms[1].to_s if requirements.key? :added_platform
78
85
  end
@@ -1,18 +1,15 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
1
3
  require 'rubygems'
2
- require 'rubygems/command'
4
+ require 'rubygems/commands/webhook_command'
5
+ require 'rubygems/commands/yank_command'
3
6
  require 'test/unit'
4
-
5
7
  require 'shoulda'
6
8
  require 'active_support'
7
9
  require 'active_support/test_case'
8
10
  require 'webmock'
9
11
  require 'rr'
10
12
 
11
- begin
12
- require 'redgreen'
13
- rescue LoadError
14
- end
15
-
16
13
  WebMock.disable_net_connect!
17
14
 
18
15
  class CommandTest < ActiveSupport::TestCase
@@ -27,6 +24,7 @@ end
27
24
  def stub_api_key(api_key)
28
25
  file = Gem::ConfigFile.new({})
29
26
  stub(file).rubygems_api_key { api_key }
27
+ yield file if block_given?
30
28
  stub(Gem).configuration { file }
31
29
  end
32
30
 
@@ -1,5 +1,4 @@
1
1
  require 'helper'
2
- require 'lib/rubygems/commands/webhook_command'
3
2
 
4
3
  class WebhookCommandTest < CommandTest
5
4
  context "webhooking" do
@@ -1,5 +1,4 @@
1
1
  require 'helper'
2
- require 'lib/rubygems/commands/yank_command'
3
2
 
4
3
  class YankCommandTest < CommandTest
5
4
  context "yanking" do
@@ -21,7 +20,8 @@ class YankCommandTest < CommandTest
21
20
 
22
21
  context 'yanking a gem' do
23
22
  setup do
24
- stub_api_key("key")
23
+ @api_key = "key"
24
+ stub_api_key(@api_key)
25
25
  @api = "https://rubygems.org/api/v1/gems/yank"
26
26
  stub_request(:delete, @api).to_return(:body => "Successfully yanked")
27
27
  @command.handle_options([@gem, "-v", @version])
@@ -34,12 +34,12 @@ class YankCommandTest < CommandTest
34
34
  command.say("Successfully yanked")
35
35
  end
36
36
  end
37
-
37
+
38
38
  should 'invoke yank_gem' do
39
- stub(@command).yank_gem(@version, @platform)
39
+ stub(@command).yank_gem(@version, @platform, @api_key)
40
40
  @command.execute
41
41
  assert_received(@command) do |command|
42
- command.yank_gem(@version, @platform)
42
+ command.yank_gem(@version, @platform, @api_key)
43
43
  end
44
44
  end
45
45
 
@@ -50,7 +50,20 @@ class YankCommandTest < CommandTest
50
50
  assert_requested(:delete, @api,
51
51
  :headers => { 'Authorization' => 'key' })
52
52
  end
53
-
53
+
54
+ should 'use given API key' do
55
+ other_key = 'another_key'
56
+
57
+ stub_api_key('key') {|config| stub(config).api_keys {{:another_name => other_key}}}
58
+
59
+ @command.handle_options([@gem, "-v", @version, "-k", "another_name"])
60
+ @command.execute
61
+ assert_requested(:delete, @api,
62
+ :times => 1)
63
+ assert_requested(:delete, @api,
64
+ :headers => { 'Authorization' => other_key })
65
+ end
66
+
54
67
  context 'with a platform specified' do
55
68
  setup do
56
69
  stub_api_key("key")
@@ -59,7 +72,7 @@ class YankCommandTest < CommandTest
59
72
  stub_request(:delete, @api).to_return(:body => "Successfully yanked")
60
73
  @command.handle_options([@gem, "-v", @version, "-p", @platform])
61
74
  end
62
-
75
+
63
76
  should 'say gem was yanked' do
64
77
  @command.execute
65
78
  assert_received(@command) do |command|
@@ -67,26 +80,27 @@ class YankCommandTest < CommandTest
67
80
  command.say("Successfully yanked")
68
81
  end
69
82
  end
70
-
83
+
71
84
  should 'invoke yank_gem' do
72
- stub(@command).yank_gem(@version, @platform)
85
+ stub(@command).yank_gem(@version, @platform, @api_key)
73
86
  @command.execute
74
87
  assert_received(@command) do |command|
75
- command.yank_gem(@version, @platform)
88
+ command.yank_gem(@version, @platform, @api_key)
76
89
  end
77
90
  end
78
91
  end
79
-
92
+
80
93
  end
81
-
94
+
82
95
  context 'unyanking a gem' do
83
96
  setup do
84
- stub_api_key("key")
97
+ @api_key = "key"
98
+ stub_api_key(@api_key)
85
99
  @api = "https://rubygems.org/api/v1/gems/unyank"
86
100
  stub_request(:put, @api).to_return(:body => "Successfully unyanked")
87
101
  @command.handle_options([@gem, "-v", @version, "--undo"])
88
102
  end
89
-
103
+
90
104
  should 'say gem was unyanked' do
91
105
  @command.execute
92
106
  assert_received(@command) do |command|
@@ -96,30 +110,31 @@ class YankCommandTest < CommandTest
96
110
  end
97
111
 
98
112
  should 'invoke unyank_gem' do
99
- stub(@command).unyank_gem(@version, @platform)
113
+ stub(@command).unyank_gem(@version, @platform, @api_key)
100
114
  @command.execute
101
115
  assert_received(@command) do |command|
102
- command.unyank_gem(@version, @platform)
116
+ command.unyank_gem(@version, @platform, @api_key)
103
117
  end
104
118
  end
105
-
119
+
106
120
  should 'put to api' do
107
121
  @command.execute
108
122
  assert_requested(:put, @api, :times => 1)
109
123
  assert_requested(:put, @api, :headers => { 'Authorization' => 'key' })
110
124
  end
111
125
  end
112
-
113
-
126
+
127
+
114
128
  context 'with a platform specified' do
115
129
  setup do
116
- stub_api_key("key")
130
+ @api_key = 'key'
131
+ stub_api_key(@api_key)
117
132
  @api = "https://rubygems.org/api/v1/gems/unyank"
118
133
  @platform = "x86-darwin-10"
119
134
  stub_request(:put, @api).to_return(:body => "Successfully unyanked")
120
135
  @command.handle_options([@gem, "-v", @version, "-p", @platform, "--undo"])
121
136
  end
122
-
137
+
123
138
  should 'say gem was unyanked' do
124
139
  @command.execute
125
140
  assert_received(@command) do |command|
@@ -127,16 +142,16 @@ class YankCommandTest < CommandTest
127
142
  command.say("Successfully unyanked")
128
143
  end
129
144
  end
130
-
145
+
131
146
  should 'invoke unyank_gem' do
132
- stub(@command).unyank_gem(@version, @platform)
147
+ stub(@command).unyank_gem(@version, @platform, @api_key)
133
148
  @command.execute
134
149
  assert_received(@command) do |command|
135
- command.unyank_gem(@version, @platform)
150
+ command.unyank_gem(@version, @platform, @api_key)
136
151
  end
137
152
  end
138
153
  end
139
-
154
+
140
155
  end
141
156
 
142
157
  end
metadata CHANGED
@@ -1,104 +1,94 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gemcutter
3
- version: !ruby/object:Gem::Version
4
- hash: 3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 0
10
- version: 0.7.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Nick Quaranto
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-02-26 00:00:00 -08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: rake
12
+ date: 2011-12-02 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &70304807834260 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: *70304807834260
25
+ - !ruby/object:Gem::Dependency
26
+ name: i18n
27
+ requirement: &70304807833340 !ruby/object:Gem::Requirement
25
28
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
33
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: shoulda
37
34
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: *70304807833340
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &70304807832320 !ruby/object:Gem::Requirement
39
39
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
47
44
  type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: activesupport
51
45
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
46
+ version_requirements: *70304807832320
47
+ - !ruby/object:Gem::Dependency
48
+ name: rr
49
+ requirement: &70304807830600 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
61
55
  type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: webmock
65
56
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
57
+ version_requirements: *70304807830600
58
+ - !ruby/object:Gem::Dependency
59
+ name: shoulda
60
+ requirement: &70304807829460 !ruby/object:Gem::Requirement
67
61
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
75
66
  type: :development
76
- version_requirements: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: rr
79
67
  prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
68
+ version_requirements: *70304807829460
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: &70304807827760 !ruby/object:Gem::Requirement
81
72
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
89
77
  type: :development
90
- version_requirements: *id005
91
- description: Adds several commands to RubyGems for managing gems and more on RubyGems.org.
92
- email: nick@quaran.to
78
+ prerelease: false
79
+ version_requirements: *70304807827760
80
+ description: Provides the `gem yank` and `gem webhook` commands to RubyGems.
81
+ email:
82
+ - nick@quaran.to
93
83
  executables: []
94
-
95
84
  extensions: []
96
-
97
85
  extra_rdoc_files: []
98
-
99
- files:
86
+ files:
87
+ - Gemfile
100
88
  - MIT-LICENSE
89
+ - README.md
101
90
  - Rakefile
91
+ - lib/gemcutter/version.rb
102
92
  - lib/rubygems/commands/migrate_command.rb
103
93
  - lib/rubygems/commands/tumble_command.rb
104
94
  - lib/rubygems/commands/webhook_command.rb
@@ -107,51 +97,36 @@ files:
107
97
  - test/helper.rb
108
98
  - test/webhook_command_test.rb
109
99
  - test/yank_command_test.rb
110
- has_rdoc: true
111
100
  homepage: http://rubygems.org
112
101
  licenses: []
113
-
114
- post_install_message: |+
115
-
116
- ========================================================================
117
-
118
- Thanks for installing Gemcutter! You can now run:
119
-
120
- gem push merged into RubyGems 1.3.6
121
- gem owner merged into RubyGems 1.3.6
122
- gem webhook register urls to be pinged when gems are pushed
123
- gem yank remove a specific version of a gem from RubyGems.org
124
-
125
- ========================================================================
126
-
102
+ post_install_message: ! "********************************************************************************\n\n
103
+ \ Thanks for installing Gemcutter! You can now run:\n\n gem push merged
104
+ into RubyGems 1.3.6\n gem owner merged into RubyGems 1.3.6\n gem webhook
105
+ \ register urls to be pinged when gems are pushed\n gem yank remove a
106
+ specific version of a gem from RubyGemgem.org\n\n********************************************************************************\n"
127
107
  rdoc_options: []
128
-
129
- require_paths:
108
+ require_paths:
130
109
  - lib
131
- required_ruby_version: !ruby/object:Gem::Requirement
110
+ required_ruby_version: !ruby/object:Gem::Requirement
132
111
  none: false
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- hash: 3
137
- segments:
138
- - 0
139
- version: "0"
140
- required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
117
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- hash: 3
146
- segments:
147
- - 0
148
- version: "0"
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
149
122
  requirements: []
150
-
151
123
  rubyforge_project:
152
- rubygems_version: 1.5.2
124
+ rubygems_version: 1.8.10
153
125
  signing_key:
154
126
  specification_version: 3
155
- summary: Commands to interact with RubyGems.org
156
- test_files: []
157
-
127
+ summary: Provides additional commands to interact with RubyGems.org
128
+ test_files:
129
+ - test/helper.rb
130
+ - test/webhook_command_test.rb
131
+ - test/yank_command_test.rb
132
+ has_rdoc: