jeweler 1.8.2 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.semver +5 -0
  4. data/.travis.yml +5 -3
  5. data/ChangeLog.markdown +30 -0
  6. data/Gemfile +32 -25
  7. data/Gemfile.lock +117 -46
  8. data/README.markdown +36 -10
  9. data/README.org +374 -0
  10. data/Rakefile +23 -28
  11. data/bin/jeweler +1 -0
  12. data/features/generator/gemfile.feature +1 -0
  13. data/features/generator/test.feature +2 -2
  14. data/features/step_definitions/debug_steps.rb +0 -1
  15. data/features/step_definitions/filesystem_steps.rb +2 -3
  16. data/features/step_definitions/generator_steps.rb +44 -66
  17. data/features/step_definitions/task_steps.rb +1 -2
  18. data/features/support/env.rb +22 -9
  19. data/jeweler.gemspec +64 -45
  20. data/lib/jeweler/commands/build_gem.rb +6 -2
  21. data/lib/jeweler/commands/check_dependencies.rb +3 -3
  22. data/lib/jeweler/commands/install_gem.rb +1 -1
  23. data/lib/jeweler/commands/release_gemspec.rb +17 -14
  24. data/lib/jeweler/commands/release_to_git.rb +20 -11
  25. data/lib/jeweler/commands/validate_gemspec.rb +5 -7
  26. data/lib/jeweler/commands/version/base.rb +8 -13
  27. data/lib/jeweler/commands/version/bump_major.rb +1 -3
  28. data/lib/jeweler/commands/version/bump_minor.rb +1 -2
  29. data/lib/jeweler/commands/version/bump_patch.rb +1 -4
  30. data/lib/jeweler/commands/write_gemspec.rb +4 -3
  31. data/lib/jeweler/commands.rb +6 -6
  32. data/lib/jeweler/gemspec_helper.rb +15 -15
  33. data/lib/jeweler/generator/application.rb +5 -10
  34. data/lib/jeweler/generator/bacon_mixin.rb +2 -4
  35. data/lib/jeweler/generator/github_mixin.rb +1 -10
  36. data/lib/jeweler/generator/micronaut_mixin.rb +3 -3
  37. data/lib/jeweler/generator/minitest_mixin.rb +2 -3
  38. data/lib/jeweler/generator/options.rb +16 -25
  39. data/lib/jeweler/generator/rdoc_mixin.rb +1 -1
  40. data/lib/jeweler/generator/riot_mixin.rb +2 -3
  41. data/lib/jeweler/generator/rspec_mixin.rb +2 -3
  42. data/lib/jeweler/generator/shindo_mixin.rb +2 -3
  43. data/lib/jeweler/generator/shoulda_mixin.rb +2 -3
  44. data/lib/jeweler/generator/testspec_mixin.rb +2 -3
  45. data/lib/jeweler/generator/testunit_mixin.rb +1 -3
  46. data/lib/jeweler/generator/yard_mixin.rb +3 -4
  47. data/lib/jeweler/generator.rb +52 -45
  48. data/lib/jeweler/rubyforge_tasks.rb +13 -13
  49. data/lib/jeweler/rubygems_dot_org_tasks.rb +3 -3
  50. data/lib/jeweler/rubygems_tasks.rb +3 -3
  51. data/lib/jeweler/specification.rb +22 -11
  52. data/lib/jeweler/tasks.rb +68 -59
  53. data/lib/jeweler/templates/Gemfile +1 -1
  54. data/lib/jeweler/templates/bacon/flunking.rb +3 -3
  55. data/lib/jeweler/templates/bacon/helper.rb +1 -0
  56. data/lib/jeweler/templates/features/support/env.rb +1 -0
  57. data/lib/jeweler/templates/jeweler_tasks.erb +1 -1
  58. data/lib/jeweler/templates/micronaut/flunking.rb +3 -3
  59. data/lib/jeweler/templates/micronaut/helper.rb +1 -0
  60. data/lib/jeweler/templates/minitest/flunking.rb +1 -1
  61. data/lib/jeweler/templates/minitest/helper.rb +4 -3
  62. data/lib/jeweler/templates/other_tasks.erb +4 -20
  63. data/lib/jeweler/templates/riot/flunking.rb +1 -1
  64. data/lib/jeweler/templates/riot/helper.rb +1 -0
  65. data/lib/jeweler/templates/rspec/flunking.rb +3 -3
  66. data/lib/jeweler/templates/rspec/helper.rb +3 -1
  67. data/lib/jeweler/templates/shindo/flunking.rb +3 -3
  68. data/lib/jeweler/templates/shindo/helper.rb +1 -0
  69. data/lib/jeweler/templates/shoulda/helper.rb +1 -0
  70. data/lib/jeweler/templates/simplecov.erb +16 -0
  71. data/lib/jeweler/templates/testspec/flunking.rb +3 -3
  72. data/lib/jeweler/templates/testspec/helper.rb +1 -1
  73. data/lib/jeweler/templates/testunit/helper.rb +1 -0
  74. data/lib/jeweler/version.rb +3 -3
  75. data/lib/jeweler/version_helper.rb +18 -15
  76. data/lib/jeweler.rb +23 -23
  77. data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -1
  78. data/test/fixtures/existing-project-with-version-constant/Rakefile +18 -20
  79. data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +15 -17
  80. data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +2 -2
  81. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +17 -19
  82. data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +15 -17
  83. data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +2 -2
  84. data/test/fixtures/existing-project-with-version-yaml/Rakefile +17 -19
  85. data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +15 -17
  86. data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +2 -2
  87. data/test/jeweler/commands/test_build_gem.rb +33 -27
  88. data/test/jeweler/commands/test_install_gem.rb +7 -7
  89. data/test/jeweler/commands/test_release_to_gemcutter.rb +6 -7
  90. data/test/jeweler/commands/test_release_to_git.rb +95 -37
  91. data/test/jeweler/commands/test_release_to_github.rb +161 -97
  92. data/test/jeweler/commands/test_validate_gemspec.rb +4 -6
  93. data/test/jeweler/commands/test_write_gemspec.rb +21 -24
  94. data/test/jeweler/commands/version/test_base.rb +26 -6
  95. data/test/jeweler/commands/version/test_bump_major.rb +1 -5
  96. data/test/jeweler/commands/version/test_bump_minor.rb +1 -2
  97. data/test/jeweler/commands/version/test_bump_patch.rb +1 -3
  98. data/test/jeweler/commands/version/test_write.rb +1 -3
  99. data/test/jeweler/generator/test_application.rb +22 -26
  100. data/test/jeweler/generator/test_options.rb +26 -38
  101. data/test/jeweler/test_gemspec_helper.rb +7 -7
  102. data/test/jeweler/test_generator.rb +31 -33
  103. data/test/jeweler/test_generator_initialization.rb +40 -57
  104. data/test/jeweler/test_generator_mixins.rb +6 -7
  105. data/test/jeweler/test_specification.rb +44 -43
  106. data/test/jeweler/test_tasks.rb +2 -3
  107. data/test/jeweler/test_version_helper.rb +33 -35
  108. data/test/shoulda_macros/jeweler_macros.rb +5 -5
  109. data/test/test_helper.rb +25 -31
  110. data/test/test_jeweler.rb +28 -29
  111. metadata +206 -165
