jeweler 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -53,6 +53,7 @@ It supports a number of options:
53
53
  * --shoulda: generate test_helper.rb and test ready for shoulda (this is the default)
54
54
  * --rspec: generate spec_helper.rb and spec ready for rspec
55
55
  * --bacon: generate spec_helper.rb and spec ready for bacon
56
+ * --gemcutter: setup releasing to gemcutter
56
57
  * --rubyforge: setup releasing to rubyforge
57
58
 
58
59
  ### Default options
@@ -98,6 +99,18 @@ It does the following for you:
98
99
  * Push to GitHub (which results in a gem being build)
99
100
  * Tag the version and push to GitHub
100
101
 
102
+ ## Releasing to Gemcutter
103
+
104
+ Jeweler can also handle releasing to [Gemcutter](http://gemcutter.org). There are a few steps you need to do before doing any Gemcutter releases with Jeweler:
105
+
106
+ * [Create an account on Gemcutter](http://gemcutter.org/sign_up)
107
+ * Install the Gemcutter gem: sudo gem install gemcutter
108
+ * Run 'gemcutter tumble' to set up gemcutter
109
+
110
+ With all that setup out of the way, you can now release to Gemcutter with impunity. This would release the current version of your gem.
111
+
112
+ $ rake gemcutter:release
113
+
101
114
  ## Releasing to RubyForge
102
115
 
103
116
  Jeweler can also handle releasing to [RubyForge](http://rubyforge.org). There are a few steps you need to do before doing any RubyForge releases with Jeweler:
data/Rakefile CHANGED
@@ -28,6 +28,8 @@ begin
28
28
  gem.add_development_dependency "redgreen"
29
29
  end
30
30
 
31
+ Jeweler::GemcutterTasks.new
32
+
31
33
  Jeweler::RubyforgeTasks.new do |t|
32
34
  t.doc_task = :yardoc
33
35
  end
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
3
- :major: 1
4
2
  :minor: 2
3
+ :patch: 1
4
+ :major: 1
data/jeweler.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jeweler}
8
- s.version = "1.2.0"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Nichols"]
12
- s.date = %q{2009-08-06}
12
+ s.date = %q{2009-08-18}
13
13
  s.default_executable = %q{jeweler}
14
14
  s.description = %q{Simple and opinionated helper for creating Rubygem projects on GitHub}
15
15
  s.email = %q{josh@technicalpickles.com}
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  "lib/jeweler/commands/check_dependencies.rb",
55
55
  "lib/jeweler/commands/install_gem.rb",
56
56
  "lib/jeweler/commands/release.rb",
57
+ "lib/jeweler/commands/release_to_gemcutter.rb",
57
58
  "lib/jeweler/commands/release_to_rubyforge.rb",
58
59
  "lib/jeweler/commands/setup_rubyforge.rb",
59
60
  "lib/jeweler/commands/validate_gemspec.rb",
@@ -64,6 +65,7 @@ Gem::Specification.new do |s|
64
65
  "lib/jeweler/commands/version/write.rb",
65
66
  "lib/jeweler/commands/write_gemspec.rb",
66
67
  "lib/jeweler/errors.rb",
68
+ "lib/jeweler/gemcutter_tasks.rb",
67
69
  "lib/jeweler/gemspec_helper.rb",
68
70
  "lib/jeweler/generator.rb",
69
71
  "lib/jeweler/generator/application.rb",
@@ -130,6 +132,7 @@ Gem::Specification.new do |s|
130
132
  "test/jeweler/commands/test_build_gem.rb",
131
133
  "test/jeweler/commands/test_install_gem.rb",
132
134
  "test/jeweler/commands/test_release.rb",
135
+ "test/jeweler/commands/test_release_to_gemcutter.rb",
133
136
  "test/jeweler/commands/test_release_to_rubyforge.rb",
134
137
  "test/jeweler/commands/test_setup_rubyforge.rb",
135
138
  "test/jeweler/commands/test_validate_gemspec.rb",
@@ -169,6 +172,7 @@ Gem::Specification.new do |s|
169
172
  "test/jeweler/commands/test_build_gem.rb",
170
173
  "test/jeweler/commands/test_install_gem.rb",
171
174
  "test/jeweler/commands/test_release.rb",
175
+ "test/jeweler/commands/test_release_to_gemcutter.rb",
172
176
  "test/jeweler/commands/test_release_to_rubyforge.rb",
173
177
  "test/jeweler/commands/test_setup_rubyforge.rb",
174
178
  "test/jeweler/commands/test_validate_gemspec.rb",
data/lib/jeweler.rb CHANGED
@@ -13,6 +13,7 @@ require 'jeweler/generator/application'
13
13
  require 'jeweler/commands'
14
14
 
15
15
  require 'jeweler/tasks'
16
+ require 'jeweler/gemcutter_tasks'
16
17
  require 'jeweler/rubyforge_tasks'
17
18
 
18
19
  require 'jeweler/specification'
@@ -120,7 +121,11 @@ class Jeweler
120
121
  def release
121
122
  Jeweler::Commands::Release.build_for(self).run
122
123
  end
123
-
124
+
125
+ def release_gem_to_gemcutter
126
+ Jeweler::Commands::ReleaseToGemcutter.build_for(self).run
127
+ end
128
+
124
129
  def release_gem_to_rubyforge
125
130
  Jeweler::Commands::ReleaseToRubyforge.build_for(self).run
126
131
  end
@@ -2,6 +2,7 @@ require 'jeweler/commands/build_gem'
2
2
  require 'jeweler/commands/install_gem'
3
3
  require 'jeweler/commands/check_dependencies'
4
4
  require 'jeweler/commands/release'
5
+ require 'jeweler/commands/release_to_gemcutter'
5
6
  require 'jeweler/commands/release_to_rubyforge'
6
7
  require 'jeweler/commands/setup_rubyforge'
7
8
  require 'jeweler/commands/validate_gemspec'
@@ -0,0 +1,27 @@
1
+ class Jeweler
2
+ module Commands
3
+ class ReleaseToGemcutter
4
+ attr_accessor :gemspec, :version, :output, :gemspec_helper
5
+
6
+ def initialize
7
+ self.output = $stdout
8
+ end
9
+
10
+ def run
11
+ command = "gem push #{@gemspec_helper.gem_path}"
12
+ output.puts "Executing #{command.inspect}:"
13
+ sh command
14
+ end
15
+
16
+ def self.build_for(jeweler)
17
+ command = new
18
+ command.gemspec = jeweler.gemspec
19
+ command.gemspec_helper = jeweler.gemspec_helper
20
+ command.version = jeweler.version
21
+ command.output = jeweler.output
22
+ command
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,35 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+ class Jeweler
5
+ # Rake tasks for putting a Jeweler gem on Gemcutter.
6
+ #
7
+ # Jeweler::Tasks.new needs to be used before this.
8
+ #
9
+ # Basic usage:
10
+ #
11
+ # Jeweler::Gemcutter.new
12
+ #
13
+ # Easy enough, right?
14
+ #
15
+ class GemcutterTasks < ::Rake::TaskLib
16
+ attr_accessor :jeweler
17
+
18
+ def initialize
19
+ yield self if block_given?
20
+
21
+ self.jeweler = Rake.application.jeweler
22
+
23
+ define
24
+ end
25
+
26
+ def define
27
+ namespace :gemcutter do
28
+ desc "Release gem to Gemcutter"
29
+ task :release => [:gemspec, :build] do
30
+ jeweler.release_gem_to_gemcutter
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -35,8 +35,8 @@ class Jeweler
35
35
  :description, :project_name, :github_username, :github_token,
36
36
  :repo, :should_create_repo,
37
37
  :testing_framework, :documentation_framework,
38
- :should_use_cucumber, :should_setup_rubyforge,
39
- :should_use_reek, :should_use_roodi,
38
+ :should_use_cucumber, :should_setup_gemcutter,
39
+ :should_setup_rubyforge, :should_use_reek, :should_use_roodi,
40
40
  :development_dependencies
41
41
 
42
42
  DEFAULT_TESTING_FRAMEWORK = :shoulda
@@ -78,6 +78,7 @@ class Jeweler
78
78
  self.should_use_cucumber = options[:use_cucumber]
79
79
  self.should_use_reek = options[:use_reek]
80
80
  self.should_use_roodi = options[:use_roodi]
81
+ self.should_setup_gemcutter = options[:gemcutter]
81
82
  self.should_setup_rubyforge = options[:rubyforge]
82
83
 
83
84
  development_dependencies << "cucumber" if should_use_cucumber
@@ -281,11 +282,11 @@ class Jeweler
281
282
  end
282
283
 
283
284
  def create_and_push_repo
284
- Net::HTTP.post_form URI.parse('http://github.com/repositories'),
285
+ Net::HTTP.post_form URI.parse('http://github.com/api/v2/yaml/repos/create'),
285
286
  'login' => github_username,
286
287
  'token' => github_token,
287
- 'repository[description]' => summary,
288
- 'repository[name]' => project_name
288
+ 'description' => summary,
289
+ 'name' => project_name
289
290
  # TODO do a HEAD request to see when it's ready
290
291
  @repo.push('origin')
291
292
  end
@@ -53,6 +53,10 @@ class Jeweler
53
53
  self[:create_repo] = true
54
54
  end
55
55
 
56
+ o.on('--gemcutter', 'setup project for gemcutter') do
57
+ self[:gemcutter] = true
58
+ end
59
+
56
60
  o.on('--rubyforge', 'setup project for rubyforge') do
57
61
  self[:rubyforge] = true
58
62
  end
@@ -18,6 +18,9 @@ begin
18
18
  <% end %>
19
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
20
  end
21
+ <% if should_setup_gemcutter %>
22
+ Jeweler::GemcutterTasks.new
23
+ <% end %>
21
24
  <% if should_setup_rubyforge %>
22
25
  Jeweler::RubyforgeTasks.new do |rubyforge|
23
26
  rubyforge.doc_task = "<%= doc_task %>"
@@ -0,0 +1,39 @@
1
+ require 'test_helper'
2
+
3
+ class Jeweler
4
+ module Commands
5
+ class TestReleaseToGemcutter < Test::Unit::TestCase
6
+ def self.subject
7
+ Jeweler::Commands::ReleaseToGemcutter.new
8
+ end
9
+
10
+ gemcutter_command_context "rubyforge_project is defined in gemspec and package exists on rubyforge" do
11
+ setup do
12
+ stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
13
+ stub(@command).sh
14
+ @command.run
15
+ end
16
+
17
+ should "push to gemcutter" do
18
+ push_command = "gem push #{@gemspec_helper.gem_path}"
19
+ assert_received(@command) { |command| command.sh(push_command) }
20
+ end
21
+ end
22
+
23
+ build_command_context "build for jeweler" do
24
+ setup do
25
+ @command = Jeweler::Commands::ReleaseToGemcutter.build_for(@jeweler)
26
+ end
27
+
28
+ should "assign gemspec helper" do
29
+ assert_equal @gemspec_helper, @command.gemspec_helper
30
+ end
31
+
32
+ should "assign output" do
33
+ assert_equal @output, @command.output
34
+ end
35
+ end
36
+
37
+ end
38
+ end
39
+ end
data/test/test_helper.rb CHANGED
@@ -70,6 +70,26 @@ class Test::Unit::TestCase
70
70
  end
71
71
  end
72
72
 
73
+ def self.gemcutter_command_context(description, &block)
74
+ context description do
75
+ setup do
76
+ @command = eval(self.class.name.gsub(/::Test/, '::')).new
77
+
78
+ if @command.respond_to? :gemspec_helper=
79
+ @gemspec_helper = Object.new
80
+ @command.gemspec_helper = @gemspec_helper
81
+ end
82
+
83
+ if @command.respond_to? :output
84
+ @output = StringIO.new
85
+ @command.output = @output
86
+ end
87
+ end
88
+
89
+ context "", &block
90
+ end
91
+ end
92
+
73
93
  def self.rubyforge_command_context(description, &block)
74
94
  context description do
75
95
  setup do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-06 00:00:00 -04:00
12
+ date: 2009-08-18 00:00:00 -04:00
13
13
  default_executable: jeweler
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -127,6 +127,7 @@ files:
127
127
  - lib/jeweler/commands/check_dependencies.rb
128
128
  - lib/jeweler/commands/install_gem.rb
129
129
  - lib/jeweler/commands/release.rb
130
+ - lib/jeweler/commands/release_to_gemcutter.rb
130
131
  - lib/jeweler/commands/release_to_rubyforge.rb
131
132
  - lib/jeweler/commands/setup_rubyforge.rb
132
133
  - lib/jeweler/commands/validate_gemspec.rb
@@ -137,6 +138,7 @@ files:
137
138
  - lib/jeweler/commands/version/write.rb
138
139
  - lib/jeweler/commands/write_gemspec.rb
139
140
  - lib/jeweler/errors.rb
141
+ - lib/jeweler/gemcutter_tasks.rb
140
142
  - lib/jeweler/gemspec_helper.rb
141
143
  - lib/jeweler/generator.rb
142
144
  - lib/jeweler/generator/application.rb
@@ -201,6 +203,7 @@ files:
201
203
  - test/jeweler/commands/test_build_gem.rb
202
204
  - test/jeweler/commands/test_install_gem.rb
203
205
  - test/jeweler/commands/test_release.rb
206
+ - test/jeweler/commands/test_release_to_gemcutter.rb
204
207
  - test/jeweler/commands/test_release_to_rubyforge.rb
205
208
  - test/jeweler/commands/test_setup_rubyforge.rb
206
209
  - test/jeweler/commands/test_validate_gemspec.rb
@@ -261,6 +264,7 @@ test_files:
261
264
  - test/jeweler/commands/test_build_gem.rb
262
265
  - test/jeweler/commands/test_install_gem.rb
263
266
  - test/jeweler/commands/test_release.rb
267
+ - test/jeweler/commands/test_release_to_gemcutter.rb
264
268
  - test/jeweler/commands/test_release_to_rubyforge.rb
265
269
  - test/jeweler/commands/test_setup_rubyforge.rb
266
270
  - test/jeweler/commands/test_validate_gemspec.rb