require "bundler/gem_tasks" require 'rdoc/task' task :default => ['test:all'] desc "Open an IRB console with this gem loaded" task :console do require 'irb' require 'irb/completion' require 'rcmd' ARGV.clear IRB.start end desc "Remove, build, and install gem" task :reinstall do puts "Uninstalling #{`gem list rcmd`}" `gem uninstall -x rcmd` Rake::Task["install"].reenable Rake::Task["install"].invoke end desc 'generate API documentation to doc/rdocs/index.html' Rake::RDocTask.new do |rd| rd.rdoc_dir = 'doc/rdocs' rd.main = 'README.md' rd.rdoc_files.include 'README.md', "lib/**/*\.rb", "exe/**/*" rd.options << '--line-numbers' rd.options << '--all' end # # RSpec tasks # begin namespace :test do require "rspec/core/rake_task" require 'sqlite3' desc 'Test Database functionality (sqlite3 required)' RSpec::Core::RakeTask.new(:db) do |t| t.rspec_opts = "--tag db" end end namespace :test do desc 'Test main rcmd lib' RSpec::Core::RakeTask.new(:mainlib) do |t| t.rspec_opts = "--tag mainlib" end end namespace :test do desc "Run all RSpec tests" RSpec::Core::RakeTask.new(:all) do |t| t.rspec_opts = "--tag mainlib --tag db" end end rescue LoadError desc 'RSpec rake task not available' task :spec do abort 'RSpec rake tasl is not available. Ensure rspec-core is installed' end ensure File.delete("testdb") if File.exist?("testdb") end