public
Description: Tracks is a GTD(TM) web application, built with Ruby on Rails
Homepage: http://www.rousette.org.uk/projects/
Clone URL: git://github.com/bsag/tracks.git
Click here to lend your support to: tracks and make a donation at www.pledgie.com !
tracks / vendor / plugins / scenarios / tasks / scenario.rake
100644 19 lines (19 sloc) 0.65 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
namespace :db do
  namespace :scenario do
    desc "Load a scenario into the current environment's database using SCENARIO=scenario_name"
    task :load => 'db:reset' do
      scenario_name = ENV['SCENARIO'] || 'default'
      begin
        klass = Scenarios.load(scenario_name)
        puts "Loaded #{klass.name.underscore.gsub('_', ' ')}."
      rescue Scenarios::NameError => e
        if scenario_name == 'default'
          puts "Error! Set the SCENARIO environment variable or define a DefaultScenario class."
        else
          puts "Error! Invalid scenario name [#{scenario_name}]."
        end
        exit(1)
      end
    end
  end
end