Permalink
Browse files

Update Rails 2.3 application testing

  • Loading branch information...
1 parent af50bb9 commit 263155c0f3d3811319229c4c19d3632939a41973 @mperham mperham committed Nov 21, 2010
Showing with 29 additions and 28 deletions.
  1. +25 −26 example23/Rakefile
  2. +4 −2 example23/config/environment.rb
View
@@ -13,28 +13,28 @@ require 'fileutils'
include FileUtils::Verbose
namespace :db do
- task :migrate do
- require 'erb'
- require 'logger'
- require 'active_record'
- reference = YAML::load(ERB.new(IO.read("config/database.yml")).result)
- env = RAILS_ENV = ENV['RAILS_ENV'] || 'development'
- ActiveRecord::Base.logger = Logger.new(STDOUT)
- ActiveRecord::Base.logger.level = Logger::WARN
- ActiveRecord::Base.configurations = reference.dup
- old_config = reference[env]
- reference.each_key do |name|
- next unless name.include? env
- next if name.include? 'slave' # Replicated databases should not be touched directly
+ task :migrate do
+ require 'erb'
+ require 'logger'
+ require 'active_record'
+ reference = YAML::load(ERB.new(IO.read("config/database.yml")).result)
+ env = RAILS_ENV = ENV['RAILS_ENV'] || 'development'
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
+ ActiveRecord::Base.logger.level = Logger::INFO
+ ActiveRecord::Base.configurations = reference.dup
+ old_config = reference[env]
+ reference.each_key do |name|
+ next unless name.include? env
+ next if name.include? 'slave' # Replicated databases should not be touched directly
- puts "Migrating #{name}"
- ActiveRecord::Base.clear_active_connections!
- ActiveRecord::Base.configurations[env] = reference[name]
- ActiveRecord::Base.establish_connection RAILS_ENV
- ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
- ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
- end
+ puts "Migrating #{name}"
+ ActiveRecord::Base.clear_active_connections!
+ ActiveRecord::Base.configurations[env] = reference[name]
+ ActiveRecord::Base.establish_connection RAILS_ENV
+ ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
+ ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
end
+ end
end
task :default => :test
@@ -50,18 +50,17 @@ namespace :app do
task :prepare => [:clean, :copy_plugin, :migrate]
task :copy_plugin do
- mkdir_p 'vendor/plugins/data_fabric'
- cp_r '../lib', 'vendor/plugins/data_fabric'
- cp '../init.rb', 'vendor/plugins/data_fabric'
+ mkdir_p 'vendor/gems/data_fabric-1.0.0'
+ cp_r '../lib', 'vendor/gems/data_fabric-1.0.0'
end
task :clean do
- rm_rf 'vendor/plugins/data_fabric'
+ rm_rf 'vendor/gems/data_fabric-1.0.0'
rm_f 'db/*.sqlite3'
end
task :migrate do
- sh "rake db:migrate"
- sh "rake RAILS_ENV=test db:migrate"
+ puts `rake db:migrate --trace`
+ puts `rake RAILS_ENV=test db:migrate`
end
end
@@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-#RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.10' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -28,6 +28,8 @@
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
+ config.gem 'data_fabric', :version => '1.0.0'
+
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
@@ -55,7 +57,7 @@
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
config.action_controller.session = {
- :key => '_example22_session',
+ :key => '_example23_session',
:secret => 'a726ae17b1f84e51e5ae5f8bc861a92dcffb188a7a1e9cb88c0c513ce9722b0983ee718c79741260669bfbc69b68044129fc11d8792b90fa912d719992cb9574'
}

0 comments on commit 263155c

Please sign in to comment.