@@ -18,7 +18,6 @@ Given /^I do not want bundler$/ do
18
18
  @use_bundler = false
19
19
  end
20
20
 
21
-
22
21
  Given /^I want bundler$/ do
23
22
  @use_bundler = true
24
23
  end
@@ -40,14 +39,13 @@ And /^I want rubyforge setup$/ do
40
39
  end
41
40
 
42
41
  Given /^I want to use yard instead of rdoc$/ do
43
- @documentation_framework = "yard"
42
+ @documentation_framework = 'yard'
44
43
  end
45
44
 
46
45
  Given /^I want to use rdoc instead of yard$/ do
47
- @documentation_framework = "rdoc"
46
+ @documentation_framework = 'rdoc'
48
47
  end
49
48
 
50
-
51
49
  Given /^I intend to test with (\w+)$/ do |testing_framework|
52
50
  @testing_framework = testing_framework.to_sym
53
51
  end
@@ -56,15 +54,12 @@ Given /^I have configured git sanely$/ do
56
54
  @user_email = 'bar@example.com'
57
55
  @user_name = 'foo'
58
56
  @github_user = 'technicalpickles'
59
- @github_token = 'zomgtoken'
60
57
 
61
58
  require 'git'
62
- Git.stubs(:global_config).
63
- returns({
64
- 'user.name' => @user_name,
65
- 'user.email' => @user_email,
66
- 'github.user' => @github_user,
67
- 'github.token' => @github_token})
59
+ Git.stubs(:global_config)
60
+ .returns('user.name' => @user_name,
61
+ 'user.email' => @user_email,
62
+ 'github.user' => @github_user)
68
63
  end
69
64
 
70
65
  Given /^I set JEWELER_OPTS env variable to "(.*)"$/ do |val|
@@ -81,26 +76,21 @@ When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)' and desc
81
76
  @description = description
82
77
 
83
78
  testing_framework = testing_framework.squeeze.strip
84
- unless testing_framework.blank?
85
- @testing_framework = testing_framework.to_sym
86
- end
79
+ @testing_framework = testing_framework.to_sym unless testing_framework.blank?
87
80
 
