mcornick-jeweler 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +9 -0
- data/ChangeLog.markdown +111 -0
- data/LICENSE +20 -0
- data/README.markdown +185 -0
- data/ROADMAP +12 -0
- data/Rakefile +103 -0
- data/VERSION.yml +4 -0
- data/bin/jeweler +8 -0
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +151 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +68 -0
- data/features/step_definitions/generator_steps.rb +284 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +29 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +225 -0
- data/lib/jeweler.rb +153 -0
- data/lib/jeweler/commands.rb +14 -0
- data/lib/jeweler/commands/build_gem.rb +31 -0
- data/lib/jeweler/commands/check_dependencies.rb +52 -0
- data/lib/jeweler/commands/install_gem.rb +40 -0
- data/lib/jeweler/commands/release.rb +86 -0
- data/lib/jeweler/commands/release_to_rubyforge.rb +51 -0
- data/lib/jeweler/commands/setup_rubyforge.rb +57 -0
- data/lib/jeweler/commands/validate_gemspec.rb +30 -0
- data/lib/jeweler/commands/version/base.rb +41 -0
- data/lib/jeweler/commands/version/bump_major.rb +13 -0
- data/lib/jeweler/commands/version/bump_minor.rb +12 -0
- data/lib/jeweler/commands/version/bump_patch.rb +14 -0
- data/lib/jeweler/commands/version/write.rb +12 -0
- data/lib/jeweler/commands/write_gemspec.rb +39 -0
- data/lib/jeweler/errors.rb +20 -0
- data/lib/jeweler/gemspec_helper.rb +79 -0
- data/lib/jeweler/generator.rb +306 -0
- data/lib/jeweler/generator/application.rb +54 -0
- data/lib/jeweler/generator/bacon_mixin.rb +43 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +41 -0
- data/lib/jeweler/generator/minitest_mixin.rb +42 -0
- data/lib/jeweler/generator/options.rb +102 -0
- data/lib/jeweler/generator/rdoc_mixin.rb +9 -0
- data/lib/jeweler/generator/rspec_mixin.rb +42 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +42 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/generator/yard_mixin.rb +14 -0
- data/lib/jeweler/rubyforge_tasks.rb +98 -0
- data/lib/jeweler/specification.rb +66 -0
- data/lib/jeweler/tasks.rb +135 -0
- data/lib/jeweler/templates/.document +5 -0
- data/lib/jeweler/templates/.gitignore +5 -0
- data/lib/jeweler/templates/LICENSE +20 -0
- data/lib/jeweler/templates/README.rdoc +18 -0
- data/lib/jeweler/templates/Rakefile +153 -0
- data/lib/jeweler/templates/bacon/flunking.rb +7 -0
- data/lib/jeweler/templates/bacon/helper.rb +8 -0
- data/lib/jeweler/templates/features/default.feature +9 -0
- data/lib/jeweler/templates/features/support/env.rb +8 -0
- data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
- data/lib/jeweler/templates/micronaut/helper.rb +17 -0
- data/lib/jeweler/templates/minitest/flunking.rb +7 -0
- data/lib/jeweler/templates/minitest/helper.rb +11 -0
- data/lib/jeweler/templates/rspec/flunking.rb +7 -0
- data/lib/jeweler/templates/rspec/helper.rb +10 -0
- data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
- data/lib/jeweler/templates/shoulda/helper.rb +10 -0
- data/lib/jeweler/templates/testunit/flunking.rb +7 -0
- data/lib/jeweler/templates/testunit/helper.rb +9 -0
- data/lib/jeweler/version_helper.rb +128 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +82 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/geminstaller.yml +12 -0
- data/test/jeweler/commands/test_build_gem.rb +72 -0
- data/test/jeweler/commands/test_install_gem.rb +74 -0
- data/test/jeweler/commands/test_release.rb +362 -0
- data/test/jeweler/commands/test_release_to_rubyforge.rb +157 -0
- data/test/jeweler/commands/test_setup_rubyforge.rb +182 -0
- data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
- data/test/jeweler/commands/test_write_gemspec.rb +92 -0
- data/test/jeweler/commands/version/test_base.rb +32 -0
- data/test/jeweler/commands/version/test_bump_major.rb +22 -0
- data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
- data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
- data/test/jeweler/commands/version/test_write.rb +23 -0
- data/test/shoulda_macros/jeweler_macros.rb +35 -0
- data/test/test_application.rb +139 -0
- data/test/test_gemspec_helper.rb +40 -0
- data/test/test_generator.rb +166 -0
- data/test/test_generator_initialization.rb +156 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +159 -0
- data/test/test_jeweler.rb +174 -0
- data/test/test_options.rb +149 -0
- data/test/test_specification.rb +61 -0
- data/test/test_tasks.rb +35 -0
- data/test/test_version_helper.rb +153 -0
- metadata +283 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Josh Nichols
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "existing-project-with-version"
|
8
|
+
gem.summary = %Q{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
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rake/testtask'
|
19
|
+
Rake::TestTask.new(:test) do |test|
|
20
|
+
test.libs << 'lib' << 'test'
|
21
|
+
test.pattern = 'test/**/*_test.rb'
|
22
|
+
test.verbose = false
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rcov/rcovtask'
|
27
|
+
Rcov::RcovTask.new do |test|
|
28
|
+
test.libs << 'test'
|
29
|
+
test.pattern = 'test/**/*_test.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :rcov do
|
34
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
task :default => :test
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
if File.exist?('VERSION.yml')
|
44
|
+
config = YAML.load(File.read('VERSION.yml'))
|
45
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
46
|
+
else
|
47
|
+
version = ""
|
48
|
+
end
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "existing-project-with-version #{version}"
|
52
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|
57
|
+
# Rubyforge documentation task
|
58
|
+
begin
|
59
|
+
require 'rake/contrib/sshpublisher'
|
60
|
+
namespace :rubyforge do
|
61
|
+
|
62
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
63
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
64
|
+
|
65
|
+
namespace :release do
|
66
|
+
desc "Publish RDoc to RubyForge."
|
67
|
+
task :docs => [:rdoc] do
|
68
|
+
config = YAML.load(
|
69
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
70
|
+
)
|
71
|
+
|
72
|
+
host = "#{config['username']}@rubyforge.org"
|
73
|
+
remote_dir = "/var/www/gforge-projects/existing-project-with-version/"
|
74
|
+
local_dir = 'rdoc'
|
75
|
+
|
76
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
rescue LoadError
|
81
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
82
|
+
end
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{existing-project-with-version}
|
5
|
+
s.version = "1.5.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Josh Nichols"]
|
9
|
+
s.date = %q{2009-03-13}
|
10
|
+
s.email = %q{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
|
+
s.has_rdoc = true
|
14
|
+
s.homepage = %q{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 = %q{1.3.1}
|
18
|
+
s.summary = %q{Summarize your gem}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Dependencies required to run the test suite
|
2
|
+
gems:
|
3
|
+
- name: rspec
|
4
|
+
version: '~> 1.1.12'
|
5
|
+
- name: Shoulda
|
6
|
+
version: '~> 1.2.0'
|
7
|
+
- name: ruby-debug
|
8
|
+
version: '~> 0.10.3'
|
9
|
+
- name: rr
|
10
|
+
version: '~> 0.7.1'
|
11
|
+
- name: mhennemeyer-output_catcher
|
12
|
+
version: '~> 1.0.1'
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# not sure why I need to use this form instead of just require 'test_helper'
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper'))
|
3
|
+
|
4
|
+
class Jeweler
|
5
|
+
module Commands
|
6
|
+
class TestBuildGem < Test::Unit::TestCase
|
7
|
+
|
8
|
+
context "after running" do
|
9
|
+
setup do
|
10
|
+
@gemspec = Object.new
|
11
|
+
stub(@gemspec).file_name { 'zomg-1.2.3.gem' }
|
12
|
+
|
13
|
+
@gemspec_helper = Object.new
|
14
|
+
stub(@gemspec_helper).parse { @gemspec }
|
15
|
+
|
16
|
+
@builder = Object.new
|
17
|
+
stub(Gem::Builder).new { @builder }
|
18
|
+
stub(@builder).build { 'zomg-1.2.3.gem' }
|
19
|
+
|
20
|
+
@file_utils = Object.new
|
21
|
+
stub(@file_utils).mkdir_p './pkg'
|
22
|
+
stub(@file_utils).mv './zomg-1.2.3.gem', './pkg'
|
23
|
+
|
24
|
+
@base_dir = '.'
|
25
|
+
|
26
|
+
@command = Jeweler::Commands::BuildGem.new
|
27
|
+
@command.base_dir = @base_dir
|
28
|
+
@command.file_utils = @file_utils
|
29
|
+
@command.gemspec_helper = @gemspec_helper
|
30
|
+
|
31
|
+
@command.run
|
32
|
+
end
|
33
|
+
|
34
|
+
should "call gemspec helper's parse" do
|
35
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.parse }
|
36
|
+
end
|
37
|
+
|
38
|
+
should "build from parsed gemspec" do
|
39
|
+
assert_received(Gem::Builder) {|builder_class| builder_class.new(@gemspec) }
|
40
|
+
assert_received(@builder) {|builder| builder.build }
|
41
|
+
end
|
42
|
+
|
43
|
+
should 'make package directory' do
|
44
|
+
assert_received(@file_utils) {|file_utils| file_utils.mkdir_p './pkg'}
|
45
|
+
end
|
46
|
+
|
47
|
+
should 'move built gem into package directory' do
|
48
|
+
assert_received(@file_utils) {|file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg'}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
build_command_context "build for jeweler" do
|
53
|
+
setup do
|
54
|
+
@command = Jeweler::Commands::BuildGem.build_for(@jeweler)
|
55
|
+
end
|
56
|
+
|
57
|
+
should "assign base_dir" do
|
58
|
+
assert_same @base_dir, @jeweler.base_dir
|
59
|
+
end
|
60
|
+
|
61
|
+
should "assign gemspec_helper" do
|
62
|
+
assert_same @gemspec_helper, @jeweler.gemspec_helper
|
63
|
+
end
|
64
|
+
|
65
|
+
should "return BuildGem" do
|
66
|
+
assert_kind_of Jeweler::Commands::BuildGem, @command
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestInstallGem < Test::Unit::TestCase
|
6
|
+
rubyforge_command_context "running" do
|
7
|
+
setup do
|
8
|
+
stub(@gemspec_helper).gem_path { 'pkg/zomg-1.1.1.gem' }
|
9
|
+
stub(@command).sudo_wrapper { 'sudo gem install pkg/zomg-1.1.1.gem' }
|
10
|
+
stub(@command).sh
|
11
|
+
|
12
|
+
@command.run
|
13
|
+
end
|
14
|
+
|
15
|
+
should "call sudo wrapper with gem install" do
|
16
|
+
assert_received(@command) {|command| command.sudo_wrapper('gem install pkg/zomg-1.1.1.gem') }
|
17
|
+
end
|
18
|
+
|
19
|
+
should "call sh with output of sudo wrapper" do
|
20
|
+
assert_received(@command) {|command| command.sh 'sudo gem install pkg/zomg-1.1.1.gem' }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
rubyforge_command_context "use_sudo?" do
|
25
|
+
should "be false on mswin" do
|
26
|
+
stub(@command).host_os { "i386-mswin32" }
|
27
|
+
assert ! @command.use_sudo?
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be false on windows" do
|
31
|
+
stub(@command).host_os { "windows" }
|
32
|
+
assert ! @command.use_sudo?
|
33
|
+
end
|
34
|
+
|
35
|
+
should "be false on cygwin" do
|
36
|
+
stub(@command).host_os { "cygwin" }
|
37
|
+
assert ! @command.use_sudo?
|
38
|
+
end
|
39
|
+
|
40
|
+
should "be true on basically anything else" do
|
41
|
+
stub(@command).host_os { "darwin9" }
|
42
|
+
assert @command.use_sudo?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
rubyforge_command_context "sudo_wrapper" do
|
47
|
+
should "prefix sudo if needed" do
|
48
|
+
stub(@command).use_sudo? { true }
|
49
|
+
assert_equal "sudo blarg", @command.sudo_wrapper("blarg")
|
50
|
+
end
|
51
|
+
|
52
|
+
should "not prefix with sudo if unneeded" do
|
53
|
+
stub(@command).use_sudo? { false }
|
54
|
+
assert_equal "blarg", @command.sudo_wrapper("blarg")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
build_command_context "build for jeweler" do
|
60
|
+
setup do
|
61
|
+
@command = Jeweler::Commands::InstallGem.build_for(@jeweler)
|
62
|
+
end
|
63
|
+
|
64
|
+
should "assign gemspec helper" do
|
65
|
+
assert_equal @gemspec_helper, @command.gemspec_helper
|
66
|
+
end
|
67
|
+
|
68
|
+
should "assign output" do
|
69
|
+
assert_equal @output, @command.output
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,362 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestRelease < Test::Unit::TestCase
|
6
|
+
|
7
|
+
rubyforge_command_context "running" do
|
8
|
+
context "happily" do
|
9
|
+
setup do
|
10
|
+
stub(@command).clean_staging_area? { true }
|
11
|
+
|
12
|
+
stub(@repo).checkout(anything)
|
13
|
+
|
14
|
+
stub(@command).regenerate_gemspec!
|
15
|
+
|
16
|
+
stub(@command).gemspec_changed? { true }
|
17
|
+
stub(@command).commit_gemspec! { true }
|
18
|
+
|
19
|
+
stub(@repo).push
|
20
|
+
|
21
|
+
stub(@command).release_not_tagged? { true }
|
22
|
+
stub(@command).tag_release!
|
23
|
+
|
24
|
+
@command.run
|
25
|
+
end
|
26
|
+
|
27
|
+
should "checkout master" do
|
28
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
29
|
+
end
|
30
|
+
|
31
|
+
should "regenerate gemspec" do
|
32
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
33
|
+
end
|
34
|
+
|
35
|
+
should "commit gemspec" do
|
36
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
37
|
+
end
|
38
|
+
|
39
|
+
should "push" do
|
40
|
+
assert_received(@repo) {|repo| repo.push }
|
41
|
+
end
|
42
|
+
|
43
|
+
should "tag release" do
|
44
|
+
assert_received(@command) {|command| command.tag_release! }
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
context "with an unclean staging area" do
|
50
|
+
setup do
|
51
|
+
stub(@command).clean_staging_area? { false }
|
52
|
+
end
|
53
|
+
|
54
|
+
should 'raise error' do
|
55
|
+
assert_raises RuntimeError, /try commiting/i do
|
56
|
+
@command.run
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "with an unchanged gemspec" do
|
62
|
+
setup do
|
63
|
+
stub(@command).clean_staging_area? { true }
|
64
|
+
|
65
|
+
stub(@repo).checkout(anything)
|
66
|
+
|
67
|
+
stub(@command).regenerate_gemspec!
|
68
|
+
|
69
|
+
stub(@command).gemspec_changed? { false }
|
70
|
+
dont_allow(@command).commit_gemspec! { true }
|
71
|
+
|
72
|
+
stub(@repo).push
|
73
|
+
|
74
|
+
stub(@command).release_not_tagged? { true }
|
75
|
+
stub(@command).tag_release!
|
76
|
+
|
77
|
+
@command.run
|
78
|
+
end
|
79
|
+
|
80
|
+
should "checkout master" do
|
81
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
82
|
+
end
|
83
|
+
|
84
|
+
should "regenerate gemspec" do
|
85
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
86
|
+
end
|
87
|
+
|
88
|
+
should "push" do
|
89
|
+
assert_received(@repo) {|repo| repo.push }
|
90
|
+
end
|
91
|
+
|
92
|
+
should "tag release" do
|
93
|
+
assert_received(@command) {|command| command.tag_release! }
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
context "with a release already tagged" do
|
99
|
+
setup do
|
100
|
+
stub(@command).clean_staging_area? { true }
|
101
|
+
|
102
|
+
stub(@repo).checkout(anything)
|
103
|
+
|
104
|
+
stub(@command).regenerate_gemspec!
|
105
|
+
|
106
|
+
stub(@command).gemspec_changed? { true }
|
107
|
+
stub(@command).commit_gemspec! { true }
|
108
|
+
|
109
|
+
stub(@repo).push
|
110
|
+
|
111
|
+
stub(@command).release_not_tagged? { false }
|
112
|
+
dont_allow(@command).tag_release!
|
113
|
+
|
114
|
+
@command.run
|
115
|
+
end
|
116
|
+
|
117
|
+
should "checkout master" do
|
118
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
119
|
+
end
|
120
|
+
|
121
|
+
should "regenerate gemspec" do
|
122
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
123
|
+
end
|
124
|
+
|
125
|
+
should "commit gemspec" do
|
126
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
127
|
+
end
|
128
|
+
|
129
|
+
should "push" do
|
130
|
+
assert_received(@repo) {|repo| repo.push }
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
build_command_context "building from jeweler" do
|
139
|
+
setup do
|
140
|
+
@command = Jeweler::Commands::Release.build_for(@jeweler)
|
141
|
+
end
|
142
|
+
|
143
|
+
should "assign gemspec" do
|
144
|
+
assert_same @gemspec, @command.gemspec
|
145
|
+
end
|
146
|
+
|
147
|
+
should "assign version" do
|
148
|
+
assert_same @version, @command.version
|
149
|
+
end
|
150
|
+
|
151
|
+
should "assign repo" do
|
152
|
+
assert_same @repo, @command.repo
|
153
|
+
end
|
154
|
+
|
155
|
+
should "assign output" do
|
156
|
+
assert_same @output, @command.output
|
157
|
+
end
|
158
|
+
|
159
|
+
should "assign gemspec_helper" do
|
160
|
+
assert_same @gemspec_helper, @command.gemspec_helper
|
161
|
+
end
|
162
|
+
|
163
|
+
should "assign base_dir" do
|
164
|
+
assert_same @base_dir, @command.base_dir
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "clean_staging_area?" do
|
169
|
+
|
170
|
+
should "be false if there added files" do
|
171
|
+
repo = build_repo :added => %w(README)
|
172
|
+
|
173
|
+
command = Jeweler::Commands::Release.new :repo => repo
|
174
|
+
|
175
|
+
assert ! command.clean_staging_area?
|
176
|
+
end
|
177
|
+
|
178
|
+
should "be false if there are changed files" do
|
179
|
+
repo = build_repo :changed => %w(README)
|
180
|
+
|
181
|
+
command = Jeweler::Commands::Release.new
|
182
|
+
command.repo = repo
|
183
|
+
|
184
|
+
assert ! command.clean_staging_area?
|
185
|
+
end
|
186
|
+
|
187
|
+
should "be false if there are deleted files" do
|
188
|
+
repo = build_repo :deleted => %w(README)
|
189
|
+
|
190
|
+
command = Jeweler::Commands::Release.new
|
191
|
+
command.repo = repo
|
192
|
+
|
193
|
+
assert ! command.clean_staging_area?
|
194
|
+
end
|
195
|
+
|
196
|
+
should "be true if nothing added, changed, or deleted" do
|
197
|
+
repo = build_repo
|
198
|
+
|
199
|
+
command = Jeweler::Commands::Release.new
|
200
|
+
command.repo = repo
|
201
|
+
|
202
|
+
assert command.clean_staging_area?
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
context "tag_release!" do
|
207
|
+
setup do
|
208
|
+
@repo = Object.new
|
209
|
+
stub(@repo) do
|
210
|
+
add_tag(anything)
|
211
|
+
push(anything, anything)
|
212
|
+
end
|
213
|
+
|
214
|
+
@output = StringIO.new
|
215
|
+
|
216
|
+
@command = Jeweler::Commands::Release.new
|
217
|
+
@command.output = @output
|
218
|
+
@command.repo = @repo
|
219
|
+
@command.gemspec_helper = @gemspec_helper
|
220
|
+
@command.version = '1.2.3'
|
221
|
+
|
222
|
+
@command.tag_release!
|
223
|
+
end
|
224
|
+
|
225
|
+
should "tag release" do
|
226
|
+
assert_received(@repo) {|repo| repo.add_tag("v1.2.3")}
|
227
|
+
end
|
228
|
+
|
229
|
+
should "push tag to repository" do
|
230
|
+
assert_received(@repo) {|repo| repo.push('origin', 'v1.2.3')}
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
context "regenerate_gemspec!" do
|
235
|
+
setup do
|
236
|
+
@repo = Object.new
|
237
|
+
stub(@repo) do
|
238
|
+
add(anything)
|
239
|
+
commit(anything)
|
240
|
+
end
|
241
|
+
|
242
|
+
@gemspec_helper = Object.new
|
243
|
+
stub(@gemspec_helper) do
|
244
|
+
write
|
245
|
+
path {'zomg.gemspec'}
|
246
|
+
update_version('1.2.3')
|
247
|
+
end
|
248
|
+
|
249
|
+
@output = StringIO.new
|
250
|
+
|
251
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
252
|
+
:repo => @repo,
|
253
|
+
:gemspec_helper => @gemspec_helper,
|
254
|
+
:version => '1.2.3'
|
255
|
+
|
256
|
+
@command.regenerate_gemspec!
|
257
|
+
end
|
258
|
+
|
259
|
+
should "refresh gemspec version" do
|
260
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') }
|
261
|
+
end
|
262
|
+
|
263
|
+
should "write gemspec" do
|
264
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
context "commit_gemspec!" do
|
269
|
+
setup do
|
270
|
+
@repo = Object.new
|
271
|
+
stub(@repo) do
|
272
|
+
add(anything)
|
273
|
+
commit(anything)
|
274
|
+
end
|
275
|
+
|
276
|
+
@gemspec_helper = Object.new
|
277
|
+
stub(@gemspec_helper) do
|
278
|
+
path {'zomg.gemspec'}
|
279
|
+
update_version('1.2.3')
|
280
|
+
end
|
281
|
+
|
282
|
+
@output = StringIO.new
|
283
|
+
|
284
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
285
|
+
:repo => @repo,
|
286
|
+
:gemspec_helper => @gemspec_helper,
|
287
|
+
:version => '1.2.3'
|
288
|
+
|
289
|
+
@command.commit_gemspec!
|
290
|
+
end
|
291
|
+
|
292
|
+
should "add gemspec to repository" do
|
293
|
+
assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
|
294
|
+
end
|
295
|
+
|
296
|
+
should "commit with commit message including version" do
|
297
|
+
assert_received(@repo) {|repo| repo.commit("Regenerated gemspec for version 1.2.3") }
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
context "release_tagged? when no tag exists" do
|
303
|
+
setup do
|
304
|
+
@repo = Object.new
|
305
|
+
stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag }
|
306
|
+
|
307
|
+
@output = StringIO.new
|
308
|
+
|
309
|
+
@command = Jeweler::Commands::Release.new
|
310
|
+
@command.output = @output
|
311
|
+
@command.repo = @repo
|
312
|
+
@command.version = '1.2.3'
|
313
|
+
end
|
314
|
+
|
315
|
+
should_eventually "be true" do
|
316
|
+
assert @command.release_not_tagged?
|
317
|
+
end
|
318
|
+
|
319
|
+
end
|
320
|
+
|
321
|
+
context "release_tagged? when tag exists" do
|
322
|
+
setup do
|
323
|
+
@repo = Object.new
|
324
|
+
stub(@repo) do
|
325
|
+
tag('v1.2.3') { Object.new }
|
326
|
+
end
|
327
|
+
|
328
|
+
@output = StringIO.new
|
329
|
+
|
330
|
+
@command = Jeweler::Commands::Release.new
|
331
|
+
@command.output = @output
|
332
|
+
@command.repo = @repo
|
333
|
+
@command.version = '1.2.3'
|
334
|
+
end
|
335
|
+
|
336
|
+
should_eventually "be false" do
|
337
|
+
assert @command.release_not_tagged?
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
342
|
+
def build_repo(options = {})
|
343
|
+
status = build_status options
|
344
|
+
repo = Object.new
|
345
|
+
stub(repo).status { status }
|
346
|
+
repo
|
347
|
+
end
|
348
|
+
|
349
|
+
def build_status(options = {})
|
350
|
+
options = {:added => [], :deleted => [], :changed => []}.merge(options)
|
351
|
+
|
352
|
+
status = Object.new
|
353
|
+
stub(status) do
|
354
|
+
added { options[:added] }
|
355
|
+
deleted { options[:deleted] }
|
356
|
+
changed { options[:changed] }
|
357
|
+
end
|
358
|
+
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|