Sha256: defc66904ac6f75c3ffaaf9f897e96b15a84eec274ff78651bed6caa876e0c28

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

require "rubygems"
require "rake/testtask"

task :default => :test

Rake::TestTask.new do |t|
  t.test_files = FileList['test/*_test.rb']
  t.verbose = true
end

task :clean do
  %x{rm -rf *.gem doc pkg coverage}
  %x{rm -f `find . -name '*.rbc'`}
end

task :gem do
  %x{gem build friendly_id.gemspec}
end

task :yard do
  puts %x{bundle exec yard}
end

task :bench do
  require File.expand_path("../bench", __FILE__)
end

namespace :test do

  desc "Run each test class in a separate process"
  task :isolated do
    dir = File.expand_path("../test", __FILE__)
    Dir["#{dir}/*_test.rb"].each do |test|
      puts "Running #{test}:"
      puts %x{ruby #{test}}
    end
  end
end

namespace :db do

  desc "Create the database"
  task :create do
    require File.expand_path("../test/helper", __FILE__)
    driver = FriendlyId::Test::Database.driver
    config = FriendlyId::Test::Database.config[driver]
    commands = {
      "mysql"    => "mysql -e 'create database #{config["database"]};' >/dev/null",
      "postgres" => "psql -c 'create database #{config['database']};' -U #{config['username']} >/dev/null"
    }
    %x{#{commands[driver] || true}}
  end

  desc "Create the database"
  task :drop do
    require File.expand_path("../test/helper", __FILE__)
    driver = FriendlyId::Test::Database.driver
    config = FriendlyId::Test::Database.config[driver]
    commands = {
      "mysql"    => "mysql -e 'drop database #{config["database"]};' >/dev/null",
      "postgres" => "psql -c 'drop database #{config['database']};' -U #{config['username']} >/dev/null"
    }
    %x{#{commands[driver] || true}}
  end

  desc "Set up the database schema"
  task :up do
    require File.expand_path("../test/helper", __FILE__)
    FriendlyId::Test::Schema.up
  end

  desc "Drop and recreate the database schema"
  task :reset => [:drop, :create]

end

task :doc => :yard

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
friendly_id-4.0.0.beta14 Rakefile
friendly_id-4.0.0.beta13 Rakefile
friendly_id-4.0.0.beta12 Rakefile
friendly_id-4.0.0.beta11 Rakefile
friendly_id-4.0.0.beta10 Rakefile
friendly_id-4.0.0.beta8 Rakefile
friendly_id-4.0.0.beta7 Rakefile