migration_tools 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/Gemfile.lock +23 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +53 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/lib/migration_tools/migration_extension.rb +15 -0
- data/lib/migration_tools/tasks.rb +72 -0
- data/lib/migration_tools.rb +9 -0
- data/migration_tools.gemspec +65 -0
- data/test/helper.rb +20 -0
- data/test/test_migration_tools.rb +134 -0
- metadata +143 -0
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
gem "activerecord", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.5.1"
|
11
|
+
gem "mocha", "~> 0.9.8"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activerecord (2.3.8)
|
5
|
+
activesupport (= 2.3.8)
|
6
|
+
activesupport (2.3.8)
|
7
|
+
git (1.2.5)
|
8
|
+
jeweler (1.5.1)
|
9
|
+
bundler (~> 1.0.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rake
|
12
|
+
mocha (0.9.8)
|
13
|
+
rake
|
14
|
+
rake (0.8.7)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
activerecord (>= 2.3.5)
|
21
|
+
bundler (~> 1.0.0)
|
22
|
+
jeweler (~> 1.5.1)
|
23
|
+
mocha (~> 0.9.8)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Morten Primdahl
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
= migration_tools
|
2
|
+
|
3
|
+
This gem adds a few delicious tasks to your migration tool box.
|
4
|
+
|
5
|
+
== Groups
|
6
|
+
|
7
|
+
The migration tools allow you to specify a group in your migrations. This is used to allow you to run your migrations in groups, as opposed to all at once. This is useful if you want to run a certain group of migrations before a deploy, another group during deploy and a third group after deploy.
|
8
|
+
|
9
|
+
We use this technique to be able to QA new production code in an isolated environment that runs against the production database. It also reduces the number of moving parts come deploy time, which is helpful when you're doing zero downtime deploys.
|
10
|
+
|
11
|
+
You specify which group a migration belongs to inside the migration, like so:
|
12
|
+
|
13
|
+
class CreateHello < ActiveRecord::Migration
|
14
|
+
group :before
|
15
|
+
|
16
|
+
def self.up
|
17
|
+
...
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
The names of the possible groups are predefined to avoid turning this solution in to a generic hammer from hell. You can use the following groups: before, during, after, change. We define these as:
|
22
|
+
|
23
|
+
*before* this is for migrations that are safe to run before a deploy of new code, e.g. adding columns/tables
|
24
|
+
|
25
|
+
*during* this is for migrations that require the data structure and code to deploy "synchronously"
|
26
|
+
|
27
|
+
*after* this is for migrations that should run after the new code has been pushed and is running
|
28
|
+
|
29
|
+
*change* this is a special group that you run whenever you want to change DB data which you'd otherwise do in script/console
|
30
|
+
|
31
|
+
|
32
|
+
== Commands
|
33
|
+
|
34
|
+
$ rake db:migrate:list - shows pending migrations by group
|
35
|
+
$ GROUP=before rake db:migrate:group - runs the migrations in the "before" group
|
36
|
+
|
37
|
+
Note that rake db:migrate is entirely unaffected by this
|
38
|
+
|
39
|
+
== Contributing to migration_tools
|
40
|
+
|
41
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
42
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
43
|
+
* Fork the project
|
44
|
+
* Start a feature/bugfix branch
|
45
|
+
* Commit and push until you are happy with your contribution
|
46
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
47
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
48
|
+
|
49
|
+
== Copyright
|
50
|
+
|
51
|
+
Copyright (c) 2010 Morten Primdahl. See LICENSE.txt for
|
52
|
+
further details.
|
53
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "migration_tools"
|
16
|
+
gem.homepage = "http://github.com/morten/migration_tools"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Helpful Rails 2.3 migration tools}
|
19
|
+
gem.description = %Q{Suite of task extensions for Rails 2.3 that makes managing migrations easier of more nimble}
|
20
|
+
gem.email = "morten@zendesk.com"
|
21
|
+
gem.authors = ["Morten Primdahl"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :test
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "migration_tools #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module MigrationTools
|
2
|
+
module MigrationExtension
|
3
|
+
attr_accessor :migration_group
|
4
|
+
def group(arg = nil)
|
5
|
+
unless MigrationTools::MIGRATION_GROUPS.member?(arg.to_s)
|
6
|
+
raise "Invalid group \"#{arg.to_s}\" - valid groups are #{MigrationTools::MIGRATION_GROUPS.inspect}"
|
7
|
+
end
|
8
|
+
|
9
|
+
self.migration_group = arg.to_s
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
ActiveRecord::Migration.class_eval { extend MigrationTools::MigrationExtension }
|
15
|
+
ActiveRecord::MigrationProxy.delegate :migration_group, :to => :migration
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
module MigrationTools
|
5
|
+
class Tasks < ::Rake::TaskLib
|
6
|
+
def initialize
|
7
|
+
define_migrate_list
|
8
|
+
define_migrate_group
|
9
|
+
end
|
10
|
+
|
11
|
+
def group
|
12
|
+
return @group if @group
|
13
|
+
|
14
|
+
@group = ENV['GROUP'].to_s
|
15
|
+
raise "Invalid group \"#{@group}\"" if !@group.empty? && !MIGRATION_GROUPS.member?(@group)
|
16
|
+
@group
|
17
|
+
end
|
18
|
+
|
19
|
+
def pending_migrations
|
20
|
+
return @pending_migrations if @pending_migrations
|
21
|
+
@pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
|
22
|
+
@pending_migrations = @pending_migrations.select { |proxy| group.empty? || proxy.migration_group == group }
|
23
|
+
|
24
|
+
@pending_migrations
|
25
|
+
end
|
26
|
+
|
27
|
+
def define_migrate_list
|
28
|
+
namespace :db do
|
29
|
+
namespace :migrate do
|
30
|
+
desc 'Lists pending migrations'
|
31
|
+
task :list => :environment do
|
32
|
+
if pending_migrations.empty?
|
33
|
+
notify "Your database schema is up to date", group
|
34
|
+
else
|
35
|
+
notify "You have #{pending_migrations.size} pending migrations", group
|
36
|
+
pending_migrations.each do |migration|
|
37
|
+
notify ' %4d %s %s' % [ migration.version, migration.migration_group.to_s[0..5].center(6), migration.name ]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def define_migrate_group
|
46
|
+
namespace :db do
|
47
|
+
namespace :migrate do
|
48
|
+
desc 'Runs pending migrations for a given group'
|
49
|
+
task :group do
|
50
|
+
if group.empty?
|
51
|
+
notify "Please specify a migration group"
|
52
|
+
elsif pending_migrations.empty?
|
53
|
+
notify "Your database schema is up to date"
|
54
|
+
else
|
55
|
+
pending_migrations.each do |migration|
|
56
|
+
migration.migrate
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def notify(string, group = "")
|
65
|
+
if group.empty?
|
66
|
+
puts string
|
67
|
+
else
|
68
|
+
puts string + " for group \""+group+"\""
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{migration_tools}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Morten Primdahl"]
|
12
|
+
s.date = %q{2010-12-06}
|
13
|
+
s.description = %q{Suite of task extensions for Rails 2.3 that makes managing migrations easier of more nimble}
|
14
|
+
s.email = %q{morten@zendesk.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/migration_tools.rb",
|
27
|
+
"lib/migration_tools/migration_extension.rb",
|
28
|
+
"lib/migration_tools/tasks.rb",
|
29
|
+
"migration_tools.gemspec",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/test_migration_tools.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/morten/migration_tools}
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.7}
|
37
|
+
s.summary = %q{Helpful Rails 2.3 migration tools}
|
38
|
+
s.test_files = [
|
39
|
+
"test/helper.rb",
|
40
|
+
"test/test_migration_tools.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 2.3.5"])
|
49
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
51
|
+
s.add_development_dependency(%q<mocha>, ["~> 0.9.8"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
56
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.8"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
62
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.8"])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'test/unit'
|
13
|
+
require 'mocha'
|
14
|
+
|
15
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
16
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
17
|
+
require 'migration_tools'
|
18
|
+
|
19
|
+
class Test::Unit::TestCase
|
20
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Alpha < ActiveRecord::Migration
|
4
|
+
group :before
|
5
|
+
def self.up
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Beta < ActiveRecord::Migration
|
10
|
+
group :before
|
11
|
+
def self.up
|
12
|
+
puts "Beaver"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Delta < ActiveRecord::Migration
|
17
|
+
group :change
|
18
|
+
def self.up
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Kappa < ActiveRecord::Migration
|
23
|
+
def self.up
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class TestMigrationTools < Test::Unit::TestCase
|
28
|
+
|
29
|
+
def setup
|
30
|
+
ENV['GROUP'] = nil
|
31
|
+
Rake::Task.clear
|
32
|
+
Rake::Task.define_task(:environment)
|
33
|
+
@task = MigrationTools::Tasks.new
|
34
|
+
end
|
35
|
+
|
36
|
+
def migrations
|
37
|
+
[ Alpha, Beta, Delta, Kappa ]
|
38
|
+
end
|
39
|
+
|
40
|
+
def proxies
|
41
|
+
@proxies ||= migrations.map { |m| stub(:migration => m, :version => migrations.index(m), :name => m.name, :migration_group => m.migration_group) }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_grouping
|
45
|
+
assert_equal [ Alpha, Beta ], migrations.select { |m| m.migration_group == 'before' }
|
46
|
+
assert_equal [ Delta ], migrations.select { |m| m.migration_group == 'change' }
|
47
|
+
assert_equal [ Kappa ], migrations.select { |m| m.migration_group.nil? }
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_runtime_checking
|
51
|
+
begin
|
52
|
+
eval("class Kappa < ActiveRecord::Migration; group 'drunk'; end")
|
53
|
+
fail "You should not be able to specify custom groups"
|
54
|
+
rescue RuntimeError => e
|
55
|
+
assert e.message.index('Invalid group "drunk" - valid groups are ["before", "during", "after", "change"]')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_migration_proxy_delegation
|
60
|
+
proxy = ActiveRecord::MigrationProxy.new
|
61
|
+
proxy.expects(:migration).returns(Delta)
|
62
|
+
assert_equal "change", proxy.migration_group
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_task_presence
|
66
|
+
assert Rake::Task["db:migrate:list"]
|
67
|
+
assert Rake::Task["db:migrate:group"]
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_migrate_list_without_pending_without_group
|
71
|
+
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => []))
|
72
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with("Your database schema is up to date", "").once
|
73
|
+
|
74
|
+
Rake::Task["db:migrate:list"].invoke
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_migrate_list_without_pending_with_group
|
78
|
+
ENV['GROUP'] = 'before'
|
79
|
+
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => []))
|
80
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with("Your database schema is up to date", "before").once
|
81
|
+
|
82
|
+
Rake::Task["db:migrate:list"].invoke
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_migrate_list_with_pending_without_group
|
86
|
+
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => proxies))
|
87
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with("You have #{proxies.size} pending migrations", "").once
|
88
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with(" 0 before Alpha").once
|
89
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with(" 1 before Beta").once
|
90
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with(" 2 change Delta").once
|
91
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with(" 3 Kappa").once
|
92
|
+
|
93
|
+
Rake::Task["db:migrate:list"].invoke
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_migrate_list_with_pending_with_group
|
97
|
+
ENV['GROUP'] = 'before'
|
98
|
+
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => proxies))
|
99
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with("You have 2 pending migrations", "before").once
|
100
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with(" 0 before Alpha").once
|
101
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with(" 1 before Beta").once
|
102
|
+
|
103
|
+
Rake::Task["db:migrate:list"].invoke
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_migrate_group_with_group_without_pending
|
107
|
+
ENV['GROUP'] = 'before'
|
108
|
+
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => []))
|
109
|
+
MigrationTools::Tasks.any_instance.expects(:notify).with("Your database schema is up to date").once
|
110
|
+
|
111
|
+
Rake::Task["db:migrate:group"].invoke
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_migrate_group_with_pending
|
115
|
+
ENV['GROUP'] = 'before'
|
116
|
+
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => proxies))
|
117
|
+
proxies.select { |p| p.migration_group == 'before' }.each do |p|
|
118
|
+
p.expects(:migrate).once
|
119
|
+
end
|
120
|
+
|
121
|
+
Rake::Task["db:migrate:group"].invoke
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_migrate_with_invalid_group
|
125
|
+
ENV['GROUP'] = 'drunk'
|
126
|
+
begin
|
127
|
+
Rake::Task["db:migrate:group"].invoke
|
128
|
+
fail "Should throw an error"
|
129
|
+
rescue RuntimeError => e
|
130
|
+
assert e.message =~ /Invalid group/
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: migration_tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Morten Primdahl
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-12-06 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
24
|
+
name: activerecord
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 9
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 3
|
34
|
+
- 5
|
35
|
+
version: 2.3.5
|
36
|
+
requirement: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
type: :development
|
40
|
+
name: bundler
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 23
|
47
|
+
segments:
|
48
|
+
- 1
|
49
|
+
- 0
|
50
|
+
- 0
|
51
|
+
version: 1.0.0
|
52
|
+
requirement: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
prerelease: false
|
55
|
+
type: :development
|
56
|
+
name: jeweler
|
57
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 1
|
63
|
+
segments:
|
64
|
+
- 1
|
65
|
+
- 5
|
66
|
+
- 1
|
67
|
+
version: 1.5.1
|
68
|
+
requirement: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
prerelease: false
|
71
|
+
type: :development
|
72
|
+
name: mocha
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 43
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
- 9
|
82
|
+
- 8
|
83
|
+
version: 0.9.8
|
84
|
+
requirement: *id004
|
85
|
+
description: Suite of task extensions for Rails 2.3 that makes managing migrations easier of more nimble
|
86
|
+
email: morten@zendesk.com
|
87
|
+
executables: []
|
88
|
+
|
89
|
+
extensions: []
|
90
|
+
|
91
|
+
extra_rdoc_files:
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.rdoc
|
94
|
+
files:
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.rdoc
|
99
|
+
- Rakefile
|
100
|
+
- VERSION
|
101
|
+
- lib/migration_tools.rb
|
102
|
+
- lib/migration_tools/migration_extension.rb
|
103
|
+
- lib/migration_tools/tasks.rb
|
104
|
+
- migration_tools.gemspec
|
105
|
+
- test/helper.rb
|
106
|
+
- test/test_migration_tools.rb
|
107
|
+
has_rdoc: true
|
108
|
+
homepage: http://github.com/morten/migration_tools
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
version: "0"
|
134
|
+
requirements: []
|
135
|
+
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 1.3.7
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: Helpful Rails 2.3 migration tools
|
141
|
+
test_files:
|
142
|
+
- test/helper.rb
|
143
|
+
- test/test_migration_tools.rb
|