dm-migrations 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 0.9.10 / 2009-01-19
2
+
3
+ * No changes this version
4
+
1
5
  === 0.9.9 / 2009-01-04
2
6
 
3
7
  * No changes this version
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  class Migration
3
- VERSION = '0.9.9'
3
+ VERSION = '0.9.10'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- gem 'dm-core', '~>0.9.9'
2
+ gem 'dm-core', '~>0.9.10'
3
3
  require 'dm-core'
4
4
  require 'benchmark'
5
5
  require File.dirname(__FILE__) + '/sql'
@@ -2,8 +2,6 @@ require File.dirname(__FILE__) + '/migration'
2
2
 
3
3
  module DataMapper
4
4
  module MigrationRunner
5
- @@migrations ||= []
6
-
7
5
  # Creates a new migration, and adds it to the list of migrations to be run.
8
6
  # Migrations can be defined in any order, they will be sorted and run in the
9
7
  # correct order.
@@ -42,10 +40,9 @@ module DataMapper
42
40
  # you write a migration using a model, then later change the model, there's a
43
41
  # possibility the migration will no longer work. Using SQL will always work.
44
42
  def migration( number, name, opts = {}, &block )
45
- @@migrations ||= []
46
- raise "Migration name conflict: '#{name}'" if @@migrations.map { |m| m.name }.include?(name.to_s)
43
+ raise "Migration name conflict: '#{name}'" if migrations.map { |m| m.name }.include?(name.to_s)
47
44
 
48
- @@migrations << DataMapper::Migration.new( number, name.to_s, opts, &block )
45
+ migrations << DataMapper::Migration.new( number, name.to_s, opts, &block )
49
46
  end
50
47
 
51
48
  # Run all migrations that need to be run. In most cases, this would be called by a
@@ -55,7 +52,7 @@ module DataMapper
55
52
  # has an optional argument 'level' which if supplied, only performs the migrations
56
53
  # with a position less than or equal to the level.
57
54
  def migrate_up!(level = nil)
58
- @@migrations.sort.each do |migration|
55
+ migrations.sort.each do |migration|
59
56
  if level.nil?
60
57
  migration.perform_up()
61
58
  else
@@ -69,7 +66,7 @@ module DataMapper
69
66
  # has an optional argument 'level' which, if supplied, only performs the
70
67
  # down migrations with a postion greater than the level.
71
68
  def migrate_down!(level = nil)
72
- @@migrations.sort.reverse.each do |migration|
69
+ migrations.sort.reverse.each do |migration|
73
70
  if level.nil?
74
71
  migration.perform_down()
75
72
  else
@@ -79,7 +76,7 @@ module DataMapper
79
76
  end
80
77
 
81
78
  def migrations
82
- @@migrations
79
+ @migrations ||= []
83
80
  end
84
81
 
85
82
  end
@@ -16,22 +16,22 @@ ADAPTERS.each do |adapter|
16
16
  end
17
17
 
18
18
  after(:each) do
19
- @@migrations = []
19
+ migrations.clear
20
20
  end
21
21
 
22
22
  describe '#migration' do
23
23
 
24
24
  it 'should create a new migration object, and add it to the list of migrations' do
25
- @@migrations.should be_kind_of(Array)
26
- @@migrations.should have(1).item
27
- @@migrations.first.name.should == "create_people_table"
25
+ migrations.should be_kind_of(Array)
26
+ migrations.should have(1).item
27
+ migrations.first.name.should == "create_people_table"
28
28
  end
29
29
 
30
30
  it 'should allow multiple migrations to be added' do
31
31
  migration( 2, :add_dob_to_people) { }
32
32
  migration( 2, :add_favorite_pet_to_people) { }
33
33
  migration( 3, :add_something_else_to_people) { }
34
- @@migrations.should have(4).items
34
+ migrations.should have(4).items
35
35
  end
36
36
 
37
37
  it 'should raise an error on adding with a duplicated name' do
@@ -49,14 +49,14 @@ ADAPTERS.each do |adapter|
49
49
 
50
50
  it 'calling migrate_up! should migrate up all the migrations' do
