Rakefile in rubygems-update-1.8.30 vs Rakefile in rubygems-update-2.0.0.preview2
- old
+ new
@@ -4,10 +4,14 @@
require 'rubygems/package_task'
# HACK bootstrap load_yaml, remove after 1.5 release
def Gem.load_yaml; end unless Gem.respond_to? :load_yaml
+if ENV['YAML'] == "syck"
+ ENV['TEST_SYCK'] = "1"
+end
+
begin
require 'psych'
rescue ::LoadError
require 'yaml'
end
@@ -16,20 +20,19 @@
Hoe::RUBY_FLAGS << " --disable-gems" if RUBY_VERSION > "1.9"
Hoe.plugin :minitest
Hoe.plugin :git
+Hoe.plugin :travis
# Hoe.plugin :isolate
hoe = Hoe.spec 'rubygems-update' do
+ self.rubyforge_name = 'rubygems'
self.author = ['Jim Weirich', 'Chad Fowler', 'Eric Hodel']
self.email = %w[rubygems-developers@rubyforge.org]
self.readme_file = 'README.rdoc'
- license 'Ruby'
- license 'MIT'
-
spec_extras[:required_rubygems_version] = Gem::Requirement.default
spec_extras[:required_ruby_version] = Gem::Requirement.new '>= 1.8.7'
spec_extras[:executables] = ['update_rubygems']
rdoc_locations <<
@@ -47,17 +50,14 @@
extra_dev_deps << ['builder', '~> 2.1']
extra_dev_deps << ['hoe-seattlerb', '~> 1.2']
extra_dev_deps << ['session', '~> 2.4']
extra_dev_deps << ['rdoc', '~> 3.0']
- extra_dev_deps << ['rcov', '~> 0.9.0']
extra_dev_deps << ['ZenTest', '~> 4.5']
+ extra_dev_deps << ['rake', '~> 0.9.3']
- self.extra_rdoc_files = Dir["*.rdoc"] + %w[
- CVE-2013-4287.txt
- CVE-2013-4363.txt
- ]
+ self.extra_rdoc_files = Dir["*.rdoc"]
spec_extras['rdoc_options'] = proc do |rdoc_options|
rdoc_options << "--title=RubyGems #{self.version} Documentation"
end
@@ -68,12 +68,10 @@
# in the first place.
spec_extras['require_paths'] = %w[hide_lib_for_update] unless
ENV['RAKE_SUCKS']
end
-hoe.test_prelude = 'gem "minitest", "~> 4.0"'
-
task :docs => :rake_sucks
task :rake_sucks do
# This exists ENTIRELY because the rake design convention of
# RDocTask.new is broken. Because most of the work is being done
# inside initialize(?!?) BEFORE tasks are even running, too much
@@ -84,16 +82,23 @@
rm_rf "doc"
sh "rake docs"
end
end
+task :clean_env do
+ ENV.delete "GEM_HOME"
+ ENV.delete "GEM_PATH"
+end
+
+task :test => :clean_env
+
# --------------------------------------------------------------------
# Creating a release
task :prerelease => [:clobber, :check_manifest, :test]
-task :postrelease => [:upload]
+task :postrelease => [:publish_docs, :upload]
pkg_dir_path = "pkg/rubygems-update-#{hoe.version}"
task :package do
mv pkg_dir_path, "pkg/rubygems-#{hoe.version}"
Dir.chdir 'pkg' do
@@ -143,11 +148,11 @@
sh "diff #{diff_options} bin/gem #{dir}/bin/gem; true"
sh "diff #{diff_options} lib/ubygems.rb #{dir}/lib/ubygems.rb; true"
sh "diff #{diff_options} lib/rubygems.rb #{dir}/lib/rubygems.rb; true"
sh "diff #{diff_options} lib/rubygems #{dir}/lib/rubygems; true"
sh "diff #{diff_options} lib/rbconfig #{dir}/lib/rbconfig; true"
- sh "diff #{diff_options} test/rubygems #{dir}/test/rubygems; true"
+ sh "diff #{diff_options} test #{dir}/test/rubygems; true"
end
rubinius_dir = ENV['RUBINIUS_PATH'] || '../git.rubini.us/code'
ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk'
@@ -169,33 +174,10 @@
desc "Diffs Rubinius HEAD with the currently checked-out copy of RubyGems."
task :diff_rubinius do
diff_with rubinius_dir
end
-desc "Get coverage for a specific test, no system RubyGems."
-task "rcov:for", [:test] do |task, args|
- mgem = Gem.source_index.find_name("minitest").first rescue nil
- rgem = Gem.source_index.find_name(/rcov/).first
- libs = rgem.require_paths.map { |p| File.join rgem.full_gem_path, p }
- rcov = File.join rgem.full_gem_path, rgem.bindir, rgem.default_executable
-
- if mgem
- libs << mgem.require_paths.map { |p| File.join mgem.full_gem_path, p }
- end
-
- libs << "lib:test"
-
- flags = []
- flags << "-I" << libs.flatten.join(":")
-
- rflags = []
- rflags << "-i" << "lib/rubygems"
- rflags << "--no-color" << "--save coverage.info" << "-T" << "--no-html"
-
- ruby "#{flags.join ' '} #{rcov} #{rflags.join ' '} #{args[:test]}"
-end
-
def changelog_section code
name = {
:major => "major enhancement",
:minor => "minor enhancement",
:bug => "bug fix",
@@ -231,15 +213,14 @@
range = [tag, "HEAD"].compact.join ".."
cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
now = Time.new.strftime "%Y-%m-%d"
changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map do |msg, author, email|
- c = msg.split(/\n/).reject { |s| s.empty? }
- c.empty? ? nil : c.first
+ msg.split(/\n/).reject { |s| s.empty? }
end
- changes = changes.flatten.compact
+ changes = changes.flatten
next if changes.empty?
$changes = Hash.new { |h,k| h[k] = [] }
@@ -268,6 +249,11 @@
changelog_section :major
changelog_section :minor
changelog_section :bug
changelog_section :unknown
puts
+end
+
+desc "Cleanup trailing whitespace"
+task :whitespace do
+ system 'find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i "" -E "s/[[:space:]]*$//"'
end