Skip to content

Commit

Permalink
Tentative Rails 3.0 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
pat committed Jan 25, 2012
1 parent ec4bba9 commit bfd507f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion combustion.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ['lib']

s.add_runtime_dependency 'rails', '>= 3.1.0'
s.add_runtime_dependency 'rails', '>= 3.0.0'
s.add_runtime_dependency 'thor', '>= 0.14.6'
end
4 changes: 3 additions & 1 deletion lib/combustion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def self.initialize!(*modules)
include_capybara_into config

config.include(Combustion::Application.routes.url_helpers)
config.include(Combustion::Application.routes.mounted_helpers)
if Combustion::Application.routes.respond_to?(:mounted_helpers)
config.include(Combustion::Application.routes.mounted_helpers)
end
end if defined?(RSpec) && RSpec.respond_to?(:configure)
end

Expand Down
22 changes: 21 additions & 1 deletion lib/combustion/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def self.reset_database
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.recreate_database(abcs['test']['database'],
mysql_creation_options(abcs['test']))
ActiveRecord::Base.establish_connection(:test)
when /postgresql/
ActiveRecord::Base.clear_active_connections!
drop_database(abcs['test'])
Expand Down Expand Up @@ -45,6 +46,25 @@ def self.load_schema
end

def self.migrate
ActiveRecord::Migrator.migrate ActiveRecord::Migrator.migrations_paths, nil
migrator = ActiveRecord::Migrator
paths = 'db/migrate/'

if migrator.respond_to?(:migrations_paths)
paths = migrator.migrations_paths
end

migrator.migrate paths, nil
end

private

def self.mysql_creation_options(config)
@charset = ENV['CHARSET'] || 'utf8'
@collation = ENV['COLLATION'] || 'utf8_unicode_ci'

{
:charset => (config['charset'] || @charset),
:collation => (config['collation'] || @collation)
}
end
end

0 comments on commit bfd507f

Please sign in to comment.