Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord 4.0.0.beta1 support #73

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
@@ -1,8 +1,8 @@
source :rubygems

gem 'rake'
gem 'activerecord', ENV['AR'] || '~>3.2.11'
gem 'railties', ENV['AR'] || '~>3.2.11'
gem 'activerecord', ENV['AR'] || '~> 4.0.0.beta1'
gem 'railties', ENV['AR'] || '~> 4.0.0.beta1'

group :dev do
gem 'sqlite3'
Expand Down
108 changes: 50 additions & 58 deletions Gemfile.lock
@@ -1,83 +1,75 @@
GEM
remote: http://rubygems.org/
specs:
actionpack (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
actionpack (4.0.0.beta1)
activesupport (= 4.0.0.beta1)
builder (~> 3.1.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
activerecord (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.4)
diff-lcs (1.1.3)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.0.beta1)
activesupport (= 4.0.0.beta1)
builder (~> 3.1.0)
activerecord (4.0.0.beta1)
activemodel (= 4.0.0.beta1)
activerecord-deprecated_finders (~> 0.0.3)
activesupport (= 4.0.0.beta1)
arel (~> 4.0.0.beta1)
activerecord-deprecated_finders (0.0.3)
activesupport (4.0.0.beta1)
i18n (~> 0.6.2)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.33)
arel (4.0.0.beta1)
atomic (1.0.1)
builder (3.1.4)
diff-lcs (1.2.1)
erubis (2.7.0)
git (1.2.5)
hike (1.2.1)
i18n (0.6.1)
jeweler (1.6.4)
i18n (0.6.2)
jeweler (1.8.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
journey (1.0.4)
json (1.7.6)
multi_json (1.5.0)
rack (1.4.4)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rdoc
json (1.7.7)
minitest (4.6.1)
multi_json (1.6.1)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
rack-ssl (~> 1.3.2)
railties (4.0.0.beta1)
actionpack (= 4.0.0.beta1)
activesupport (= 4.0.0.beta1)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rdoc (3.12)
thor (>= 0.17.0, < 2.0)
rake (10.0.3)
rdoc (3.12.2)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.0)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
sqlite3 (1.3.7)
thor (0.17.0)
tilt (1.3.3)
thread_safe (0.1.0)
atomic
tzinfo (0.3.35)

PLATFORMS
ruby

DEPENDENCIES
activerecord (~> 3.2.11)
activerecord (~> 4.0.0.beta1)
jeweler
railties (~> 3.2.11)
railties (~> 4.0.0.beta1)
rake
rspec (~> 2)
sqlite3
8 changes: 4 additions & 4 deletions lib/standalone_migrations.rb
@@ -1,6 +1,10 @@
lib_path = File.expand_path("../", __FILE__)
$:.unshift lib_path unless $:.include?(lib_path)

if !ENV["RAILS_ENV"]
ENV["RAILS_ENV"] = ENV["DB"] || ENV["RACK_ENV"] || "development"
end

require "rubygems"
require "rails"
require "active_record"
Expand All @@ -13,7 +17,3 @@

require "standalone_migrations/minimal_railtie_config"
require "standalone_migrations/tasks"

if !ENV["RAILS_ENV"]
ENV["RAILS_ENV"] = ENV["DB"] || ENV["RACK_ENV"] || Rails.env || "development"
end
33 changes: 19 additions & 14 deletions spec/standalone_migrations_spec.rb
Expand Up @@ -31,8 +31,7 @@ def make_migration(name, options={})
task_name = options[:task_name] || 'db:new_migration'
migration = run("rake #{task_name} name=#{name}").match(%r{db/migrate/\d+.*.rb})[0]
content = read(migration)
content.sub!(/def down.*?\send/m, "def down;puts 'DOWN-#{name}';end")
content.sub!(/def up.*?\send/m, "def up;puts 'UP-#{name}';end")
content.sub!(/def change.*?\send/m, "def change; reversible {|dir| dir.up{ puts 'UP-#{name}' }; dir.down{ puts 'DOWN-#{name}'}}; end")
write(migration, content)
migration.match(/\d{14}/)[0]
end
Expand All @@ -53,23 +52,29 @@ def write_multiple_migrations
write_rakefile %{t.migrations = "db/migrations", "db/migrations2"}
write "db/migrate/20100509095815_create_tests.rb", <<-TXT
class CreateTests < ActiveRecord::Migration
def up
puts "UP-CreateTests"
end

def down
puts "DOWN-CreateTests"
def change
reversible { |dir|
dir.up {
puts "UP-CreateTests"
}
dir.down{
puts "DOWN-CreateTests"
}
}
end
end
TXT
write "db/migrate/20100509095816_create_tests2.rb", <<-TXT
class CreateTests2 < ActiveRecord::Migration
def up
puts "UP-CreateTests2"
end

def down
puts "DOWN-CreateTests2"
def change
reversible { |dir|
dir.up {
puts "UP-CreateTests2"
}
dir.down{
puts "DOWN-CreateTests2"
}
}
end
end
TXT
Expand Down
16 changes: 8 additions & 8 deletions standalone_migrations.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Todd Huss", "Michael Grosser"]
s.date = "2013-02-25"
s.date = "2013-02-27"
s.email = "thuss@gabrito.com"
s.extra_rdoc_files = [
"README.markdown"
Expand Down Expand Up @@ -46,25 +46,25 @@ Gem::Specification.new do |s|
]
s.homepage = "http://github.com/thuss/standalone-migrations"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.24"
s.rubygems_version = "1.8.23"
s.summary = "A thin wrapper to use Rails Migrations in non Rails projects"

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rake>, [">= 0"])
s.add_runtime_dependency(%q<activerecord>, ["~> 3.2.11"])
s.add_runtime_dependency(%q<railties>, ["~> 3.2.11"])
s.add_runtime_dependency(%q<activerecord>, ["~> 4.0.0.beta1"])
s.add_runtime_dependency(%q<railties>, ["~> 4.0.0.beta1"])
else
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<activerecord>, ["~> 3.2.11"])
s.add_dependency(%q<railties>, ["~> 3.2.11"])
s.add_dependency(%q<activerecord>, ["~> 4.0.0.beta1"])
s.add_dependency(%q<railties>, ["~> 4.0.0.beta1"])
end
else
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<activerecord>, ["~> 3.2.11"])
s.add_dependency(%q<railties>, ["~> 3.2.11"])
s.add_dependency(%q<activerecord>, ["~> 4.0.0.beta1"])
s.add_dependency(%q<railties>, ["~> 4.0.0.beta1"])
end
end