88
-
89
- arguments = [ '--summary', @summary,
81
+ arguments = ['--summary', @summary,
90
82
  '--description', @description,
91
- @use_cucumber ? '--cucumber' : nil,
92
- @testing_framework ? "--#{@testing_framework}" : nil,
93
- @use_rubyforge ? '--rubyforge' : nil,
94
- @use_roodi ? '--roodi' : nil,
95
- @use_reek ? '--reek' : nil,
96
- case @use_bundler
97
- when true then '--bundler'
98
- when false then '--no-bundler'
99
- else nil
100
- end,
101
- @documentation_framework ? "--#{@documentation_framework}" : nil,
102
- "#{@working_dir}/#{@name}"].compact
103
-
83
+ @use_cucumber ? '--cucumber' : nil,
84
+ @testing_framework ? "--#{@testing_framework}" : nil,
85
+ @use_rubyforge ? '--rubyforge' : nil,
86
+ @use_roodi ? '--roodi' : nil,
87
+ @use_reek ? '--reek' : nil,
88
+ case @use_bundler
89
+ when true then '--bundler'
90
+ when false then '--no-bundler'
91
+ end,
92
+ @documentation_framework ? "--#{@documentation_framework}" : nil,
93
+ "#{@working_dir}/#{@name}"].compact
104
94
 
105
95
  @stdout = OutputCatcher.catch_out do
106
96
  Jeweler::Generator::Application.run! *arguments
@@ -112,28 +102,27 @@ end
112
102
  Then /^a directory named '(.*)' is created$/ do |directory|
113
103
  directory = File.join(@working_dir, directory)
114
104
 
115
- assert File.exists?(directory), "#{directory} did not exist"
105
+ assert File.exist?(directory), "#{directory} did not exist"
116
106
  assert File.directory?(directory), "#{directory} is not a directory"
117
107
  end
118
108
 
119
- Then "cucumber directories are created" do
109
+ Then 'cucumber directories are created' do
120
110
  step "a directory named 'the-perfect-gem/features' is created"
121
111
  step "a directory named 'the-perfect-gem/features/support' is created"
122
112
  step "a directory named 'the-perfect-gem/features/step_definitions' is created"
123
113
  end
124
114
 
125
-
126
115
  Then /^a file named '(.*)' is created$/ do |file|
127
116
  file = File.join(@working_dir, file)
128
117
 
129
- assert File.exists?(file), "#{file} expected to exist, but did not"
118
+ assert File.exist?(file), "#{file} expected to exist, but did not"
130
119
  assert File.file?(file), "#{file} expected to be a file, but is not"
131
120
  end
132
121
 
133
122
  Then /^a file named '(.*)' is not created$/ do |file|
134
123
  file = File.join(@working_dir, file)
135
124
 
136
- assert ! File.exists?(file), "#{file} expected to not exist, but did"
125
+ assert !File.exist?(file), "#{file} expected to not exist, but did"
137
126
  end
138
127
 
139
128
  Then /^a sane '.gitignore' is created$/ do
@@ -155,21 +144,21 @@ end
155
144
  Then /^Rakefile has '(.*)' for the (.*) (.*)$/ do |value, task_class, field|
156
145
  @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
157
146
  block_variable, task_block = yank_task_info(@rakefile_content, task_class)
158
- #raise "Found in #{task_class}: #{block_variable.inspect}: #{task_block.inspect}"
147
+ # raise "Found in #{task_class}: #{block_variable.inspect}: #{task_block.inspect}"
159
148
 
160
149
  assert_match /#{block_variable}\.#{field} = (%Q\{|"|')#{Regexp.escape(value)}(\}|"|')/, task_block
161
150
  end
162
151
 
163
152
  Then /^Rakefile adds '(.*)' as a development dependency to Jeweler::Tasks$/ do |dependency|
164
153
  @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
165
- block_variable, task_block = yank_task_info(@rakefile_content, "Jeweler::Tasks")
154
+ block_variable, task_block = yank_task_info(@rakefile_content, 'Jeweler::Tasks')
166
155
 
167
156
  assert_match /#{block_variable}\.add_development_dependency "#{dependency}"/, task_block
168
157
  end
169
158
 
170
159
  Then /^Rakefile does not add '(.*)' as a development dependency to Jeweler::Tasks$/ do |dependency|
171
160
  @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile'))
172
- block_variable, task_block = yank_task_info(@rakefile_content, "Jeweler::Tasks")
161
+ block_variable, task_block = yank_task_info(@rakefile_content, 'Jeweler::Tasks')
173
162
 
174
163
  assert_no_match /#{block_variable}\.add_development_dependency "#{dependency}"/, task_block
175
164
  end
@@ -188,7 +177,6 @@ Then /^Rakefile has '(.*)' in the Rcov::RcovTask rcov_opts$/ do |rcov_opts|
188
177
  assert_match "#{block_variable}.rcov_opts << '#{rcov_opts}'", @rakefile_content
