2008-12-29 23:40:59 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rubygems/specification'
|
2008-12-04 21:38:04 +00:00
|
|
|
require 'fileutils'
|
2008-12-29 23:40:59 +00:00
|
|
|
require 'rake'
|
2008-11-22 01:00:51 +00:00
|
|
|
require 'rake/testtask'
|
2008-12-29 23:40:59 +00:00
|
|
|
require 'rake/gempackagetask'
|
2009-03-03 22:07:22 +00:00
|
|
|
begin
|
|
|
|
require 'rake/contrib/rubyforgepublisher'
|
|
|
|
rescue LoadError
|
|
|
|
end
|
2009-03-13 16:04:54 +00:00
|
|
|
require 'rbconfig'
|
|
|
|
include Config
|
2008-11-22 01:00:51 +00:00
|
|
|
|
2009-03-23 16:13:44 +00:00
|
|
|
gem_command = "gem"
|
2009-08-17 14:14:48 +00:00
|
|
|
gem_command = "gem1.9" if $0.match(/1\.9$/) # use gem1.9 if we used rake1.9
|
2009-03-23 16:13:44 +00:00
|
|
|
|
2008-11-22 01:00:51 +00:00
|
|
|
# NOTE: some of the tests assume Mongo is running
|
|
|
|
Rake::TestTask.new do |t|
|
2008-12-02 00:36:20 +00:00
|
|
|
t.test_files = FileList['tests/test*.rb']
|
2008-11-22 01:00:51 +00:00
|
|
|
end
|
2008-12-04 21:38:04 +00:00
|
|
|
|
2008-12-04 21:44:21 +00:00
|
|
|
desc "Generate documentation"
|
2008-12-04 21:38:04 +00:00
|
|
|
task :rdoc do
|
2009-04-14 20:53:42 +00:00
|
|
|
version = eval(File.read("mongo-ruby-driver.gemspec")).version
|
|
|
|
out = File.join('html', version.to_s)
|
2009-04-23 19:39:57 +00:00
|
|
|
FileUtils.rm_rf('html')
|
2009-04-14 20:53:42 +00:00
|
|
|
system "rdoc --main README.rdoc --op #{out} --inline-source --quiet README.rdoc `find lib -name '*.rb'`"
|
2009-01-08 16:42:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Publish documentation to mongo.rubyforge.org"
|
|
|
|
task :publish => [:rdoc] do
|
|
|
|
# Assumes docs are in ./html
|
|
|
|
Rake::RubyForgePublisher.new(GEM, RUBYFORGE_USER).upload
|
2008-12-04 21:38:04 +00:00
|
|
|
end
|
2008-12-29 23:40:59 +00:00
|
|
|
|
2009-03-02 16:49:56 +00:00
|
|
|
namespace :gem do
|
2008-12-29 23:40:59 +00:00
|
|
|
|
|
|
|
desc "Install the gem locally"
|
2009-01-16 20:01:31 +00:00
|
|
|
task :install do
|
|
|
|
sh <<EOS
|
2009-03-23 16:13:44 +00:00
|
|
|
#{gem_command} build mongo-ruby-driver.gemspec &&
|
|
|
|
sudo #{gem_command} install mongo-*.gem &&
|
2009-01-16 21:09:31 +00:00
|
|
|
rm mongo-*.gem
|
2009-01-16 20:01:31 +00:00
|
|
|
EOS
|
2008-12-29 23:40:59 +00:00
|
|
|
end
|
|
|
|
|
2009-03-19 17:12:30 +00:00
|
|
|
desc "Install the optional c extensions"
|
|
|
|
task :install_extensions do
|
|
|
|
sh <<EOS
|
2009-03-23 16:13:44 +00:00
|
|
|
#{gem_command} build mongo-extensions.gemspec &&
|
|
|
|
sudo #{gem_command} install mongo_ext-*.gem &&
|
2009-03-19 17:12:30 +00:00
|
|
|
rm mongo_ext-*.gem
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2008-12-29 23:40:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
task :default => :list
|
|
|
|
|
|
|
|
task :list do
|
|
|
|
system 'rake -T'
|
|
|
|
end
|