Sha256: f69699810ed865bf085922793014dd1d315e1ceaee27bc876a5bbcc630082ed9

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require 'rubygems'
require 'rake'

def run_with_output(command)
  puts "Running: #{command}"
  
  Process.wait( fork { exec command } )

  $?.success?
end

def set_rails_version(rails_vers)
  unless File.exists?("Gemfile_Rails_#{rails_vers}.lock")
    run_with_output "export RAILS_VERS=#{rails_vers}; bundle update"
    run_with_output "cp Gemfile.lock Gemfile_Rails_#{rails_vers}.lock"
  else
    run_with_output "rm Gemfile.lock"
    run_with_output "cp Gemfile_Rails_#{rails_vers}.lock Gemfile.lock"    
  end
end

@rails_versions = ['3.0', '3.1', '3.2']

task :default => :test_all

desc 'Test each session store against Rails 3.0 and Rails 3.1'
task :test_all do
  # inspired by http://pivotallabs.com/users/jdean/blog/articles/1728-testing-your-gem-against-multiple-rubies-and-rails-versions-with-rvm
  
  orms = ['mongo_mapper', 'mongoid', 'mongo']

  @failed_suites = []

  @rails_versions.each do |rails_version|

    set_rails_version(rails_version)
  
    orms.each do |orm|
      unless run_with_output "export MONGO_SESSION_STORE_ORM=#{orm}; bundle exec rspec spec"
        @failed_suites << "Rails #{rails_version} / #{orm}"
      end
    end
  end

  if @failed_suites.any?
    puts "\033[0;31mFailed:"
    puts @failed_suites.join("\n")
    print "\033[0m"
    exit(1)
  else
    print "\033[0;32mAll passed! Success! "
    "Yahoooo!!!".chars.each { |c| sleep 0.4; print c; STDOUT.flush }
    puts "\033[0m"
  end
end



@rails_versions.each do |rails_version|

  desc "Set Rails version to #{rails_version}"
  task :"use_rails_#{rails_version.gsub('.', '')}" do
    set_rails_version(rails_version)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongo_session_store-rails3-3.0.6 Rakefile
mongo_session_store-rails3-3.0.5 Rakefile
mongo_session_store-rails3-3.0.4 Rakefile