require 'rubygems' require 'rake/clean' require 'rake/gempackagetask' require 'spec/rake/spectask' require 'pathname' require Pathname(__FILE__).dirname.expand_path.parent + 'tasks/ext_helper' # House-keeping CLEAN.include '**/*.o', '**/*.so', '**/*.bundle', '**/*.a', '**/*.log', '{ext,lib}/*.{bundle,so,obj,pdb,lib,def,exp}', 'ext/Makefile' JRUBY = (RUBY_PLATFORM =~ /java/) rescue nil WINDOWS = (RUBY_PLATFORM =~ /mswin|mingw|cygwin/) rescue nil # don't use SUDO with JRuby, for the moment, although this behaviour # is not entirely correct. SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS']) spec = Gem::Specification.new do |s| s.name = 'do_postgres' s.version = '0.9.2' s.platform = Gem::Platform::RUBY s.has_rdoc = true s.extra_rdoc_files = %w[ README LICENSE TODO ] s.summary = 'A DataObject.rb driver for PostgreSQL' s.description = s.summary s.author = 'Yehuda Katz' s.email = 'wycats@gmail.com' s.homepage = 'http://rubyforge.org/projects/dorb' s.rubyforge_project = 'dorb' s.require_path = 'lib' s.extensions = %w[ ext/extconf.rb ] s.files = FileList[ '{ext,lib,spec}/**/*.{c,h,rb}', 'Rakefile', *s.extra_rdoc_files ] s.add_dependency('data_objects', "=#{s.version}") end Rake::GemPackageTask.new(spec) do |pkg| pkg.gem_spec = spec end # Use of ext_helper to properly setup compile tasks and native gem generation setup_extension "#{spec.name}_ext", spec task :install => [ :package ] do sh %{#{SUDO} gem install --local pkg/#{spec.name}-#{spec.version} --no-update-sources}, :verbose => false end desc "Uninstall #{spec.name} #{spec.version} (default ruby)" task :uninstall => [ :clobber ] do sh "#{SUDO} gem uninstall #{spec.name} -v#{spec.version} -I -x", :verbose => false end desc 'Run specifications' Spec::Rake::SpecTask.new(:spec => [ :compile ]) do |t| t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts') t.spec_files = Pathname.glob(Pathname.new(__FILE__).dirname + 'spec/**/*_spec.rb') end