Sha256: 22eaa44cbee300ac62f797ba545ca4f94cbfbf44b1e642a201dcd35b702206d6

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

require 'rake'
require 'bundler/gem_tasks'

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


namespace :travis do
  
  desc 'Run tests on Travis CI'
  task :run => ['slimgems', 'all:bundle:install', 'all:spec']

  desc 'Install slimgems'
  task :slimgems do
    system('gem install slimgems')
  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} && #{env} bundle exec rake spec")
    end
    fail "Tests failed" unless success
  end

  namespace :bundle do

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

    desc "Update all gems, or a list of gem given by the GEM environment variable"
    task :update do
      for_each_directory_of('spec/**/Gemfile') do |directory|
        Bundler.with_clean_env do
          system("cd #{directory} && bundle update #{ENV['GEM']}")
        end
      end
    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

4 entries across 4 versions & 2 rubygems

Version Path
angular_xss-0.2.1 Rakefile
angular_xss-0.2.0 Rakefile
assignable_values-0.9.0 Rakefile
angular_xss-0.1.0 Rakefile