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-01-08 16:42:52 +00:00
|
|
|
require 'rake/contrib/rubyforgepublisher'
|
2008-11-22 01:00:51 +00:00
|
|
|
|
2008-12-29 23:40:59 +00:00
|
|
|
GEM = "mongo"
|
2009-01-08 20:56:19 +00:00
|
|
|
GEM_VERSION = '0.0.2'
|
2008-12-29 23:40:59 +00:00
|
|
|
SUMMARY = 'Simple pure-Ruby driver for the 10gen Mongo DB'
|
|
|
|
DESCRIPTION = 'This is a simple pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'
|
|
|
|
AUTHOR = 'Jim Menard'
|
|
|
|
EMAIL = 'jimm@io.com'
|
|
|
|
HOMEPAGE = 'http://www.mongodb.org'
|
2009-01-08 16:42:52 +00:00
|
|
|
RUBYFORGE_USER = 'jimm'
|
2008-12-29 23:40:59 +00:00
|
|
|
|
|
|
|
spec = Gem::Specification.new do |s|
|
|
|
|
s.name = GEM
|
|
|
|
s.version = GEM_VERSION
|
|
|
|
s.platform = Gem::Platform::RUBY
|
|
|
|
s.summary = SUMMARY
|
|
|
|
s.description = DESCRIPTION
|
|
|
|
|
|
|
|
s.require_paths = ['lib']
|
|
|
|
|
|
|
|
s.files = FileList['bin/*', 'lib/**/*.rb', 'tests/**/*.rb', '[A-Z]*'].to_a
|
|
|
|
|
|
|
|
s.bindir = 'bin'
|
2009-01-05 21:48:04 +00:00
|
|
|
s.executables = %w( mongo_console )
|
2008-12-29 23:40:59 +00:00
|
|
|
s.has_rdoc = true
|
|
|
|
|
|
|
|
s.author = AUTHOR
|
|
|
|
s.email = EMAIL
|
|
|
|
s.homepage = HOMEPAGE
|
|
|
|
|
|
|
|
s.rubyforge_project = GEM # GitHub bug, gem isn't being build when this miss
|
|
|
|
end
|
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-01-08 16:42:52 +00:00
|
|
|
FileUtils.rm_rf('html')
|
|
|
|
system "rdoc --main README.rdoc --op html --inline-source --quiet README.rdoc `find lib -name '*.rb'`"
|
|
|
|
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
|
|
|
|
|
|
|
namespace :gem do
|
|
|
|
|
|
|
|
Rake::GemPackageTask.new(spec) do |pkg|
|
|
|
|
pkg.gem_spec = spec
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Install the gem locally"
|
|
|
|
task :install => [:package] do
|
|
|
|
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
|
|
|
|
end
|
2008-12-31 00:41:53 +00:00
|
|
|
|
|
|
|
desc "Install the gem locally with ruby 1.9"
|
2008-12-31 01:03:44 +00:00
|
|
|
task :'install19' => [:package] do
|
2008-12-31 00:41:53 +00:00
|
|
|
sh %{sudo gem19 install pkg/#{GEM}-#{GEM_VERSION}}
|
|
|
|
end
|
2008-12-29 23:40:59 +00:00
|
|
|
|
|
|
|
desc "Create a gemspec file"
|
|
|
|
task :make_spec do
|
|
|
|
File.open("#{GEM}.gemspec", "w") do |file|
|
|
|
|
file.puts spec.to_ruby
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
task :default => :list
|
|
|
|
|
|
|
|
task :list do
|
|
|
|
system 'rake -T'
|
|
|
|
end
|