Rails 2.1.1
Among other things, a security fix.
This commit is contained in:
parent
d2c4c8737c
commit
d4f97345db
354 changed files with 21027 additions and 3072 deletions
32
vendor/rails/railties/lib/tasks/databases.rake
vendored
32
vendor/rails/railties/lib/tasks/databases.rake
vendored
|
@ -215,14 +215,14 @@ namespace :db do
|
|||
desc "Create a db/schema.rb file that can be portably used against any DB supported by AR"
|
||||
task :dump => :environment do
|
||||
require 'active_record/schema_dumper'
|
||||
File.open(ENV['SCHEMA'] || "db/schema.rb", "w") do |file|
|
||||
File.open(ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb", "w") do |file|
|
||||
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
|
||||
end
|
||||
end
|
||||
|
||||
desc "Load a schema.rb file into the database"
|
||||
task :load => :environment do
|
||||
file = ENV['SCHEMA'] || "db/schema.rb"
|
||||
file = ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb"
|
||||
load(file)
|
||||
end
|
||||
end
|
||||
|
@ -234,7 +234,7 @@ namespace :db do
|
|||
case abcs[RAILS_ENV]["adapter"]
|
||||
when "mysql", "oci", "oracle"
|
||||
ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
|
||||
File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
||||
File.open("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
||||
when "postgresql"
|
||||
ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
|
||||
ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"]
|
||||
|
@ -252,25 +252,27 @@ namespace :db do
|
|||
when "firebird"
|
||||
set_firebird_env(abcs[RAILS_ENV])
|
||||
db_string = firebird_db_string(abcs[RAILS_ENV])
|
||||
sh "isql -a #{db_string} > db/#{RAILS_ENV}_structure.sql"
|
||||
sh "isql -a #{db_string} > #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql"
|
||||
else
|
||||
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
|
||||
end
|
||||
|
||||
if ActiveRecord::Base.connection.supports_migrations?
|
||||
File.open("db/#{RAILS_ENV}_structure.sql", "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
|
||||
File.open("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql", "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :test do
|
||||
desc "Recreate the test database from the current environment's database schema"
|
||||
task :clone => %w(db:schema:dump db:test:purge) do
|
||||
desc "Recreate the test database from the current schema.rb"
|
||||
task :load => 'db:test:purge' do
|
||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
|
||||
ActiveRecord::Schema.verbose = false
|
||||
Rake::Task["db:schema:load"].invoke
|
||||
end
|
||||
|
||||
desc "Recreate the test database from the current environment's database schema"
|
||||
task :clone => %w(db:schema:dump db:test:load)
|
||||
|
||||
desc "Recreate the test databases from the development structure"
|
||||
task :clone_structure => [ "db:structure:dump", "db:test:purge" ] do
|
||||
|
@ -279,28 +281,28 @@ namespace :db do
|
|||
when "mysql"
|
||||
ActiveRecord::Base.establish_connection(:test)
|
||||
ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
|
||||
IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
|
||||
IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
|
||||
ActiveRecord::Base.connection.execute(table)
|
||||
end
|
||||
when "postgresql"
|
||||
ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
|
||||
ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
|
||||
ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
|
||||
`psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
|
||||
`psql -U "#{abcs["test"]["username"]}" -f #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
|
||||
when "sqlite", "sqlite3"
|
||||
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
|
||||
`#{abcs["test"]["adapter"]} #{dbfile} < db/#{RAILS_ENV}_structure.sql`
|
||||
`#{abcs["test"]["adapter"]} #{dbfile} < #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql`
|
||||
when "sqlserver"
|
||||
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
|
||||
when "oci", "oracle"
|
||||
ActiveRecord::Base.establish_connection(:test)
|
||||
IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl|
|
||||
IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl|
|
||||
ActiveRecord::Base.connection.execute(ddl)
|
||||
end
|
||||
when "firebird"
|
||||
set_firebird_env(abcs["test"])
|
||||
db_string = firebird_db_string(abcs["test"])
|
||||
sh "isql -i db/#{RAILS_ENV}_structure.sql #{db_string}"
|
||||
sh "isql -i #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql #{db_string}"
|
||||
else
|
||||
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
|
||||
end
|
||||
|
@ -337,10 +339,10 @@ namespace :db do
|
|||
end
|
||||
end
|
||||
|
||||
desc 'Prepare the test database and load the schema'
|
||||
task :prepare => %w(environment db:abort_if_pending_migrations) do
|
||||
desc 'Check for pending migrations and load the test schema'
|
||||
task :prepare => 'db:abort_if_pending_migrations' do
|
||||
if defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank?
|
||||
Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:clone" }[ActiveRecord::Base.schema_format]].invoke
|
||||
Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:load" }[ActiveRecord::Base.schema_format]].invoke
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace :doc do
|
||||
desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb"
|
||||
desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""
|
||||
Rake::RDocTask.new("app") { |rdoc|
|
||||
rdoc.rdoc_dir = 'doc/app'
|
||||
rdoc.template = ENV['template'] if ENV['template']
|
||||
rdoc.title = "Rails Application Documentation"
|
||||
rdoc.title = ENV['title'] || "Rails Application Documentation"
|
||||
rdoc.options << '--line-numbers' << '--inline-source'
|
||||
rdoc.options << '--charset' << 'utf-8'
|
||||
rdoc.rdoc_files.include('doc/README_FOR_APP')
|
||||
|
|
2
vendor/rails/railties/lib/tasks/misc.rake
vendored
2
vendor/rails/railties/lib/tasks/misc.rake
vendored
|
@ -44,7 +44,7 @@ namespace :time do
|
|||
end
|
||||
end
|
||||
previous_offset = nil
|
||||
TimeZone.__send__(method).each do |zone|
|
||||
ActiveSupport::TimeZone.__send__(method).each do |zone|
|
||||
if offset.nil? || offset == zone.utc_offset
|
||||
puts "\n* UTC #{zone.formatted_offset} *" unless zone.utc_offset == previous_offset
|
||||
puts zone.name
|
||||
|
|
2
vendor/rails/railties/lib/tasks/rails.rb
vendored
2
vendor/rails/railties/lib/tasks/rails.rb
vendored
|
@ -4,5 +4,5 @@ $VERBOSE = nil
|
|||
Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext }
|
||||
|
||||
# Load any custom rakefile extensions
|
||||
Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
|
||||
Dir["#{RAILS_ROOT}/vendor/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext }
|
||||
Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue