]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/composite_primary_keys-1.1.0/tasks/activerecord_selection.rake
Patch composite_primary_keys to work around issue when one component of
[rails.git] / vendor / gems / composite_primary_keys-1.1.0 / tasks / activerecord_selection.rake
1 namespace :ar do
2   desc 'Pre-load edge rails ActiveRecord'
3   task :edge do
4     unless path = ENV['EDGE_RAILS_DIR'] || ENV['EDGE_RAILS']
5       puts <<-EOS
6
7 Need to define env var EDGE_RAILS_DIR or EDGE_RAILS- root of edge rails on your machine.
8     i)  Get copy of Edge Rails - http://dev.rubyonrails.org
9     ii) Set EDGE_RAILS_DIR to this folder in local/paths.rb - see local/paths.rb.sample for example
10     or
11     a)  Set folder from environment or command line (rake ar:edge EDGE_RAILS_DIR=/path/to/rails)
12   
13       EOS
14       exit
15     end
16     
17     ENV['AR_LOAD_PATH'] = File.join(path, "activerecord/lib")
18   end
19   
20   desc 'Pre-load ActiveRecord using VERSION=X.Y.Z, instead of latest'
21   task :set do
22     unless version = ENV['VERSION']
23       puts <<-EOS
24 Usage: rake ar:get_version VERSION=1.15.3
25     Specify the version number with VERSION=X.Y.Z; and make sure you have that activerecord gem version installed.
26     
27       EOS
28     end
29     version = nil if version == "" || version == []
30     begin
31       version ? gem('activerecord', version) : gem('activerecord')
32       require 'active_record'
33       ENV['AR_LOAD_PATH'] = $:.reverse.find { |path| /activerecord/ =~ path }
34     rescue LoadError
35       puts <<-EOS
36 Missing: Cannot find activerecord #{version} installed.
37     Install: gem install activerecord -v #{version}
38     
39       EOS
40       exit
41     end
42   end
43 end