jeweler 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/.travis.yml +5 -1
- data/ChangeLog.markdown +4 -0
- data/Gemfile +23 -23
- data/Gemfile.lock +142 -0
- data/Gemfile.orig +54 -0
- data/README.markdown +3 -0
- data/Rakefile +13 -14
- data/Rakefile.orig +88 -0
- data/features/generator/test.feature +2 -2
- data/features/step_definitions/debug_steps.rb +0 -1
- data/features/step_definitions/filesystem_steps.rb +2 -3
- data/features/step_definitions/generator_steps.rb +44 -64
- data/features/step_definitions/task_steps.rb +1 -2
- data/features/support/env.rb +21 -7
- data/jeweler.gemspec +11 -6
- data/jeweler.gemspec.orig +464 -0
- data/lib/jeweler.rb +18 -19
- data/lib/jeweler/commands/build_gem.rb +2 -2
- data/lib/jeweler/commands/check_dependencies.rb +3 -3
- data/lib/jeweler/commands/install_gem.rb +1 -1
- data/lib/jeweler/commands/release_gemspec.rb +8 -10
- data/lib/jeweler/commands/release_to_git.rb +9 -5
- data/lib/jeweler/commands/validate_gemspec.rb +5 -7
- data/lib/jeweler/commands/version/base.rb +8 -13
- data/lib/jeweler/commands/version/bump_major.rb +1 -3
- data/lib/jeweler/commands/version/bump_minor.rb +1 -2
- data/lib/jeweler/commands/version/bump_patch.rb +1 -4
- data/lib/jeweler/commands/write_gemspec.rb +4 -3
- data/lib/jeweler/gemspec_helper.rb +15 -15
- data/lib/jeweler/gemspec_helper.rb.orig +91 -0
- data/lib/jeweler/generator.rb +39 -41
- data/lib/jeweler/generator/application.rb +5 -7
- data/lib/jeweler/generator/bacon_mixin.rb +2 -4
- data/lib/jeweler/generator/github_mixin.rb +1 -3
- data/lib/jeweler/generator/micronaut_mixin.rb +3 -3
- data/lib/jeweler/generator/minitest_mixin.rb +2 -3
- data/lib/jeweler/generator/options.rb +15 -19
- data/lib/jeweler/generator/rdoc_mixin.rb +1 -1
- data/lib/jeweler/generator/riot_mixin.rb +2 -3
- data/lib/jeweler/generator/rspec_mixin.rb +2 -3
- data/lib/jeweler/generator/shindo_mixin.rb +2 -3
- data/lib/jeweler/generator/shoulda_mixin.rb +2 -3
- data/lib/jeweler/generator/testspec_mixin.rb +2 -3
- data/lib/jeweler/generator/testunit_mixin.rb +1 -3
- data/lib/jeweler/generator/yard_mixin.rb +3 -4
- data/lib/jeweler/rubyforge_tasks.rb +13 -13
- data/lib/jeweler/rubygems_dot_org_tasks.rb +3 -3
- data/lib/jeweler/rubygems_tasks.rb +3 -3
- data/lib/jeweler/specification.rb +22 -11
- data/lib/jeweler/tasks.rb +57 -57
- data/lib/jeweler/templates/bacon/flunking.rb +3 -3
- data/lib/jeweler/templates/micronaut/flunking.rb +3 -3
- data/lib/jeweler/templates/minitest/flunking.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +3 -3
- data/lib/jeweler/templates/riot/flunking.rb +1 -1
- data/lib/jeweler/templates/rspec/flunking.rb +3 -3
- data/lib/jeweler/templates/shindo/flunking.rb +3 -3
- data/lib/jeweler/templates/testspec/flunking.rb +3 -3
- data/lib/jeweler/version_helper.rb +18 -15
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -1
- data/test/fixtures/existing-project-with-version-constant/Rakefile +18 -20
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +2 -2
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +17 -19
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +2 -2
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +17 -19
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +2 -2
- data/test/jeweler/commands/test_build_gem.rb +25 -28
- data/test/jeweler/commands/test_install_gem.rb +7 -7
- data/test/jeweler/commands/test_release_to_gemcutter.rb +6 -7
- data/test/jeweler/commands/test_release_to_git.rb +52 -57
- data/test/jeweler/commands/test_release_to_github.rb +112 -119
- data/test/jeweler/commands/test_validate_gemspec.rb +4 -6
- data/test/jeweler/commands/test_write_gemspec.rb +21 -24
- data/test/jeweler/commands/version/test_base.rb +9 -10
- data/test/jeweler/commands/version/test_bump_major.rb +1 -5
- data/test/jeweler/commands/version/test_bump_minor.rb +1 -2
- data/test/jeweler/commands/version/test_bump_patch.rb +1 -3
- data/test/jeweler/commands/version/test_write.rb +1 -3
- data/test/jeweler/generator/test_application.rb +22 -26
- data/test/jeweler/generator/test_options.rb +26 -27
- data/test/jeweler/test_gemspec_helper.rb +7 -7
- data/test/jeweler/test_generator.rb +31 -32
- data/test/jeweler/test_generator_initialization.rb +40 -43
- data/test/jeweler/test_generator_mixins.rb +6 -7
- data/test/jeweler/test_specification.rb +36 -43
- data/test/jeweler/test_tasks.rb +2 -3
- data/test/jeweler/test_version_helper.rb +33 -35
- data/test/shoulda_macros/jeweler_macros.rb +5 -5
- data/test/test_helper.rb +23 -25
- data/test/test_jeweler.rb +22 -25
- metadata +11 -6
@@ -4,15 +4,15 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name =
|
8
|
-
gem.summary = %
|
9
|
-
gem.email =
|
10
|
-
gem.homepage =
|
11
|
-
gem.authors = [
|
7
|
+
gem.name = 'existing-project-with-version'
|
8
|
+
gem.summary = %(Summarize your gem)
|
9
|
+
gem.email = 'josh@technicalpickles.com'
|
10
|
+
gem.homepage = 'http://github.com/technicalpickles/existing-project-with-version'
|
11
|
+
gem.authors = ['Josh Nichols']
|
12
12
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
13
|
end
|
14
14
|
rescue LoadError
|
15
|
-
puts
|
15
|
+
puts 'Jeweler not available. Install it with: gem install technicalpickles-jeweler -s http://gems.github.com'
|
16
16
|
end
|
17
17
|
|
18
18
|
require 'rake/testtask'
|
@@ -31,12 +31,11 @@ begin
|
|
31
31
|
end
|
32
32
|
rescue LoadError
|
33
33
|
task :rcov do
|
34
|
-
abort
|
34
|
+
abort 'RCov is not available. In order to run rcov, you must: gem install spicycode-rcov'
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
task :default => :test
|
38
|
+
task default: :test
|
40
39
|
|
41
40
|
require 'rdoc/task'
|
42
41
|
Rake::RDocTask.new do |rdoc|
|
@@ -45,7 +44,7 @@ Rake::RDocTask.new do |rdoc|
|
|
45
44
|
config = YAML.load(File.read('VERSION.yml'))
|
46
45
|
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
46
|
else
|
48
|
-
version =
|
47
|
+
version = ''
|
49
48
|
end
|
50
49
|
|
51
50
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -59,20 +58,19 @@ end
|
|
59
58
|
begin
|
60
59
|
require 'rake/contrib/sshpublisher'
|
61
60
|
namespace :rubyforge do
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
desc 'Release gem and RDoc documentation to RubyForge'
|
62
|
+
task release: ['rubyforge:release:gem', 'rubyforge:release:docs']
|
63
|
+
|
66
64
|
namespace :release do
|
67
|
-
desc
|
68
|
-
task :
|
65
|
+
desc 'Publish RDoc to RubyForge.'
|
66
|
+
task docs: [:rdoc] do
|
69
67
|
require 'yaml'
|
70
68
|
config = YAML.load(
|
71
|
-
|
69
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
72
70
|
)
|
73
71
|
|
74
72
|
host = "#{config['username']}@rubyforge.org"
|
75
|
-
remote_dir =
|
73
|
+
remote_dir = '/var/www/gforge-projects/existing-project-with-version/'
|
76
74
|
local_dir = 'rdoc'
|
77
75
|
|
78
76
|
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
@@ -80,5 +78,5 @@ begin
|
|
80
78
|
end
|
81
79
|
end
|
82
80
|
rescue LoadError
|
83
|
-
puts
|
81
|
+
puts 'Rake SshDirPublisher is unavailable or your rubyforge environment is not configured.'
|
84
82
|
end
|
@@ -1,29 +1,27 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version =
|
4
|
+
s.name = 'existing-project-with-version'
|
5
|
+
s.version = '1.5.3'
|
6
6
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(
|
8
|
-
s.authors = [
|
9
|
-
s.date =
|
10
|
-
s.email =
|
11
|
-
s.extra_rdoc_files = [
|
12
|
-
s.files = [
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ['Josh Nichols']
|
9
|
+
s.date = '2009-03-13'
|
10
|
+
s.email = 'josh@technicalpickles.com'
|
11
|
+
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
12
|
+
s.files = ['README.rdoc', 'VERSION.yml', 'lib/existing_project_with_version.rb', 'test/existing_project_with_version_test.rb', 'test/test_helper.rb', 'LICENSE']
|
13
13
|
s.has_rdoc = true
|
14
|
-
s.homepage =
|
15
|
-
s.rdoc_options = [
|
16
|
-
s.require_paths = [
|
17
|
-
s.rubygems_version =
|
18
|
-
s.summary =
|
14
|
+
s.homepage = 'http://github.com/technicalpickles/existing-project-with-version'
|
15
|
+
s.rdoc_options = ['--inline-source', '--charset=UTF-8']
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.rubygems_version = '1.3.1'
|
18
|
+
s.summary = 'Summarize your gem'
|
19
19
|
|
20
|
-
if s.respond_to? :specification_version
|
20
|
+
if s.respond_to? :specification_version
|
21
21
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
22
|
s.specification_version = 2
|
23
23
|
|
24
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0')
|
25
|
-
else
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0')
|
26
25
|
end
|
27
|
-
else
|
28
26
|
end
|
29
27
|
end
|
data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class ExistingProjectWithVersionTest < Test::Unit::TestCase
|
4
|
-
should
|
5
|
-
flunk
|
4
|
+
should 'probably rename this file and start testing for real' do
|
5
|
+
flunk 'hey buddy, you should probably rename this file and start testing for real'
|
6
6
|
end
|
7
7
|
end
|
@@ -4,77 +4,75 @@ require 'jeweler/commands/build_gem'
|
|
4
4
|
class Jeweler
|
5
5
|
module Commands
|
6
6
|
class TestBuildGem < Test::Unit::TestCase
|
7
|
-
|
8
|
-
context "after running without a version" do
|
7
|
+
context 'after running without a version' do
|
9
8
|
setup do
|
10
9
|
initialize_build_gem_environment
|
11
10
|
@command.run
|
12
11
|
end
|
13
12
|
|
14
|
-
should
|
15
|
-
assert_received(@gemspec_helper
|
13
|
+
should 'check if the gemspec helper has a version' do
|
14
|
+
assert_received(@gemspec_helper, &:has_version?)
|
16
15
|
end
|
17
16
|
|
18
17
|
should "update version of gemspec helper if the gemspec doesn't have a version" do
|
19
|
-
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version(@version_helper)}
|
18
|
+
assert_received(@gemspec_helper) { |gemspec_helper| gemspec_helper.update_version(@version_helper) }
|
20
19
|
end
|
21
20
|
|
22
21
|
should "call gemspec helper's parse" do
|
23
|
-
assert_received(@gemspec_helper
|
22
|
+
assert_received(@gemspec_helper, &:parse)
|
24
23
|
end
|
25
24
|
|
26
|
-
should
|
27
|
-
if Gem::Version.new(`gem -v`) >= Gem::Version.new(
|
28
|
-
assert_received(Gem::Package) {|builder_class| builder_class.build(@gemspec) }
|
25
|
+
should 'build from parsed gemspec' do
|
26
|
+
if Gem::Version.new(`gem -v`) >= Gem::Version.new('2.0.0.a')
|
27
|
+
assert_received(Gem::Package) { |builder_class| builder_class.build(@gemspec) }
|
29
28
|
else
|
30
|
-
assert_received(Gem::Builder) {|builder_class| builder_class.new(@gemspec) }
|
31
|
-
assert_received(@builder
|
29
|
+
assert_received(Gem::Builder) { |builder_class| builder_class.new(@gemspec) }
|
30
|
+
assert_received(@builder, &:build)
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
35
34
|
should 'make package directory' do
|
36
|
-
assert_received(@file_utils) {|file_utils| file_utils.mkdir_p './pkg'}
|
35
|
+
assert_received(@file_utils) { |file_utils| file_utils.mkdir_p './pkg' }
|
37
36
|
end
|
38
37
|
|
39
38
|
should 'move built gem into package directory' do
|
40
|
-
assert_received(@file_utils) {|file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg'}
|
39
|
+
assert_received(@file_utils) { |file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg' }
|
41
40
|
end
|
42
41
|
end
|
43
|
-
|
42
|
+
|
44
43
|
context 'after running with a version' do
|
45
44
|
setup do
|
46
45
|
initialize_build_gem_environment true
|
47
46
|
@command.run
|
48
47
|
end
|
49
|
-
|
50
|
-
should
|
51
|
-
assert_received(@gemspec_helper
|
48
|
+
|
49
|
+
should 'check if the gemspec helper has a version' do
|
50
|
+
assert_received(@gemspec_helper, &:has_version?)
|
52
51
|
end
|
53
|
-
|
52
|
+
|
54
53
|
should "update version of gemspec helper if the gemspec doesn't have a version" do
|
55
|
-
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version(@version_helper).never }
|
54
|
+
assert_received(@gemspec_helper) { |gemspec_helper| gemspec_helper.update_version(@version_helper).never }
|
56
55
|
end
|
57
|
-
|
58
56
|
end
|
59
57
|
|
60
|
-
build_command_context
|
58
|
+
build_command_context 'build for jeweler' do
|
61
59
|
setup do
|
62
60
|
@command = Jeweler::Commands::BuildGem.build_for(@jeweler)
|
63
61
|
end
|
64
62
|
|
65
|
-
should
|
63
|
+
should 'assign base_dir' do
|
66
64
|
assert_same @base_dir, @jeweler.base_dir
|
67
65
|
end
|
68
66
|
|
69
|
-
should
|
67
|
+
should 'assign gemspec_helper' do
|
70
68
|
assert_same @gemspec_helper, @jeweler.gemspec_helper
|
71
69
|
end
|
72
70
|
|
73
|
-
should
|
71
|
+
should 'return BuildGem' do
|
74
72
|
assert_kind_of Jeweler::Commands::BuildGem, @command
|
75
73
|
end
|
76
74
|
end
|
77
|
-
|
75
|
+
|
78
76
|
def initialize_build_gem_environment(has_version = false)
|
79
77
|
@gemspec = Object.new
|
80
78
|
stub(@gemspec).file_name { 'zomg-1.2.3.gem' }
|
@@ -84,10 +82,10 @@ class Jeweler
|
|
84
82
|
stub(@gemspec_helper).update_version
|
85
83
|
stub(@gemspec_helper).has_version? { has_version }
|
86
84
|
|
87
|
-
@version_helper =
|
85
|
+
@version_helper = 'Jeweler::VersionHelper'
|
88
86
|
|
89
87
|
@builder = Object.new
|
90
|
-
if Gem::Version.new(`gem -v`) >= Gem::Version.new(
|
88
|
+
if Gem::Version.new(`gem -v`) >= Gem::Version.new('2.0.0.a')
|
91
89
|
stub(Gem::Package).build { 'zomg-1.2.3.gem' }
|
92
90
|
else
|
93
91
|
stub(Gem::Builder).new { @builder }
|
@@ -106,7 +104,6 @@ class Jeweler
|
|
106
104
|
@command.gemspec_helper = @gemspec_helper
|
107
105
|
@command.version_helper = @version_helper
|
108
106
|
end
|
109
|
-
|
110
107
|
end
|
111
108
|
end
|
112
109
|
end
|
@@ -3,30 +3,30 @@ require 'test_helper'
|
|
3
3
|
class Jeweler
|
4
4
|
module Commands
|
5
5
|
class TestInstallGem < Test::Unit::TestCase
|
6
|
-
rubyforge_command_context
|
6
|
+
rubyforge_command_context 'running' do
|
7
7
|
setup do
|
8
|
-
stub(@gemspec_helper).gem_path { 'pkg/zomg-1.1.1.gem' }
|
8
|
+
stub(@gemspec_helper).gem_path { 'pkg/zomg-1.1.1.gem' }
|
9
9
|
stub(@command).gem_command { 'ruby -S gem' }
|
10
10
|
stub(@command).sh
|
11
11
|
|
12
12
|
@command.run
|
13
13
|
end
|
14
14
|
|
15
|
-
should
|
16
|
-
assert_received(@command) {|command| command.sh 'ruby -S gem install pkg/zomg-1.1.1.gem' }
|
15
|
+
should 'call sh with gem install' do
|
16
|
+
assert_received(@command) { |command| command.sh 'ruby -S gem install pkg/zomg-1.1.1.gem' }
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
build_command_context
|
20
|
+
build_command_context 'build for jeweler' do
|
21
21
|
setup do
|
22
22
|
@command = Jeweler::Commands::InstallGem.build_for(@jeweler)
|
23
23
|
end
|
24
24
|
|
25
|
-
should
|
25
|
+
should 'assign gemspec helper' do
|
26
26
|
assert_equal @gemspec_helper, @command.gemspec_helper
|
27
27
|
end
|
28
28
|
|
29
|
-
should
|
29
|
+
should 'assign output' do
|
30
30
|
assert_equal @output, @command.output
|
31
31
|
end
|
32
32
|
end
|
@@ -7,33 +7,32 @@ class Jeweler
|
|
7
7
|
Jeweler::Commands::ReleaseToRubygems.new
|
8
8
|
end
|
9
9
|
|
10
|
-
gemcutter_command_context
|
10
|
+
gemcutter_command_context 'rubyforge_project is defined in gemspec and package exists on rubyforge' do
|
11
11
|
setup do
|
12
|
-
stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
|
12
|
+
stub(@gemspec_helper).gem_path { 'pkg/zomg-1.2.3.gem' }
|
13
13
|
stub(@command).sh
|
14
14
|
@command.run
|
15
15
|
end
|
16
16
|
|
17
|
-
should
|
17
|
+
should 'push to rubygems' do
|
18
18
|
push_command = "gem push #{@gemspec_helper.gem_path}"
|
19
19
|
assert_received(@command) { |command| command.sh(push_command) }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
build_command_context
|
23
|
+
build_command_context 'build for jeweler' do
|
24
24
|
setup do
|
25
25
|
@command = Jeweler::Commands::ReleaseToRubygems.build_for(@jeweler)
|
26
26
|
end
|
27
27
|
|
28
|
-
should
|
28
|
+
should 'assign gemspec helper' do
|
29
29
|
assert_equal @gemspec_helper, @command.gemspec_helper
|
30
30
|
end
|
31
31
|
|
32
|
-
should
|
32
|
+
should 'assign output' do
|
33
33
|
assert_equal @output, @command.output
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
@@ -3,9 +3,8 @@ require 'test_helper'
|
|
3
3
|
class Jeweler
|
4
4
|
module Commands
|
5
5
|
class TestReleaseToGit < Test::Unit::TestCase
|
6
|
-
|
7
|
-
|
8
|
-
context "happily" do
|
6
|
+
rubyforge_command_context 'running' do
|
7
|
+
context 'happily' do
|
9
8
|
setup do
|
10
9
|
stub(@command).clean_staging_area? { true }
|
11
10
|
|
@@ -22,20 +21,19 @@ class Jeweler
|
|
22
21
|
@command.run
|
23
22
|
end
|
24
23
|
|
25
|
-
should
|
26
|
-
assert_received(@repo) {|repo| repo.checkout('master') }
|
24
|
+
should 'checkout master' do
|
25
|
+
assert_received(@repo) { |repo| repo.checkout('master') }
|
27
26
|
end
|
28
27
|
|
29
|
-
should
|
30
|
-
assert_received(@repo) {|repo| repo.push('origin', 'master:master') }
|
28
|
+
should 'push' do
|
29
|
+
assert_received(@repo) { |repo| repo.push('origin', 'master:master') }
|
31
30
|
end
|
32
|
-
|
33
31
|
end
|
34
32
|
|
35
|
-
context
|
33
|
+
context 'happily with different remote, local branch and remote branch' do
|
36
34
|
setup do
|
37
35
|
stub(@command).clean_staging_area? { true }
|
38
|
-
stub(@command).release_tag {
|
36
|
+
stub(@command).release_tag { 'v1.2.0' }
|
39
37
|
|
40
38
|
stub(@repo).checkout(anything)
|
41
39
|
stub(@repo) do
|
@@ -47,27 +45,26 @@ class Jeweler
|
|
47
45
|
|
48
46
|
stub(@command).release_not_tagged? { true }
|
49
47
|
|
50
|
-
@command.run(
|
48
|
+
@command.run(remote: 'upstream', local_branch: 'feature', remote_branch: 'v1')
|
51
49
|
end
|
52
50
|
|
53
|
-
should
|
54
|
-
assert_received(@repo) {|repo| repo.checkout('feature') }
|
51
|
+
should 'checkout master' do
|
52
|
+
assert_received(@repo) { |repo| repo.checkout('feature') }
|
55
53
|
end
|
56
54
|
|
57
|
-
should
|
58
|
-
assert_received(@repo) {|repo| repo.add_tag('v1.2.0') }
|
55
|
+
should 'tag version' do
|
56
|
+
assert_received(@repo) { |repo| repo.add_tag('v1.2.0') }
|
59
57
|
end
|
60
58
|
|
61
|
-
should
|
62
|
-
assert_received(@repo) {|repo| repo.push('upstream', 'feature:v1') }
|
59
|
+
should 'push' do
|
60
|
+
assert_received(@repo) { |repo| repo.push('upstream', 'feature:v1') }
|
63
61
|
end
|
64
|
-
|
65
62
|
end
|
66
63
|
|
67
|
-
context
|
64
|
+
context 'happily with different branch' do
|
68
65
|
setup do
|
69
66
|
stub(@command).clean_staging_area? { true }
|
70
|
-
stub(@command).release_tag {
|
67
|
+
stub(@command).release_tag { 'v3.2.0' }
|
71
68
|
|
72
69
|
stub(@repo).checkout(anything)
|
73
70
|
stub(@repo) do
|
@@ -79,41 +76,45 @@ class Jeweler
|
|
79
76
|
|
80
77
|
stub(@command).release_not_tagged? { true }
|
81
78
|
|
82
|
-
@command.run(
|
79
|
+
@command.run(branch: 'v3')
|
83
80
|
end
|
84
81
|
|
85
|
-
should
|
86
|
-
assert_received(@repo) {|repo| repo.checkout('v3') }
|
82
|
+
should 'checkout master' do
|
83
|
+
assert_received(@repo) { |repo| repo.checkout('v3') }
|
87
84
|
end
|
88
85
|
|
89
|
-
should
|
90
|
-
assert_received(@repo) {|repo| repo.add_tag('v3.2.0') }
|
86
|
+
should 'tag version' do
|
87
|
+
assert_received(@repo) { |repo| repo.add_tag('v3.2.0') }
|
91
88
|
end
|
92
89
|
|
93
|
-
should
|
94
|
-
assert_received(@repo) {|repo| repo.push('origin', 'v3:v3') }
|
90
|
+
should 'push' do
|
91
|
+
assert_received(@repo) { |repo| repo.push('origin', 'v3:v3') }
|
95
92
|
end
|
96
93
|
end
|
97
94
|
|
98
|
-
context
|
95
|
+
context 'with an unclean staging area' do
|
99
96
|
setup do
|
100
97
|
stub(@command).clean_staging_area? { false }
|
101
98
|
stub(@command).system
|
102
99
|
end
|
103
100
|
|
104
101
|
should 'raise error' do
|
105
|
-
assert_raises RuntimeError,
|
102
|
+
assert_raises RuntimeError, 'Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above.' do
|
106
103
|
@command.run
|
107
104
|
end
|
108
105
|
end
|
109
106
|
|
110
107
|
should 'display git status' do
|
111
|
-
|
112
|
-
|
108
|
+
begin
|
109
|
+
@command.run
|
110
|
+
rescue
|
111
|
+
nil
|
112
|
+
end
|
113
|
+
assert_received(@command) { |command| command.system('git status') }
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
116
|
-
context
|
117
|
+
context 'with a release already tagged' do
|
117
118
|
setup do
|
118
119
|
stub(@command).clean_staging_area? { true }
|
119
120
|
|
@@ -126,51 +127,48 @@ class Jeweler
|
|
126
127
|
@command.run
|
127
128
|
end
|
128
129
|
|
129
|
-
should
|
130
|
-
assert_received(@repo) {|repo| repo.checkout('master') }
|
130
|
+
should 'checkout master' do
|
131
|
+
assert_received(@repo) { |repo| repo.checkout('master') }
|
131
132
|
end
|
132
133
|
|
133
|
-
should
|
134
|
-
assert_received(@repo) {|repo| repo.push('origin', 'master:master') }
|
134
|
+
should 'push' do
|
135
|
+
assert_received(@repo) { |repo| repo.push('origin', 'master:master') }
|
135
136
|
end
|
136
|
-
|
137
137
|
end
|
138
|
-
|
139
138
|
end
|
140
139
|
|
141
|
-
|
142
|
-
build_command_context "building from jeweler" do
|
140
|
+
build_command_context 'building from jeweler' do
|
143
141
|
setup do
|
144
142
|
@command = Jeweler::Commands::ReleaseToGit.build_for(@jeweler)
|
145
143
|
end
|
146
144
|
|
147
|
-
should
|
145
|
+
should 'assign gemspec' do
|
148
146
|
assert_same @gemspec, @command.gemspec
|
149
147
|
end
|
150
148
|
|
151
|
-
should
|
149
|
+
should 'assign version' do
|
152
150
|
assert_same @version, @command.version
|
153
151
|
end
|
154
152
|
|
155
|
-
should
|
153
|
+
should 'assign repo' do
|
156
154
|
assert_same @repo, @command.repo
|
157
155
|
end
|
158
156
|
|
159
|
-
should
|
157
|
+
should 'assign output' do
|
160
158
|
assert_same @output, @command.output
|
161
159
|
end
|
162
160
|
|
163
|
-
should
|
161
|
+
should 'assign gemspec_helper' do
|
164
162
|
assert_same @gemspec_helper, @command.gemspec_helper
|
165
163
|
end
|
166
164
|
|
167
|
-
should
|
165
|
+
should 'assign base_dir' do
|
168
166
|
assert_same @base_dir, @command.base_dir
|
169
167
|
end
|
170
168
|
end
|
171
169
|
|
172
|
-
# FIXME this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday
|
173
|
-
#context "clean_staging_area?" do
|
170
|
+
# FIXME: this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday
|
171
|
+
# context "clean_staging_area?" do
|
174
172
|
|
175
173
|
# should "be false if there added files" do
|
176
174
|
# repo = build_repo :added => %w(README)
|
@@ -206,9 +204,9 @@ class Jeweler
|
|
206
204
|
|
207
205
|
# assert command.clean_staging_area?
|
208
206
|
# end
|
209
|
-
#end
|
207
|
+
# end
|
210
208
|
|
211
|
-
context
|
209
|
+
context 'release_tagged? when no tag exists' do
|
212
210
|
setup do
|
213
211
|
@repo = Object.new
|
214
212
|
stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag }
|
@@ -221,13 +219,12 @@ class Jeweler
|
|
221
219
|
@command.version = '1.2.3'
|
222
220
|
end
|
223
221
|
|
224
|
-
should_eventually
|
222
|
+
should_eventually 'be true' do
|
225
223
|
assert @command.release_not_tagged?
|
226
224
|
end
|
227
|
-
|
228
225
|
end
|
229
226
|
|
230
|
-
context
|
227
|
+
context 'release_tagged? when tag exists' do
|
231
228
|
setup do
|
232
229
|
@repo = Object.new
|
233
230
|
stub(@repo) do
|
@@ -242,10 +239,9 @@ class Jeweler
|
|
242
239
|
@command.version = '1.2.3'
|
243
240
|
end
|
244
241
|
|
245
|
-
should_eventually
|
242
|
+
should_eventually 'be false' do
|
246
243
|
assert @command.release_not_tagged?
|
247
244
|
end
|
248
|
-
|
249
245
|
end
|
250
246
|
|
251
247
|
def build_repo(options = {})
|
@@ -256,7 +252,7 @@ class Jeweler
|
|
256
252
|
end
|
257
253
|
|
258
254
|
def build_status(options = {})
|
259
|
-
options = {:
|
255
|
+
options = { added: [], deleted: [], changed: [] }.merge(options)
|
260
256
|
|
261
257
|
status = Object.new
|
262
258
|
stub(status) do
|
@@ -264,7 +260,6 @@ class Jeweler
|
|
264
260
|
deleted { options[:deleted] }
|
265
261
|
changed { options[:changed] }
|
266
262
|
end
|
267
|
-
|
268
263
|
end
|
269
264
|
end
|
270
265
|
end
|