Sha256: a3c9e2811003629432e7fd124ce72947ff50874f3646e4de321efd0f8fb79282

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

#!/usr/bin/env rake
require "bundler/gem_tasks"

desc 'Default: Run all specs.'
task :default => 'all:spec'


namespace :travis_ci do

  desc 'Things to do before Travis CI begins'
  task :prepare => :slimgems do
    Rake::Task['travis_ci:create_database'].invoke &&
    Rake::Task['travis_ci:create_database_yml'].invoke
  end

  desc 'Install slimgems'
  task :slimgems do
    system('gem install slimgems')
  end

  desc 'Creates a test database'
  task :create_database do
    system("mysql -e 'create database secret_service_test;'")
  end

  desc 'Creates a database.yml'
  task :create_database_yml do
    config_dir = "spec/shared/app_root/config"
    system("cp #{config_dir}/database.yml.sample #{config_dir}/database.yml")
  end

end


namespace :all do

  desc "Run specs on all spec apps"
  task :spec do
    success = true
    for_each_directory_of('spec/*/Rakefile') do |directory|
      env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
      success &= system("cd #{directory} && BUNDLE_GEMFILE=./Gemfile #{env} bundle exec rake spec")
    end
    fail "Tests failed" unless success
  end

  desc "Bundle all spec apps"
  task :bundle do
    for_each_directory_of('spec/**/Gemfile') do |directory|
      system("cd #{directory} && BUNDLE_GEMFILE=./Gemfile bundle install")
    end
  end

end

def for_each_directory_of(path, &block)
  Dir[path].sort.each do |rakefile|
    directory = File.dirname(rakefile)
    puts '', "\033[44m#{directory}\033[0m", ''
    block.call(directory)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
secret_service-0.1.5 Rakefile
secret_service-0.1.4 Rakefile