standalone_migrations 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +9 -0
- data/VERSION +1 -1
- data/lib/tasks/standalone_migrations.rb +158 -124
- data/spec/standalone_migrations_spec.rb +146 -46
- data/standalone_migrations.gemspec +1 -1
- metadata +14 -5
data/README.markdown
CHANGED
@@ -8,6 +8,15 @@ Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install mysql`) the
|
|
8
8
|
Add to `Rakefile` in your projects base directory:
|
9
9
|
begin
|
10
10
|
require 'tasks/standalone_migrations'
|
11
|
+
MigratorTasks.new do |t|
|
12
|
+
# t.migrations = "db/migrations"
|
13
|
+
# t.config = "db/config.yml"
|
14
|
+
# t.schema = "db/schema.rb"
|
15
|
+
# t.env = "DB"
|
16
|
+
# t.default_env = "development"
|
17
|
+
# t.verbose = true
|
18
|
+
# t.log_level = Logger::ERROR
|
19
|
+
end
|
11
20
|
rescue LoadError => e
|
12
21
|
puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: #{e})"
|
13
22
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -1,137 +1,169 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'logger'
|
4
4
|
|
5
|
-
|
6
|
-
:base
|
7
|
-
:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(options[:config])).result)
|
27
|
-
ActiveRecord::Base.establish_connection(ENV[options[:env]])
|
28
|
-
logger = Logger.new $stderr
|
29
|
-
logger.level = Logger::INFO
|
30
|
-
ActiveRecord::Base.logger = logger
|
5
|
+
class MigratorTasks < ::Rake::TaskLib
|
6
|
+
attr_accessor :name, :base, :vendor, :config, :schema, :env, :default_env, :verbose, :log_level
|
7
|
+
attr_reader :migrations
|
8
|
+
|
9
|
+
def initialize(name = :migrator)
|
10
|
+
@name = name
|
11
|
+
base = File.expand_path('.')
|
12
|
+
here = File.expand_path(File.dirname(File.dirname(File.dirname((__FILE__)))))
|
13
|
+
@base = base
|
14
|
+
@vendor = "#{here}/vendor"
|
15
|
+
@migrations = ["#{base}/db/migrations"]
|
16
|
+
@config = "#{base}/db/config.yml"
|
17
|
+
@schema = "#{base}/db/schema.rb"
|
18
|
+
@env = 'DB'
|
19
|
+
@default_env = 'development'
|
20
|
+
@verbose = true
|
21
|
+
@log_level = Logger::ERROR
|
22
|
+
yield self if block_given?
|
23
|
+
# Add to load_path every "lib/" directory in vendor
|
24
|
+
Dir["#{vendor}/**/lib"].each{|p| $LOAD_PATH << p }
|
25
|
+
define
|
31
26
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
require "#{options[:vendor]}/migration_helpers/init"
|
36
|
-
ActiveRecord::Migration.verbose = (ENV["VERBOSE"] == "true")
|
37
|
-
ActiveRecord::Migrator.migrate(options[:migrations], ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
|
38
|
-
Rake::Task["db:schema:dump"].execute
|
27
|
+
|
28
|
+
def migrations=(*value)
|
29
|
+
@migrations = value.flatten
|
39
30
|
end
|
31
|
+
|
32
|
+
def define
|
33
|
+
namespace :db do
|
34
|
+
task :ar_init do
|
35
|
+
require 'active_record'
|
36
|
+
ENV[@env] ||= @default_env
|
37
|
+
|
38
|
+
require 'erb'
|
39
|
+
ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(@config)).result)
|
40
|
+
ActiveRecord::Base.establish_connection(ENV[@env])
|
41
|
+
logger = Logger.new $stderr
|
42
|
+
logger.level = @log_level
|
43
|
+
ActiveRecord::Base.logger = logger
|
44
|
+
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
desc "Migrate the database using the scripts in the migrations directory. Target specific version with VERSION=x. Turn off output with VERBOSE=false."
|
47
|
+
task :migrate => :ar_init do
|
48
|
+
require "#{@vendor}/migration_helpers/init"
|
49
|
+
ActiveRecord::Migration.verbose = ENV['VERBOSE'] || @verbose
|
50
|
+
@migrations.each do |path|
|
51
|
+
ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
|
52
|
+
end
|
48
53
|
Rake::Task["db:schema:dump"].execute
|
49
54
|
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Raises an error if there are pending migrations"
|
54
|
-
task :abort_if_pending_migrations => :ar_init do
|
55
|
-
pending_migrations = ActiveRecord::Migrator.new(:up, options[:migrations]).pending_migrations
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
namespace :migrate do
|
57
|
+
[:up, :down].each do |direction|
|
58
|
+
desc "Runs the '#{direction}' for a given migration VERSION."
|
59
|
+
task direction => :ar_init do
|
60
|
+
ActiveRecord::Migration.verbose = @verbose
|
61
|
+
version = ENV["VERSION"].to_i
|
62
|
+
raise "VERSION is required (must be a number)" if version == 0
|
63
|
+
migration_path = nil
|
64
|
+
if @migrations.length == 1
|
65
|
+
migration_path = @migrations.first
|
66
|
+
else
|
67
|
+
@migrations.each do |path|
|
68
|
+
Dir[File.join(path, '*.rb')].each do |file|
|
69
|
+
if File.basename(file).match(/^\d+/)[0] == version.to_s
|
70
|
+
migration_path = path
|
71
|
+
break
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
raise "Migration #{version} wasn't found on paths #{@migrations.join(', ')}" if migration_path.nil?
|
76
|
+
end
|
77
|
+
ActiveRecord::Migrator.run(direction, migration_path, version)
|
78
|
+
Rake::Task["db:schema:dump"].execute
|
79
|
+
end
|
80
|
+
end
|
61
81
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
82
|
+
|
83
|
+
desc "Raises an error if there are pending migrations"
|
84
|
+
task :abort_if_pending_migrations => :ar_init do
|
85
|
+
@migrations.each do |path|
|
86
|
+
pending_migrations = ActiveRecord::Migrator.new(:up, path).pending_migrations
|
87
|
+
|
88
|
+
if pending_migrations.any?
|
89
|
+
puts "You have #{pending_migrations.size} pending migrations:"
|
90
|
+
pending_migrations.each do |pending_migration|
|
91
|
+
puts ' %4d %s' % [pending_migration.version, pending_migration.name]
|
92
|
+
end
|
93
|
+
abort %{Run "rake db:migrate" to update your database then try again.}
|
94
|
+
end
|
95
|
+
end
|
72
96
|
end
|
73
|
-
end
|
74
97
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
desc "Recreate the test database from the current schema.rb"
|
84
|
-
task :load => ['db:ar_init', 'db:test:purge'] do
|
85
|
-
ActiveRecord::Base.establish_connection(:test)
|
86
|
-
ActiveRecord::Schema.verbose = false
|
87
|
-
Rake::Task["db:schema:load"].invoke
|
88
|
-
end
|
98
|
+
namespace :schema do
|
99
|
+
desc "Create schema.rb file that can be portably used against any DB supported by AR"
|
100
|
+
task :dump => :ar_init do
|
101
|
+
require 'active_record/schema_dumper'
|
102
|
+
File.open(ENV['SCHEMA'] || @schema, "w") do |file|
|
103
|
+
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
|
104
|
+
end
|
105
|
+
end
|
89
106
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
when "mysql"
|
95
|
-
ActiveRecord::Base.establish_connection(:test)
|
96
|
-
ActiveRecord::Base.connection.recreate_database(config["database"], config)
|
97
|
-
when "postgresql" #TODO i doubt this will work <-> methods are not defined
|
98
|
-
ActiveRecord::Base.clear_active_connections!
|
99
|
-
drop_database(config)
|
100
|
-
create_database(config)
|
101
|
-
when "sqlite", "sqlite3"
|
102
|
-
db_file = config["database"] || config["dbfile"]
|
103
|
-
File.delete(db_file) if File.exist?(db_file)
|
104
|
-
when "sqlserver"
|
105
|
-
drop_script = "#{config["host"]}.#{config["database"]}.DP1".gsub(/\\/,'-')
|
106
|
-
`osql -E -S #{config["host"]} -d #{config["database"]} -i db\\#{drop_script}`
|
107
|
-
`osql -E -S #{config["host"]} -d #{config["database"]} -i db\\test_structure.sql`
|
108
|
-
when "oci", "oracle"
|
109
|
-
ActiveRecord::Base.establish_connection(:test)
|
110
|
-
ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl|
|
111
|
-
ActiveRecord::Base.connection.execute(ddl)
|
107
|
+
desc "Load a ar_schema.rb file into the database"
|
108
|
+
task :load => :ar_init do
|
109
|
+
file = ENV['SCHEMA'] || @schema
|
110
|
+
load(file)
|
112
111
|
end
|
113
|
-
when "firebird"
|
114
|
-
ActiveRecord::Base.establish_connection(:test)
|
115
|
-
ActiveRecord::Base.connection.recreate_database!
|
116
|
-
else
|
117
|
-
raise "Task not supported by #{config["adapter"].inspect}"
|
118
112
|
end
|
119
|
-
|
113
|
+
|
114
|
+
namespace :test do
|
115
|
+
desc "Recreate the test database from the current schema.rb"
|
116
|
+
task :load => ['db:ar_init', 'db:test:purge'] do
|
117
|
+
ActiveRecord::Base.establish_connection(:test)
|
118
|
+
ActiveRecord::Schema.verbose = false
|
119
|
+
Rake::Task["db:schema:load"].invoke
|
120
|
+
end
|
121
|
+
|
122
|
+
desc "Empty the test database"
|
123
|
+
task :purge => 'db:ar_init' do
|
124
|
+
config = ActiveRecord::Base.configurations['test']
|
125
|
+
case config["adapter"]
|
126
|
+
when "mysql"
|
127
|
+
ActiveRecord::Base.establish_connection(:test)
|
128
|
+
ActiveRecord::Base.connection.recreate_database(config["database"], config)
|
129
|
+
when "postgresql" #TODO i doubt this will work <-> methods are not defined
|
130
|
+
ActiveRecord::Base.clear_active_connections!
|
131
|
+
drop_database(config)
|
132
|
+
create_database(config)
|
133
|
+
when "sqlite", "sqlite3"
|
134
|
+
db_file = config["database"] || config["dbfile"]
|
135
|
+
File.delete(db_file) if File.exist?(db_file)
|
136
|
+
when "sqlserver"
|
137
|
+
drop_script = "#{config["host"]}.#{config["database"]}.DP1".gsub(/\\/,'-')
|
138
|
+
`osql -E -S #{config["host"]} -d #{config["database"]} -i db\\#{drop_script}`
|
139
|
+
`osql -E -S #{config["host"]} -d #{config["database"]} -i db\\test_structure.sql`
|
140
|
+
when "oci", "oracle"
|
141
|
+
ActiveRecord::Base.establish_connection(:test)
|
142
|
+
ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl|
|
143
|
+
ActiveRecord::Base.connection.execute(ddl)
|
144
|
+
end
|
145
|
+
when "firebird"
|
146
|
+
ActiveRecord::Base.establish_connection(:test)
|
147
|
+
ActiveRecord::Base.connection.recreate_database!
|
148
|
+
else
|
149
|
+
raise "Task not supported by #{config["adapter"].inspect}"
|
150
|
+
end
|
151
|
+
end
|
120
152
|
|
121
|
-
|
122
|
-
|
123
|
-
|
153
|
+
desc 'Check for pending migrations and load the test schema'
|
154
|
+
task :prepare => ['db:abort_if_pending_migrations', 'db:test:load']
|
155
|
+
end
|
124
156
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
157
|
+
desc "Create a new migration"
|
158
|
+
task :new_migration do |t|
|
159
|
+
unless migration = ENV['name']
|
160
|
+
puts "Error: must provide name of migration to generate."
|
161
|
+
puts "For example: rake #{t.name} name=add_field_to_form"
|
162
|
+
abort
|
163
|
+
end
|
132
164
|
|
133
|
-
|
134
|
-
|
165
|
+
class_name = migration.split('_').map{|s| s.capitalize }.join
|
166
|
+
file_contents = <<eof
|
135
167
|
class #{class_name} < ActiveRecord::Migration
|
136
168
|
def self.up
|
137
169
|
end
|
@@ -141,12 +173,14 @@ class #{class_name} < ActiveRecord::Migration
|
|
141
173
|
end
|
142
174
|
end
|
143
175
|
eof
|
176
|
+
migration_path = @migrations.first
|
177
|
+
FileUtils.mkdir_p(migration_path) unless File.exist?(migration_path)
|
178
|
+
file_name = "#{migration_path}/#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{migration}.rb"
|
144
179
|
|
145
|
-
|
146
|
-
file_name = "#{options[:migrations]}/#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{migration}.rb"
|
180
|
+
File.open(file_name, 'w'){|f| f.write file_contents }
|
147
181
|
|
148
|
-
|
149
|
-
|
150
|
-
|
182
|
+
puts "Created migration #{file_name}"
|
183
|
+
end
|
184
|
+
end
|
151
185
|
end
|
152
|
-
end
|
186
|
+
end
|
@@ -32,18 +32,52 @@ describe 'Standalone migrations' do
|
|
32
32
|
write(migration, content)
|
33
33
|
migration.match(/\d{14}/)[0]
|
34
34
|
end
|
35
|
-
|
36
|
-
|
37
|
-
`rm -rf spec/tmp` if File.exist?('spec/tmp')
|
38
|
-
`mkdir spec/tmp`
|
35
|
+
|
36
|
+
def write_rakefile(config=nil)
|
39
37
|
write 'Rakefile', <<-TXT
|
40
38
|
$LOAD_PATH.unshift '#{File.expand_path('lib')}'
|
41
39
|
begin
|
42
40
|
require 'tasks/standalone_migrations'
|
41
|
+
MigratorTasks.new do |t|
|
42
|
+
t.log_level = Logger::INFO
|
43
|
+
#{config}
|
44
|
+
end
|
43
45
|
rescue LoadError => e
|
44
46
|
puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: \#{e})"
|
45
47
|
end
|
46
48
|
TXT
|
49
|
+
end
|
50
|
+
|
51
|
+
def write_multiple_migrations
|
52
|
+
write_rakefile %{t.migrations = "db/migrations", "db/migrations2"}
|
53
|
+
write "db/migrations/20100509095815_create_tests.rb", <<-TXT
|
54
|
+
class CreateTests < ActiveRecord::Migration
|
55
|
+
def self.up
|
56
|
+
puts "UP-CreateTests"
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.down
|
60
|
+
puts "DOWN-CreateTests"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
TXT
|
64
|
+
write "db/migrations2/20100509095816_create_tests2.rb", <<-TXT
|
65
|
+
class CreateTests2 < ActiveRecord::Migration
|
66
|
+
def self.up
|
67
|
+
puts "UP-CreateTests2"
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.down
|
71
|
+
puts "DOWN-CreateTests2"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
TXT
|
75
|
+
end
|
76
|
+
|
77
|
+
before do
|
78
|
+
`rm -rf spec/tmp` if File.exist?('spec/tmp')
|
79
|
+
`mkdir spec/tmp`
|
80
|
+
write_rakefile
|
47
81
|
write 'db/config.yml', <<-TXT
|
48
82
|
development:
|
49
83
|
adapter: sqlite3
|
@@ -55,65 +89,131 @@ describe 'Standalone migrations' do
|
|
55
89
|
end
|
56
90
|
|
57
91
|
describe 'db:new_migration' do
|
58
|
-
|
59
|
-
|
60
|
-
|
92
|
+
context "single migration path" do
|
93
|
+
it "fails if i do not add a name" do
|
94
|
+
run("rake db:new_migration").should_not =~ /SUCCESS/
|
95
|
+
end
|
61
96
|
|
62
|
-
|
63
|
-
|
64
|
-
|
97
|
+
it "generates a new migration with this name and timestamp" do
|
98
|
+
run("rake db:new_migration name=test_abc").should =~ %r{Created migration .*spec/tmp/db/migrations/\d+_test_abc\.rb}
|
99
|
+
run("ls db/migrations").should =~ /^\d+_test_abc.rb$/
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "multiple migration paths" do
|
104
|
+
before do
|
105
|
+
write_rakefile %{t.migrations = "db/migrations", "db/migrations2"}
|
106
|
+
end
|
107
|
+
it "chooses the first path" do
|
108
|
+
run("rake db:new_migration name=test_abc").should =~ %r{Created migration .*db/migrations/\d+_test_abc\.rb}
|
109
|
+
end
|
65
110
|
end
|
66
111
|
end
|
67
112
|
|
68
113
|
describe 'db:migrate' do
|
69
|
-
|
70
|
-
|
71
|
-
|
114
|
+
context "single migration path" do
|
115
|
+
it "does nothing when no migrations are present" do
|
116
|
+
run("rake db:migrate").should =~ /SUCCESS/
|
117
|
+
end
|
72
118
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
119
|
+
it "migrates if i add a migration" do
|
120
|
+
run("rake db:new_migration name=xxx")
|
121
|
+
result = run("rake db:migrate")
|
122
|
+
result.should =~ /SUCCESS/
|
123
|
+
result.should =~ /Migrating to Xxx \(#{Time.now.year}/
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "multiple migration paths" do
|
128
|
+
before do
|
129
|
+
write_multiple_migrations
|
130
|
+
end
|
131
|
+
it "runs the migrator on each migration path" do
|
132
|
+
result = run("rake db:migrate")
|
133
|
+
result.should =~ /Migrating to CreateTests \(#{Time.now.year}/
|
134
|
+
result.should =~ /Migrating to CreateTests2 \(#{Time.now.year}/
|
135
|
+
end
|
78
136
|
end
|
79
137
|
end
|
80
138
|
|
81
139
|
describe 'db:migrate:down' do
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
140
|
+
context "single migration path" do
|
141
|
+
it "migrates down" do
|
142
|
+
make_migration('xxx')
|
143
|
+
sleep 1
|
144
|
+
version = make_migration('yyy')
|
145
|
+
run 'rake db:migrate'
|
87
146
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
147
|
+
result = run("rake db:migrate:down VERSION=#{version}")
|
148
|
+
result.should =~ /SUCCESS/
|
149
|
+
result.should_not =~ /DOWN-xxx/
|
150
|
+
result.should =~ /DOWN-yyy/
|
151
|
+
end
|
93
152
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
153
|
+
it "fails without version" do
|
154
|
+
make_migration('yyy')
|
155
|
+
result = run("rake db:migrate:down")
|
156
|
+
result.should_not =~ /SUCCESS/
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context "multiple migration paths" do
|
161
|
+
before do
|
162
|
+
write_multiple_migrations
|
163
|
+
end
|
164
|
+
|
165
|
+
it "runs down on the correct path" do
|
166
|
+
run 'rake db:migrate'
|
167
|
+
result = run 'rake db:migrate:down VERSION=20100509095815'
|
168
|
+
result.should =~ /DOWN-CreateTests/
|
169
|
+
result.should_not =~ /DOWN-CreateTests2/
|
170
|
+
end
|
171
|
+
|
172
|
+
it "fails if migration number isn't found" do
|
173
|
+
run 'rake db:migrate'
|
174
|
+
result = run 'rake db:migrate:down VERSION=20100509095820'
|
175
|
+
result.should_not =~ /SUCCESS/
|
176
|
+
result.should =~ /wasn't found on path/
|
177
|
+
end
|
98
178
|
end
|
99
179
|
end
|
100
180
|
|
101
181
|
describe 'db:migrate:up' do
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
182
|
+
context "single migration path" do
|
183
|
+
it "migrates up" do
|
184
|
+
make_migration('xxx')
|
185
|
+
run 'rake db:migrate'
|
186
|
+
sleep 1
|
187
|
+
version = make_migration('yyy')
|
188
|
+
result = run("rake db:migrate:up VERSION=#{version}")
|
189
|
+
result.should =~ /SUCCESS/
|
190
|
+
result.should_not =~ /UP-xxx/
|
191
|
+
result.should =~ /UP-yyy/
|
192
|
+
end
|
112
193
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
194
|
+
it "fails without version" do
|
195
|
+
make_migration('yyy')
|
196
|
+
result = run("rake db:migrate:up")
|
197
|
+
result.should_not =~ /SUCCESS/
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context "multiple migration paths" do
|
202
|
+
before do
|
203
|
+
write_multiple_migrations
|
204
|
+
end
|
205
|
+
|
206
|
+
it "runs down on the correct path" do
|
207
|
+
result = run 'rake db:migrate:up VERSION=20100509095815'
|
208
|
+
result.should =~ /UP-CreateTests/
|
209
|
+
result.should_not =~ /UP-CreateTests2/
|
210
|
+
end
|
211
|
+
|
212
|
+
it "fails if migration number isn't found" do
|
213
|
+
result = run 'rake db:migrate:up VERSION=20100509095820'
|
214
|
+
result.should_not =~ /SUCCESS/
|
215
|
+
result.should =~ /wasn't found on path/
|
216
|
+
end
|
117
217
|
end
|
118
218
|
end
|
119
219
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{standalone_migrations}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Todd Huss", "Michael Grosser"]
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standalone_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Todd Huss
|
@@ -15,16 +16,18 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-04-12 00:00:00
|
19
|
+
date: 2010-04-12 00:00:00 -10:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: rake
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
version: "0"
|
@@ -34,9 +37,11 @@ dependencies:
|
|
34
37
|
name: activerecord
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
37
41
|
requirements:
|
38
42
|
- - ">="
|
39
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
40
45
|
segments:
|
41
46
|
- 0
|
42
47
|
version: "0"
|
@@ -72,23 +77,27 @@ rdoc_options:
|
|
72
77
|
require_paths:
|
73
78
|
- lib
|
74
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
75
81
|
requirements:
|
76
82
|
- - ">="
|
77
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
78
85
|
segments:
|
79
86
|
- 0
|
80
87
|
version: "0"
|
81
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
82
90
|
requirements:
|
83
91
|
- - ">="
|
84
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
85
94
|
segments:
|
86
95
|
- 0
|
87
96
|
version: "0"
|
88
97
|
requirements: []
|
89
98
|
|
90
99
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.3.
|
100
|
+
rubygems_version: 1.3.7
|
92
101
|
signing_key:
|
93
102
|
specification_version: 3
|
94
103
|
summary: A thin wrapper to use Rails Migrations in non Rails projects
|