Skip to content

Commit

Permalink
Fix some rake tasks for releasing
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/rubygems/trunk@2478 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
drbrain committed Apr 20, 2010
1 parent 38b4d4e commit 6dadf01
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ task :scrub_dev_deps do
end

task :release => [:clobber, :sanity_check, :test_functional,
:test, :package, :tag]
:test, :package]

task :postrelease => [:tag, :publish_docs]

Rake::Task[:release_to_rubyforge].clear

Expand All @@ -84,7 +86,7 @@ task :sanity_check do
abort "svn status dirty. commit or revert them" unless `svn st`.empty?
end

task :tag => [:sanity_check] do
task :tag => :sanity_check do
reltag = "REL_#{Gem::VERSION.gsub(/\./, '_')}"
svn_url = "svn+ssh://rubyforge.org/var/svn/rubygems"
sh %{svn copy #{svn_url}/trunk #{svn_url}/tags/#{reltag}}
Expand Down Expand Up @@ -204,3 +206,4 @@ task "rcov:for", [:test] do |task, args|

ruby "#{flags.join ' '} #{rcov} #{rflags.join ' '} #{args[:test]}"
end

5 changes: 5 additions & 0 deletions test/rubygems_plugin.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
require 'rubygems/command_manager'

##
# This is an example of exactly what NOT to do.
#
# DO NOT include code like this in your rubygems_plugin.rb

class Gem::Commands::InterruptCommand < Gem::Command

def initialize
Expand Down
23 changes: 19 additions & 4 deletions test/test_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def setup
else
%r|/[Rr]uby/[Gg]ems/[0-9.]+|
end

util_remove_interrupt_command
end

def test_self_all_load_paths
Expand Down Expand Up @@ -621,24 +623,32 @@ def test_load_plugins
with_plugin('load') { Gem.load_plugins }
assert_equal :loaded, TEST_PLUGIN_LOAD

util_remove_interrupt_command

# Should attempt to cause a StandardError
with_plugin('standarderror') { Gem.load_plugins }
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR

util_remove_interrupt_command

# Should attempt to cause an Exception
with_plugin('exception') { Gem.load_plugins }
assert_equal :loaded, TEST_PLUGIN_EXCEPTION
end

def with_plugin(path)
test_plugin_path = File.expand_path("../plugin/#{path}", __FILE__)
test_plugin_path = File.expand_path "../plugin/#{path}", __FILE__

# A single test plugin should get loaded once only, in order to preserve
# sane test semantics.
assert !$LOAD_PATH.include?(test_plugin_path)
refute_includes $LOAD_PATH, test_plugin_path
$LOAD_PATH.unshift test_plugin_path
yield

capture_io do
yield
end
ensure
$LOAD_PATH.delete(test_plugin_path)
$LOAD_PATH.delete test_plugin_path
end

def util_ensure_gem_dirs
Expand Down Expand Up @@ -689,5 +699,10 @@ def util_restore_RUBY_VERSION
defined?(@RUBY_REVISION)
end

def util_remove_interrupt_command
Gem::Commands.send :remove_const, :InterruptCommand if
Gem::Commands.const_defined? :InterruptCommand
end

end

4 changes: 3 additions & 1 deletion test/test_gem_command_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def setup
end

def test_run_interrupt
Gem.load_plugins

use_ui @ui do
assert_raises MockGemUi::TermError do
@command_manager.run 'interrupt'
Expand All @@ -18,7 +20,7 @@ def test_run_interrupt
assert_equal "ERROR: Interrupted\n", ui.error
end
end

def test_run_crash_command
@command_manager.register_command :crash
use_ui @ui do
Expand Down

0 comments on commit 6dadf01

Please sign in to comment.