require 'rubygems' require 'spec/rake/spectask' require 'pathname' ROOT = Pathname(__FILE__).dirname.expand_path require "lib/do_sqlite3/version" 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']) AUTHOR = "Bernerd Schaefer" EMAIL = "bj.schaefer@gmail.com" GEM_NAME = "do_sqlite3" GEM_VERSION = DataObjects::Sqlite3::VERSION GEM_DEPENDENCIES = [["data_objects", GEM_VERSION]] clean = %w(o bundle log a gem dSYM obj pdb lib def exp DS_Store) unless ENV["WINDOWS"] clean << "so" GEM_EXTRAS = { :extensions => %w[ ext/extconf.rb ], :has_rdoc => false } else GEM_EXTRAS = {} end GEM_CLEAN = ["**/*.{#{clean.join(",")}}", 'ext/Makefile'] PROJECT_NAME = "dorb" PROJECT_URL = "http://rubyforge.org/projects/dorb" PROJECT_DESCRIPTION = PROJECT_SUMMARY = "A DataObject.rb driver for Sqlite3" DRIVER = true require ROOT.parent + 'tasks/hoe' # Installation task :install => [ :package ] do sh %{#{SUDO} gem install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources}, :verbose => false end desc "Uninstall #{GEM_NAME} #{GEM_VERSION} (default ruby)" task :uninstall => [ :clobber ] do sh "#{SUDO} gem uninstall #{GEM_NAME} -v#{GEM_VERSION} -I -x", :verbose => false end desc 'Run specifications' Spec::Rake::SpecTask.new(:spec) do |t| t.spec_opts << '--format' << 'specdoc' << '--colour' t.spec_opts << '--loadby' << 'random' t.spec_files = Pathname.glob(ENV['FILES'] || 'spec/**/*_spec.rb') begin t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true t.rcov_opts << '--exclude' << 'spec' t.rcov_opts << '--text-summary' t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse' rescue Exception # rcov not installed end end namespace :ci do task :prepare do rm_rf ROOT + "ci" mkdir_p ROOT + "ci" mkdir_p ROOT + "ci/doc" mkdir_p ROOT + "ci/cyclomatic" mkdir_p ROOT + "ci/token" end task :publish do out = ENV['CC_BUILD_ARTIFACTS'] || "out" mkdir_p out unless File.directory? out mv "ci/rspec_report.html", "#{out}/rspec_report.html" mv "ci/coverage", "#{out}/coverage" end task :spec => :prepare do Rake::Task[:spec].invoke mv ROOT + "coverage", ROOT + "ci/coverage" end end task :ci => ["ci:spec"]