51
51
  # add our expectation that migrate_up should be called
52
- @@migrations.each do |m|
52
+ migrations.each do |m|
53
53
  m.should_receive(:perform_up)
54
54
  end
55
55
  migrate_up!
56
56
  end
57
57
 
58
58
  it 'calling migrate_up! with an arguement should only migrate to that level' do
59
- @@migrations.each do |m|
59
+ migrations.each do |m|
60
60
  if m.position <= 2
61
61
  m.should_receive(:perform_up)
62
62
  else
@@ -68,7 +68,7 @@ ADAPTERS.each do |adapter|
68
68
 
69
69
  it 'calling migrate_down! should migrate down all the migrations' do
70
70
  # add our expectation that migrate_up should be called
71
- @@migrations.each do |m|
71
+ migrations.each do |m|
72
72
  m.should_receive(:perform_down)
73
73
  end
74
74
  migrate_down!
@@ -43,7 +43,8 @@ describe "SQLite3 Extensions" do
43
43
  end
44
44
 
45
45
  it 'should initialize columns by querying the table' do
46
- SQL::Postgresql::Column.stub!(:new).and_return(@col1, @col2)
46
+ SQL::Postgresql::Column.should_receive(:new).with(@cs1).and_return(@col1)
47
+ SQL::Postgresql::Column.should_receive(:new).with(@cs2).and_return(@col2)
47
48
  @adapter.should_receive(:query_table).with('users').and_return([@cs1,@cs2])
48
49
  SQL::Postgresql::Table.new(@adapter, 'users')
49
50
  end
@@ -55,7 +56,8 @@ describe "SQLite3 Extensions" do
55
56
  end
56
57
 
57
58
  it 'should set the @columns to the looked-up columns' do
58
- SQL::Postgresql::Column.stub!(:new).and_return(@col1, @col2)
59
+ SQL::Postgresql::Column.should_receive(:new).with(@cs1).and_return(@col1)
60
+ SQL::Postgresql::Column.should_receive(:new).with(@cs2).and_return(@col2)
59
61
  t = SQL::Postgresql::Table.new(@adapter, 'users')
60
62
  t.columns.should == [@col1, @col2]
61
63
  end
@@ -53,7 +53,8 @@ describe "SQLite3 Extensions" do
53
53
  end
54
54
 
55
55
  it 'should initialize columns by querying the table' do
56
- SQL::Sqlite3::Column.stub!(:new).and_return(@col1, @col2)
56
+ SQL::Sqlite3::Column.should_receive(:new).with(@cs1).and_return(@col1)
57
+ SQL::Sqlite3::Column.should_receive(:new).with(@cs2).and_return(@col2)
57
58
  @adapter.should_receive(:query_table).with('users').and_return([@cs1,@cs2])
58
59
  SQL::Sqlite3::Table.new(@adapter, 'users')
59
60
  end
@@ -65,9 +66,10 @@ describe "SQLite3 Extensions" do
65
66
  end
66
67
 
67
68
  it 'should set the @columns to the looked-up columns' do
68
- SQL::Sqlite3::Column.stub!(:new).and_return(@col1, @col2)
69
+ SQL::Sqlite3::Column.should_receive(:new).with(@cs1).and_return(@col1)
70
+ SQL::Sqlite3::Column.should_receive(:new).with(@cs2).and_return(@col2)
69
71
  t = SQL::Sqlite3::Table.new(@adapter, 'users')
70
- t.columns.should == [@col1, @col2]
72
+ t.columns.should == [ @col1, @col2 ]
71
73
  end
72
74
 
73
75
  end
@@ -8,7 +8,7 @@ begin
8
8
  desc 'Run specifications'
9
9
  Spec::Rake::SpecTask.new(:spec) do |t|
10
10
  t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
11
- t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
11
+ t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s).map { |f| f.to_s }
12
12
 
13
13
  begin
14
14
  gem 'rcov', '~>0.8'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Sadauskas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-04 00:00:00 -08:00
12
+ date: 2009-01-19 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.9
23
+ version: 0.9.10
24
24
  version:
25
25
  description: DataMapper plugin for writing and speccing migrations
26
26
  email: