From 0c34782048a5b0c494f84573433500327ac30669 Mon Sep 17 00:00:00 2001 From: Adrian Madrid Date: Mon, 29 Dec 2008 16:40:59 -0700 Subject: [PATCH] Fixed gem info --- .gitignore | 3 +++ Rakefile | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2d82228..da1e366 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ doc t +pkg +doc +*.gemspec diff --git a/Rakefile b/Rakefile index ecc3f14..2017653 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,38 @@ +require 'rubygems' +require 'rubygems/specification' require 'fileutils' +require 'rake' require 'rake/testtask' +require 'rake/gempackagetask' -task :default => [:test] +GEM = "mongo" +GEM_VERSION = '0.0.1' +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' + +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' + 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 # NOTE: some of the tests assume Mongo is running Rake::TestTask.new do |t| @@ -13,3 +44,29 @@ task :rdoc do FileUtils.rm_rf('doc') system "rdoc --main README.rdoc --inline-source --quiet README.rdoc `find lib -name '*.rb'`" end + +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 + + 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