Skip to content

Commit

Permalink
Use jeweler for gem management.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Apr 14, 2009
1 parent f762333 commit bf6b58b
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'rubygems'
require 'rake/gempackagetask'
require 'rake/testtask'
require 'rake/rdoctask'

task :default => :test

desc "Run All Tests"
Expand All @@ -11,32 +11,16 @@ Rake::TestTask.new :test do |test|
test.verbose = true
end

desc %{Update ".manifest" with the latest list of project filenames. Respect\
.gitignore by excluding everything that git ignores. Update `files` and\
`test_files` arrays in "*.gemspec" file if it's present.}
task :manifest do
list = Dir['**/*'].sort
spec_file = Dir['*.gemspec'].first
list -= [spec_file] if spec_file

if File.exist?('.gitignore')
File.read('.gitignore').each_line do |glob|
glob = glob.chomp.sub(/^\//, '')
list -= Dir[glob]
list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
puts "excluding #{glob}"
end
end

if spec_file
spec = File.read spec_file
spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
assignment = $1
bunch = $2 ? list.grep(/^test\//) : list
'%s%%w(%s)' % [assignment, bunch.join(' ')]
end

File.open(spec_file, 'w') {|f| f << spec }
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "test_benchmarker"
gemspec.summary = "A tool for benchmarking ruby Test::Unit tests."
gemspec.email = "myron.marston@gmail.com"
gemspec.homepage = "http://github.com/myronmarston/test_benchmarker/"
gemspec.description = "A tool for benchmarking ruby Test::Unit tests."
gemspec.authors = ["Myron Marston"]
end
File.open('manifest.txt', 'w') {|f| f << list.join("\n") }
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end

0 comments on commit bf6b58b

Please sign in to comment.