189
178
  end
190
179
 
191
-
192
180
  Then /^'(.*)' contains '(.*)'$/ do |file, expected_string|
193
181
  contents = File.read(File.join(@working_dir, @name, file))
194
182
  assert_match expected_string, contents
@@ -204,7 +192,6 @@ Then /^'(.*)' mentions copyright belonging to me in the current year$/ do |file|
204
192
  step "'#{file}' mentions copyright belonging to me in #{current_year}"
205
193
  end
206
194
 
207
-
208
195
  Then /^LICENSE\.txt credits '(.*)'$/ do |copyright_holder|
209
196
  step "a file named 'the-perfect-gem/LICENSE.txt' is created"
210
197
  @license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE.txt'))
@@ -216,36 +203,34 @@ Given /^it is the year (\d+)$/ do |year|
216
203
  Timecop.travel(time)
217
204
  end
218
205
 
219
-
220
206
  Then /^LICENSE\.txt has a copyright in the year (\d+)$/ do |year|
221
207
  step "a file named 'the-perfect-gem/LICENSE.txt' is created"
222
208
  @license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE.txt'))
223
209
  assert_match year, @license_content
224
210
  end
225
211
 
226
-
227
212
  Then /^'(.*)' should define '(.*)' as a subclass of '(.*)'$/ do |file, class_name, superclass_name|
228
- @test_content = File.read((File.join(@working_dir, @name, file)))
213
+ @test_content = File.read(File.join(@working_dir, @name, file))
229
214
 
230
215
  assert_match "class #{class_name} < #{superclass_name}", @test_content
231
216
  end
232
217
 
233
218
  Then /^'(.*)' should describe '(.*)'$/ do |file, describe_name|
234
- @spec_content ||= File.read((File.join(@working_dir, @name, file)))
219
+ @spec_content ||= File.read(File.join(@working_dir, @name, file))
235
220
 
236
- assert_match %Q{describe "#{describe_name}" do}, @spec_content
221
+ assert_match %(describe "#{describe_name}" do), @spec_content
237
222
  end
238
223
 
239
224
  Then /^'(.*)' should contextualize '(.*)'$/ do |file, describe_name|
240
- @spec_content ||= File.read((File.join(@working_dir, @name, file)))
225
+ @spec_content ||= File.read(File.join(@working_dir, @name, file))
241
226
 
242
- assert_match %Q{context "#{describe_name}" do}, @spec_content
227
+ assert_match %(context "#{describe_name}" do), @spec_content
243
228
  end
244
229
 
245
230
  Then /^'(.*)' should have tests for '(.*)'$/ do |file, describe_name|
246
- @tests_content ||= File.read((File.join(@working_dir, @name, file)))
231
+ @tests_content ||= File.read(File.join(@working_dir, @name, file))
247
232
 
248
- assert_match %Q{Shindo.tests("#{describe_name}") do}, @tests_content
233
+ assert_match %{Shindo.tests("#{describe_name}") do}, @tests_content
249
234
  end
250
235
 
251
236
  Then /^'(.*)' requires '(.*)'$/ do |file, lib|
@@ -278,11 +263,10 @@ Then /^Rakefile instantiates a (.*)$/ do |task_name|
278
263
  assert_match /#{task_name}/, content
279
264
  end
280
265
 
281
-
282
266
  Then /^'(.+?)' should autorun tests$/ do |test_helper|
283
267
  content = File.read(File.join(@working_dir, @name, test_helper))
284
268
 
285
- assert_match "MiniTest::Unit.autorun", content
269
+ assert_match "require 'minitest/autorun'", content
286
270
  end
287
271
 
288
272
  Then /^cucumber world extends "(.*)"$/ do |module_to_extend|
@@ -290,15 +274,13 @@ Then /^cucumber world extends "(.*)"$/ do |module_to_extend|
290
274
  assert_match "World(#{module_to_extend})", content
291
275
  end
292
276
 
293
-
294
277
  Then /^'features\/support\/env\.rb' sets up features to use test\/unit assertions$/ do
295
-
296
278
  end
297
279
 
298
280
  Then /^'features\/support\/env\.rb' sets up features to use minitest assertions$/ do
299
281
  content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb'))
300
282
 
301
- assert_match "world.extend(Mini::Test::Assertions)", content
283
+ assert_match 'world.extend(Mini::Test::Assertions)', content
302
284
  end
303
285
 
304
286
  Then /^git repository has '(.*)' remote$/ do |remote|
@@ -307,7 +289,7 @@ Then /^git repository has '(.*)' remote$/ do |remote|
307
289
  assert_equal 'origin', remote.name
308
290
  end
309
291
 
