require "bundler/gem_tasks" require "rspec/core/rake_task" require 'rdoc/task' require 'sqlite3' RSpec::Core::RakeTask.new(:spec) task :default => :spec 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 # desc 'generate and populate a test sqlite database' # task :testdb do # begin # db = SQLite3::Database.new "testdb" # db.execute "create table servers(id integer primary key autoincrement, hostname text not null, stype text not null, os_type text not null)" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node1', 'dev', 'rhel6')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node2', 'dev', 'rhel6')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node3', 'dev', 'rhel6')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node4', 'dev', 'rhel7')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node5', 'dev', 'rhel6')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node6', 'web', 'rhel6')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node7', 'web', 'rhel6')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node8', 'web', 'rhel7')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node9', 'web', 'rhel7')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node10', 'admin', 'ubuntu-LTS')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node11', 'admin', 'ubuntu-LTS')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node12', 'admin', 'ubuntu')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node13', 'admin', 'ubuntu')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node14', 'compute', 'debiuan')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node15', 'compute', 'debiuan')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node16', 'compute', 'debiuan')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node17', 'compute', 'debiuan')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node18', 'db', 'slackware')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node19', 'db', 'slackware')" # db.execute "INSERT INTO servers (hostname, stype, os_type) VALUES ( 'node20', 'db', 'slackware')" # rescue SQLite3::Exception => e # puts "Exception occurred" # puts e # ensure # db.close if db # end # end