Skip to content

Commit

Permalink
Make compatible with 3.2.x and 4.x and add travis CI tests for both
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-za committed Aug 7, 2013
1 parent 2211809 commit 9ddd6f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ rvm:
- 2.0.0
- 1.9.3
- rbx-19mode
env:
- "RAILS_VERSION=~> 3.2"
- "RAILS_VERSION=~> 4.0"
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
source "https://rubygems.org"
gemspec

if ENV['RAILS_VERSION']
gem 'rails', ENV['RAILS_VERSION']
end

4 changes: 3 additions & 1 deletion lib/migrant/migration_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ def run
FileUtils.mkdir_p(Rails.root.join('db', 'migrate'))
@possible_irreversible_migrations = false

migrator = ActiveRecord::Migrator.open(migrations_path)
migrator = (ActiveRecord::Migrator.public_methods.include?(:open))?
ActiveRecord::Migrator.open(migrations_path) :
ActiveRecord::Migrator.new(:up, migrations_path)

unless migrator.pending_migrations.blank?
log "You have some pending database migrations. You can either:\n1. Run them with rake db:migrate\n2. Delete them, in which case this task will probably recreate their actions (DON'T do this if they've been in SCM).", :error
Expand Down

0 comments on commit 9ddd6f6

Please sign in to comment.