310
- Then /^git repository '(.*)' remote should be '(.*)'/ do |remote, remote_url|
292
+ Then /^git repository '(.*)' remote should be '(.*)'/ do |remote, _remote_url|
311
293
  remote = @repo.remotes.first
312
294
 
313
295
  assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
@@ -321,7 +303,7 @@ Then /^'(.*)' was checked in$/ do |file|
321
303
  status = @repo.status[file]
322
304
 
323
305
  assert_not_nil status, "wasn't able to get status for #{file}"
324
- assert ! status.untracked, "#{file} was untracked"
306
+ assert !status.untracked, "#{file} was untracked"
325
307
  assert_nil status.type, "#{file} had a type. it should have been nil"
326
308
  end
327
309
 
@@ -334,7 +316,6 @@ Then /^Rakefile has "(.*)" as the default task$/ do |task|
334
316
  assert_match "task :default => :#{task}", @rakefile_content
335
317
  end
336
318
 
337
-
338
319
  After do
339
320
  ENV['JEWELER_OPTS'] = nil
340
321
  end
@@ -358,15 +339,14 @@ end
358
339
  Then /^'Gemfile' has a development dependency on the current version of jeweler$/ do
359
340
  @gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile'))
360
341
  group_block = yank_group_info(@gemfile_content, 'development')
361
-
362
- assert_match %Q{gem "jeweler", "~> #{Jeweler::Version::STRING}"}, group_block
363
- end
364
342
 
343
+ assert_match %(gem "jeweler", "~> #{Jeweler::Version::STRING}"), group_block
344
+ end
365
345
 
366
346
  Then /^'(.*)' sets up bundler using the default and development groups$/ do |file|
367
347
  content = File.read(File.join(@working_dir, @name, file))
368
348
 
369
- assert_match "Bundler.setup(:default, :development)", content
349
+ assert_match 'Bundler.setup(:default, :development)', content
370
350
  end
371
351
 
372
352
  Then /^'(.*)' does not setup bundler$/ do |file|
@@ -375,15 +355,13 @@ Then /^'(.*)' does not setup bundler$/ do |file|
375
355
  assert_no_match /Bundler\.setup/, content
376
356
  end
377
357
 
378
- Then /^'Gemfile' uses the (.*) source$/ do |source|
358
+ Then /^'Gemfile' uses the (.*) source$/ do |_source|
379
359
  content = File.read(File.join(@working_dir, @name, 'Gemfile'))
380
360
 
381
- assert_match %Q{source "http://rubygems.org"}, content
361
+ assert_match %(source "https://rubygems.org"), content
382
362
  end
383
363
 
384
-
385
- Then /^Rakefile has a magic comment for UTF\-(\d+)$/ do |arg1|
364
+ Then /^Rakefile has a magic comment for UTF\-(\d+)$/ do |_arg1|
386
365
  content = File.read(File.join(@working_dir, @name, 'Rakefile'))
387
- assert_match "# encoding: utf-8", content
366
+ assert_match '# encoding: utf-8', content
388
367
  end
389
-
@@ -1,6 +1,5 @@
1
1
  Then /^I can gem install "([^"]+)"$/ do |gem_path|
2
2
  @stdout = `cd #{@working_dir}; gem install --install-dir #{@working_dir}/gem-install-dir --no-ri --no-rdoc #{gem_path} 2>&1`
3
3
  assert_no_match /ERROR/, @stdout
4
- assert $?.exited?
4
+ assert $CHILD_STATUS.exited?
5
5
  end
6
-
@@ -1,25 +1,40 @@
1
+ ENV.delete_if { |name, _| name.start_with?('GIT') }
1
2
  require 'bundler'
2
3
  begin
3
- Bundler.setup(:default, :test)
4
+ Bundler.setup(:default, :xzibit, :test)
4
5
  rescue Bundler::BundlerError => e
5
6
  $stderr.puts e.message
6
- $stderr.puts "Run `bundle install` to install missing gems"
7
+ $stderr.puts 'Run `bundle install` to install missing gems'
7
8
  exit e.status_code
8
9
  end
9
10
 
10
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
11
  require 'jeweler'
12
12
  require 'mocha'
13
+ require 'mocha/api'
14
+ World(Mocha::API)
15
+
16
+ Before do
17
+ mocha_setup
18
+ end
19
+
20
+ After do
21
+ begin
22
+ mocha_verify
23
+ ensure
24
+ mocha_teardown
25
+ end
26
+ end
27
+
13
28
  require 'output_catcher'
14
29
  require 'timecop'
15
- require 'ruby-debug'
16
30
  require 'active_support'
31
+ require 'active_support/core_ext/object/blank'
17
32
 
18
33
  require 'test/unit/assertions'
19
34
  World(Test::Unit::Assertions)
