migration_tools 0.1.1 → 0.1.2
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/VERSION +1 -1
- data/lib/migration_tools/tasks.rb +6 -5
- data/migration_tools.gemspec +2 -2
- data/test/test_migration_tools.rb +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -11,7 +11,7 @@ module MigrationTools
|
|
11
11
|
|
12
12
|
def group
|
13
13
|
return @group if @group
|
14
|
-
|
14
|
+
|
15
15
|
@group = ENV['GROUP'].to_s
|
16
16
|
raise "Invalid group \"#{@group}\"" if !@group.empty? && !MIGRATION_GROUPS.member?(@group)
|
17
17
|
@group
|
@@ -47,14 +47,14 @@ module MigrationTools
|
|
47
47
|
namespace :db do
|
48
48
|
namespace :migrate do
|
49
49
|
desc 'Runs pending migrations for a given group'
|
50
|
-
task :group do
|
50
|
+
task :group => :environment do
|
51
51
|
if group.empty?
|
52
52
|
notify "Please specify a migration group"
|
53
53
|
elsif pending_migrations.empty?
|
54
54
|
notify "Your database schema is up to date"
|
55
55
|
else
|
56
56
|
pending_migrations.each do |migration|
|
57
|
-
migration.migrate
|
57
|
+
migration.migrate(:up)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -67,8 +67,9 @@ module MigrationTools
|
|
67
67
|
namespace :migrate do
|
68
68
|
[ :list, :group ].each do |ns|
|
69
69
|
namespace ns do
|
70
|
-
|
71
|
-
|
70
|
+
MigrationTools::MIGRATION_GROUPS.each do |migration_group|
|
71
|
+
desc "#{ns == :list ? 'Lists' : 'Executes' } the migrations for group #{migration_group}"
|
72
|
+
task migration_group => :environment do
|
72
73
|
ENV['GROUP'] = migration_group.to_s
|
73
74
|
Rake::Task["db:migrate:#{ns}"].invoke
|
74
75
|
end
|
data/migration_tools.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{migration_tools}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Morten Primdahl"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-21}
|
13
13
|
s.description = %q{Suite of task extensions for Rails 2.3 that makes managing migrations easier of more nimble}
|
14
14
|
s.email = %q{morten@zendesk.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -119,12 +119,12 @@ class TestMigrationTools < Test::Unit::TestCase
|
|
119
119
|
ENV['GROUP'] = 'before'
|
120
120
|
ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => proxies))
|
121
121
|
proxies.select { |p| p.migration_group == 'before' }.each do |p|
|
122
|
-
p.expects(:migrate).once
|
122
|
+
p.expects(:migrate).with(:up).once
|
123
123
|
end
|
124
124
|
|
125
125
|
Rake::Task["db:migrate:group"].invoke
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
def test_migrate_with_invalid_group
|
129
129
|
ENV['GROUP'] = 'drunk'
|
130
130
|
begin
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migration_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morten Primdahl
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-21 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|