20
35
 
21
- require 'construct'
22
- World(Construct::Helpers)
36
+ require 'test_construct'
37
+ World(TestConstruct::Helpers)
23
38
 
24
39
  def yank_task_info(content, task)
25
40
  if content =~ /#{Regexp.escape(task)}.new(\(.*\))? do \|(.*?)\|(.*?)^end$/m
@@ -28,9 +43,7 @@ def yank_task_info(content, task)
28
43
  end
29
44
 
30
45
  def yank_group_info(content, group)
31
- if content =~ /group :#{group} do(.*?)end/m
32
- $1
33
- end
46
+ $1 if content =~ /group :#{group} do(.*?)end/m
34
47
  end
35
48
 
36
49
  def fixture_dir
data/jeweler.gemspec CHANGED
@@ -2,24 +2,29 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: jeweler 2.3.7 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
- s.name = "jeweler"
8
- s.version = "1.8.2"
8
+ s.name = "jeweler".freeze
9
+ s.version = "2.3.7"
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Josh Nichols"]
12
- s.date = "2012-01-25"
13
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
14
- s.email = "josh@technicalpickles.com"
15
- s.executables = ["jeweler"]
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Fred Mitchell".freeze, "Josh Nichols".freeze, "Yusuke Murata".freeze]
14
+ s.date = "2017-06-24"
15
+ s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub".freeze
16
+ s.email = ["fred.mitchell@gmx.de".freeze, "fred.mitchell@gmx.com".freeze, "info@muratayusuke.com".freeze]
17
+ s.executables = ["jeweler".freeze]
16
18
  s.extra_rdoc_files = [
17
19
  "ChangeLog.markdown",
18
20
  "LICENSE.txt",
19
- "README.markdown"
21
+ "README.markdown",
22
+ "README.org"
20
23
  ]
21
24
  s.files = [
25
+ ".coveralls.yml",
22
26
  ".document",
27
+ ".semver",
23
28
  ".travis.yml",
24
29
  ".yardopts",
25
30
  "ChangeLog.markdown",
@@ -27,6 +32,7 @@ Gem::Specification.new do |s|
27
32
  "Gemfile.lock",
28
33
  "LICENSE.txt",
29
34
  "README.markdown",
35
+ "README.org",
30
36
  "Rakefile",
31
37
  "bin/jeweler",
32
38
  "features/generator/cucumber.feature",
@@ -114,6 +120,7 @@ Gem::Specification.new do |s|
114
120
  "lib/jeweler/templates/shindo/helper.rb",
115
121
  "lib/jeweler/templates/shoulda/flunking.rb",
116
122
  "lib/jeweler/templates/shoulda/helper.rb",
123
+ "lib/jeweler/templates/simplecov.erb",
117
124
  "lib/jeweler/templates/testspec/flunking.rb",
118
125
  "lib/jeweler/templates/testspec/helper.rb",
119
126
  "lib/jeweler/templates/testunit/flunking.rb",
@@ -180,49 +187,61 @@ Gem::Specification.new do |s|
180
187
  "test/test_helper.rb",
181
188
  "test/test_jeweler.rb"
182
189
  ]
183
- s.homepage = "http://github.com/technicalpickles/jeweler"
184
- s.licenses = ["MIT"]
185
- s.require_paths = ["lib"]
186
- s.rubygems_version = "1.8.10"
187
- s.summary = "Opinionated tool for creating and managing RubyGem projects"
190
+ s.homepage = "http://github.com/technicalpickles/jeweler".freeze
191
+ s.licenses = ["MIT".freeze]
192
+ s.required_ruby_version = Gem::Requirement.new(">= 2.2.0".freeze)
193
+ s.rubygems_version = "2.6.11".freeze
194
+ s.summary = "Opinionated tool for creating and managing RubyGem projects".freeze
188
195
 
189
196
  if s.respond_to? :specification_version then
190
- s.specification_version = 3
197
+ s.specification_version = 4
191
198
 
192
199
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
193
- s.add_runtime_dependency(%q<jeweler>, [">= 0"])
194
- s.add_runtime_dependency(%q<rake>, [">= 0"])
195
- s.add_runtime_dependency(%q<git>, [">= 1.2.5"])
196
- s.add_runtime_dependency(%q<bundler>, ["~> 1.0"])
197
- s.add_runtime_dependency(%q<rdoc>, [">= 0"])
198
- s.add_development_dependency(%q<yard>, ["~> 0.7.4"])
199
- s.add_development_dependency(%q<rdoc>, [">= 0"])
200
- s.add_development_dependency(%q<bluecloth>, [">= 0"])
201
- s.add_development_dependency(%q<cucumber>, ["~> 1.1.4"])
202
- s.add_development_dependency(%q<rcov>, [">= 0"])
200
+ s.add_runtime_dependency(%q<rake>.freeze, [">= 0"])
201
+ s.add_runtime_dependency(%q<git>.freeze, [">= 1.2.5"])
202
+ s.add_runtime_dependency(%q<nokogiri>.freeze, [">= 1.5.10"])
203
+ s.add_runtime_dependency(%q<github_api>.freeze, ["~> 0.16.0"])
204
+ s.add_runtime_dependency(%q<highline>.freeze, [">= 1.6.15"])
205
+ s.add_runtime_dependency(%q<bundler>.freeze, [">= 1"])
206
+ s.add_runtime_dependency(%q<rdoc>.freeze, [">= 0"])
207
+ s.add_runtime_dependency(%q<builder>.freeze, [">= 0"])
208
+ s.add_runtime_dependency(%q<semver2>.freeze, [">= 0"])
209
+ s.add_runtime_dependency(%q<psych>.freeze, ["~> 2.2"])
210
+ s.add_development_dependency(%q<yard>.freeze, [">= 0.8.5"])
211
+ s.add_development_dependency(%q<bluecloth>.freeze, [">= 0"])
212
+ s.add_development_dependency(%q<cucumber>.freeze, [">= 1.1.4"])
213
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
203
214
  else
204
- s.add_dependency(%q<jeweler>, [">= 0"])
205
- s.add_dependency(%q<rake>, [">= 0"])
206
- s.add_dependency(%q<git>, [">= 1.2.5"])
207
- s.add_dependency(%q<bundler>, ["~> 1.0"])
208
- s.add_dependency(%q<rdoc>, [">= 0"])
209
- s.add_dependency(%q<yard>, ["~> 0.7.4"])
210
- s.add_dependency(%q<rdoc>, [">= 0"])
211
- s.add_dependency(%q<bluecloth>, [">= 0"])
212
- s.add_dependency(%q<cucumber>, ["~> 1.1.4"])
213
- s.add_dependency(%q<rcov>, [">= 0"])
215
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
216
+ s.add_dependency(%q<git>.freeze, [">= 1.2.5"])
217
+ s.add_dependency(%q<nokogiri>.freeze, [">= 1.5.10"])
218
+ s.add_dependency(%q<github_api>.freeze, ["~> 0.16.0"])
219
+ s.add_dependency(%q<highline>.freeze, [">= 1.6.15"])
220
+ s.add_dependency(%q<bundler>.freeze, [">= 1"])
221
+ s.add_dependency(%q<rdoc>.freeze, [">= 0"])
222
+ s.add_dependency(%q<builder>.freeze, [">= 0"])
223
+ s.add_dependency(%q<semver2>.freeze, [">= 0"])
224
+ s.add_dependency(%q<psych>.freeze, ["~> 2.2"])
225
+ s.add_dependency(%q<yard>.freeze, [">= 0.8.5"])
226
+ s.add_dependency(%q<bluecloth>.freeze, [">= 0"])
227
+ s.add_dependency(%q<cucumber>.freeze, [">= 1.1.4"])
228
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
214
229
  end
215
230
  else
216
- s.add_dependency(%q<jeweler>, [">= 0"])
217
- s.add_dependency(%q<rake>, [">= 0"])
218
- s.add_dependency(%q<git>, [">= 1.2.5"])
219
- s.add_dependency(%q<bundler>, ["~> 1.0"])
220
- s.add_dependency(%q<rdoc>, [">= 0"])
221
- s.add_dependency(%q<yard>, ["~> 0.7.4"])
222
- s.add_dependency(%q<rdoc>, [">= 0"])
223
- s.add_dependency(%q<bluecloth>, [">= 0"])
224
- s.add_dependency(%q<cucumber>, ["~> 1.1.4"])
225
- s.add_dependency(%q<rcov>, [">= 0"])
231
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
232
+ s.add_dependency(%q<git>.freeze, [">= 1.2.5"])
233
+ s.add_dependency(%q<nokogiri>.freeze, [">= 1.5.10"])
234
+ s.add_dependency(%q<github_api>.freeze, ["~> 0.16.0"])
235
+ s.add_dependency(%q<highline>.freeze, [">= 1.6.15"])
236
+ s.add_dependency(%q<bundler>.freeze, [">= 1"])
237
+ s.add_dependency(%q<rdoc>.freeze, [">= 0"])
238
+ s.add_dependency(%q<builder>.freeze, [">= 0"])
239
+ s.add_dependency(%q<semver2>.freeze, [">= 0"])
240
+ s.add_dependency(%q<psych>.freeze, ["~> 2.2"])
241
+ s.add_dependency(%q<yard>.freeze, [">= 0.8.5"])
242
+ s.add_dependency(%q<bluecloth>.freeze, [">= 0"])
243
+ s.add_dependency(%q<cucumber>.freeze, [">= 1.1.4"])
244
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
226
245
  end
227
246
  end
228
247
 
@@ -12,8 +12,12 @@ class Jeweler
12
12
 
13
13
  gemspec = gemspec_helper.parse
14
14
 
15
- require 'rubygems/builder'
16
- gem_file_name = Gem::Builder.new(gemspec).build
15
+ if Gem::Version.new(`gem -v`) >= Gem::Version.new('2.0.0.a')
16
+ gem_file_name = Gem::Package.build(gemspec)
17
+ else
18
+ require 'rubygems/builder'
19
+ gem_file_name = Gem::Builder.new(gemspec).build
20
+ end
17
21
 
18
22
  pkg_dir = File.join(base_dir, 'pkg')
19
23
  file_utils.mkdir_p pkg_dir
@@ -13,12 +13,12 @@ class Jeweler
13
13
  if missing_dependencies.empty?
14
14
  puts "#{type || 'All'} dependencies seem to be installed."
15
15
  else
16
- puts "Missing some dependencies. Install them with the following commands:"
16
+ puts 'Missing some dependencies. Install them with the following commands:'
17
17
  missing_dependencies.each do |dependency|
18
- puts %Q{\tgem install #{dependency.name} --version "#{dependency.requirement.to_s}"}
18
+ puts %(\tgem install #{dependency.name} --version "#{dependency.requirement}")
19
19
  end
20
20
 
21
- abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}"
21
+ abort "Run the specified gem commands before trying to run this again: {$PROGRAM_NAME} #{ARGV.join(' ')}"
22
22
  end
23
23
  end
24
24
 
@@ -13,7 +13,7 @@ class Jeweler
13
13
  command = "#{gem_command} install #{gemspec_helper.gem_path}"
14
14
  output.puts "Executing #{command.inspect}:"
15
15
 
16
- sh command # TODO where does sh actually come from!? - rake, apparently
16
+ sh command # TODO: where does sh actually come from!? - rake, apparently
17
17
  end
18
18
 
19
19
  def gem_command
@@ -3,7 +3,8 @@ require 'pathname'
3
3
  class Jeweler
4
4
  module Commands
5
5
  class ReleaseGemspec
6
- attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir
6
+ attr_accessor :gemspec, :version, :repo, :output, :base_dir
7
+ attr_writer :gemspec_helper
7
8
 
8
9
  def initialize(attributes = {})
9
10
  self.output = $stdout
@@ -13,24 +14,29 @@ class Jeweler
13
14
  end
14
15
  end
15
16
 
16
- def run
17
+ def run(args = {})
18
+ remote = args[:remote] || 'origin'
19
+ branch = args[:branch] || 'master'
20
+ local_branch = args[:local_branch] || branch
21
+ remote_branch = args[:remote_branch] || branch
22
+
17
23
  unless clean_staging_area?
18
- system "git status"
19
- raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
24
+ system 'git status'
25
+ raise 'Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above.'
20
26
  end
21
27
 
22
- repo.checkout('master')
28
+ repo.checkout(local_branch)
23
29
 
24
30
  regenerate_gemspec!
25
31
  commit_gemspec! if gemspec_changed?
26
32
 
27
- output.puts "Pushing master to origin"
28
- repo.push
33
+ output.puts "Pushing #{local_branch} to #{remote}"
34
+ repo.push(remote, "#{local_branch}:#{remote_branch}")
29
35
  end
30
36
 
31
37
  def clean_staging_area?
32
38
  # surprisingly simpler than ruby-git
33
- `git ls-files --deleted --modified --others --exclude-standard` == ""
39
+ `git ls-files --deleted --modified --others --exclude-standard` == ''
34
40
  end
35
41
 
36
42
  def commit_gemspec!
@@ -51,14 +57,11 @@ class Jeweler
51
57
  end
52
58
 
53
59
  def gemspec_helper
54
- @gemspec_helper ||= Jeweler::GemSpecHelper.new(self.gemspec, self.base_dir)
60
+ @gemspec_helper ||= Jeweler::GemSpecHelper.new(gemspec, base_dir)
55
61
  end
56
62
 
57
63
  def working_subdir
58
- return @working_subdir if @working_subdir
59
- cwd = base_dir_path
60
- @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path))
61
- @working_subdir
64
+ @working_subdir ||= base_dir_path.relative_path_from(Pathname.new(repo.dir.path))
62
65
  end
63
66
 
64
67
  def base_dir_path
@@ -66,7 +69,7 @@ class Jeweler
66
69
  end
67
70
 
68
71
  def self.build_for(jeweler)
69
- command = self.new
72
+ command = new
70
73
 
71
74
  command.base_dir = jeweler.base_dir
72
75
  command.gemspec = jeweler.gemspec