dm-migrations 0.10.2 → 1.0.0.rc1

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.
Files changed (33) hide show
  1. data/.gitignore +36 -0
  2. data/Gemfile +141 -0
  3. data/Rakefile +2 -3
  4. data/VERSION +1 -1
  5. data/dm-migrations.gemspec +50 -18
  6. data/lib/dm-migrations.rb +2 -0
  7. data/lib/dm-migrations/adapters/dm-do-adapter.rb +276 -0
  8. data/lib/dm-migrations/adapters/dm-mysql-adapter.rb +283 -0
  9. data/lib/dm-migrations/adapters/dm-oracle-adapter.rb +321 -0
  10. data/lib/dm-migrations/adapters/dm-postgres-adapter.rb +159 -0
  11. data/lib/dm-migrations/adapters/dm-sqlite-adapter.rb +96 -0
  12. data/lib/dm-migrations/adapters/dm-sqlserver-adapter.rb +177 -0
  13. data/lib/dm-migrations/adapters/dm-yaml-adapter.rb +23 -0
  14. data/lib/dm-migrations/auto_migration.rb +238 -0
  15. data/lib/dm-migrations/migration.rb +3 -3
  16. data/lib/dm-migrations/sql.rb +2 -2
  17. data/lib/dm-migrations/sql/mysql.rb +3 -3
  18. data/lib/dm-migrations/sql/{postgresql.rb → postgres.rb} +3 -3
  19. data/lib/dm-migrations/sql/{sqlite3.rb → sqlite.rb} +3 -3
  20. data/spec/integration/auto_migration_spec.rb +506 -0
  21. data/spec/integration/migration_runner_spec.rb +12 -2
  22. data/spec/integration/migration_spec.rb +28 -14
  23. data/spec/integration/sql_spec.rb +22 -21
  24. data/spec/isolated/require_after_setup_spec.rb +30 -0
  25. data/spec/isolated/require_before_setup_spec.rb +30 -0
  26. data/spec/isolated/require_spec.rb +25 -0
  27. data/spec/spec_helper.rb +10 -25
  28. data/spec/unit/migration_spec.rb +320 -319
  29. data/spec/unit/sql/{postgresql_spec.rb → postgres_spec.rb} +17 -17
  30. data/spec/unit/sql/{sqlite3_extensions_spec.rb → sqlite_extensions_spec.rb} +14 -14
  31. data/tasks/local_gemfile.rake +18 -0
  32. data/tasks/spec.rake +0 -3
  33. metadata +72 -32
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  # a dummy class to include the module into
4
- class PostgresqlExtension
5
- include SQL::Postgresql
4
+ class PostgresExtension
5
+ include SQL::Postgres
6
6
  end
7
7
 
8
- describe "SQLite3 Extensions" do
8
+ describe "Postgres Extensions" do
9
9
  before do
10
- @pe = PostgresqlExtension.new
10
+ @pe = PostgresExtension.new
11
11
  end
12
12
 
13
13
  it 'should support schema-level transactions' do
@@ -20,7 +20,7 @@ describe "SQLite3 Extensions" do
20
20
 
21
21
  it 'should create a table object from the name' do
22
22
  table = mock('SQLite3 Table')
23
- SQL::Postgresql::Table.should_receive(:new).with(@pe, 'users').and_return(table)
23
+ SQL::Postgres::Table.should_receive(:new).with(@pe, 'users').and_return(table)
24
24
 
25
25
  @pe.table('users').should == table
26
26
  end
@@ -35,27 +35,27 @@ describe "SQLite3 Extensions" do
35
35
  @adapter = mock('adapter', :select => [])
36
36
  @adapter.stub!(:query_table).with('users').and_return([@cs1, @cs2])
37
37
 
38
- @col1 = mock('SQLite3 Column')
39
- @col2 = mock('SQLite3 Column')
38
+ @col1 = mock('Postgres Column')
39
+ @col2 = mock('Postgres Column')
40
40
  end
41
41
 
42
42
  it 'should initialize columns by querying the table' do
43
- SQL::Postgresql::Column.should_receive(:new).with(@cs1).and_return(@col1)
44
- SQL::Postgresql::Column.should_receive(:new).with(@cs2).and_return(@col2)
43
+ SQL::Postgres::Column.should_receive(:new).with(@cs1).and_return(@col1)
44
+ SQL::Postgres::Column.should_receive(:new).with(@cs2).and_return(@col2)
45
45
  @adapter.should_receive(:query_table).with('users').and_return([@cs1,@cs2])
46
- SQL::Postgresql::Table.new(@adapter, 'users')
46
+ SQL::Postgres::Table.new(@adapter, 'users')
47
47
  end
48
48
 
49
49
  it 'should create SQLite3 Column objects from the returned column structs' do
50
- SQL::Postgresql::Column.should_receive(:new).with(@cs1).and_return(@col1)
51
- SQL::Postgresql::Column.should_receive(:new).with(@cs2).and_return(@col2)
52
- SQL::Postgresql::Table.new(@adapter, 'users')
50
+ SQL::Postgres::Column.should_receive(:new).with(@cs1).and_return(@col1)
51
+ SQL::Postgres::Column.should_receive(:new).with(@cs2).and_return(@col2)
52
+ SQL::Postgres::Table.new(@adapter, 'users')
53
53
  end
54
54
 
55
55
  it 'should set the @columns to the looked-up columns' do
56
- SQL::Postgresql::Column.should_receive(:new).with(@cs1).and_return(@col1)
57
- SQL::Postgresql::Column.should_receive(:new).with(@cs2).and_return(@col2)
58
- t = SQL::Postgresql::Table.new(@adapter, 'users')
56
+ SQL::Postgres::Column.should_receive(:new).with(@cs1).and_return(@col1)
57
+ SQL::Postgres::Column.should_receive(:new).with(@cs2).and_return(@col2)
58
+ t = SQL::Postgres::Table.new(@adapter, 'users')
59
59
  t.columns.should == [@col1, @col2]
60
60
  end
61
61
 
@@ -72,7 +72,7 @@ describe "SQLite3 Extensions" do
72
72
  :data_type => 'integer',
73
73
  :column_default => 123,
74
74
  :is_nullable => 'NO')
75
- @c = SQL::Postgresql::Column.new(@cs)
75
+ @c = SQL::Postgres::Column.new(@cs)
76
76
  end
77
77
 
78
78
  it 'should set the name from the column_name value' do
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  # a dummy class to include the module into
4
- class Sqlite3Extension
5
- include SQL::Sqlite3
4
+ class SqliteExtension
5
+ include SQL::Sqlite
6
6
  end
7
7
 
8
8
  describe "SQLite3 Extensions" do
9
9
  before do
10
- @se = Sqlite3Extension.new
10
+ @se = SqliteExtension.new
11
11
  end
12
12
 
13
13
  it 'should support schema-level transactions' do
@@ -20,7 +20,7 @@ describe "SQLite3 Extensions" do
20
20
 
21
21
  it 'should create a table object from the name' do
22
22
  table = mock('SQLite3 Table')
23
- SQL::Sqlite3::Table.should_receive(:new).with(@se, 'users').and_return(table)
23
+ SQL::Sqlite::Table.should_receive(:new).with(@se, 'users').and_return(table)
24
24
 
25
25
  @se.table('users').should == table
26
26
  end
@@ -50,22 +50,22 @@ describe "SQLite3 Extensions" do
50
50
  end
51
51
 
52
52
  it 'should initialize columns by querying the table' do
53
- SQL::Sqlite3::Column.should_receive(:new).with(@cs1).and_return(@col1)
54
- SQL::Sqlite3::Column.should_receive(:new).with(@cs2).and_return(@col2)
53
+ SQL::Sqlite::Column.should_receive(:new).with(@cs1).and_return(@col1)
54
+ SQL::Sqlite::Column.should_receive(:new).with(@cs2).and_return(@col2)
55
55
  @adapter.should_receive(:table_info).with('users').and_return([@cs1,@cs2])
56
- SQL::Sqlite3::Table.new(@adapter, 'users')
56
+ SQL::Sqlite::Table.new(@adapter, 'users')
57
57
  end
58
58
 
59
59
  it 'should create SQLite3 Column objects from the returned column structs' do
60
- SQL::Sqlite3::Column.should_receive(:new).with(@cs1).and_return(@col1)
61
- SQL::Sqlite3::Column.should_receive(:new).with(@cs2).and_return(@col2)
62
- SQL::Sqlite3::Table.new(@adapter, 'users')
60
+ SQL::Sqlite::Column.should_receive(:new).with(@cs1).and_return(@col1)
61
+ SQL::Sqlite::Column.should_receive(:new).with(@cs2).and_return(@col2)
62
+ SQL::Sqlite::Table.new(@adapter, 'users')
63
63
  end
64
64
 
65
65
  it 'should set the @columns to the looked-up columns' do
66
- SQL::Sqlite3::Column.should_receive(:new).with(@cs1).and_return(@col1)
67
- SQL::Sqlite3::Column.should_receive(:new).with(@cs2).and_return(@col2)
68
- t = SQL::Sqlite3::Table.new(@adapter, 'users')
66
+ SQL::Sqlite::Column.should_receive(:new).with(@cs1).and_return(@col1)
67
+ SQL::Sqlite::Column.should_receive(:new).with(@cs2).and_return(@col2)
68
+ t = SQL::Sqlite::Table.new(@adapter, 'users')
69
69
  t.columns.should == [ @col1, @col2 ]
70
70
  end
71
71
 
@@ -79,7 +79,7 @@ describe "SQLite3 Extensions" do
79
79
  :dflt_value => 123,
80
80
  :pk => true,
81
81
  :notnull => 0)
82
- @c = SQL::Sqlite3::Column.new(@cs)
82
+ @c = SQL::Sqlite::Column.new(@cs)
83
83
  end
84
84
 
85
85
  it 'should set the name from the name value' do
@@ -0,0 +1,18 @@
1
+ desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
2
+ task :local_gemfile do |t|
3
+
4
+ root = Pathname(__FILE__).dirname.parent
5
+ datamapper = root.parent
6
+
7
+ source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
8
+ gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
9
+
10
+ root.join('Gemfile.local').open('w') do |f|
11
+ root.join('Gemfile').open.each do |line|
12
+ line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
13
+ line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
14
+ f.puts line
15
+ end
16
+ end
17
+
18
+ end
data/tasks/spec.rake CHANGED
@@ -35,7 +35,4 @@ rescue LoadError
35
35
  end
36
36
  end
37
37
 
38
- task :spec => :check_dependencies
39
- task :rcov => :check_dependencies
40
-
41
38
  task :default => :spec
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ prerelease: true
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ - rc1
10
+ version: 1.0.0.rc1
5
11
  platform: ruby
6
12
  authors:
7
13
  - Paul Sadauskas
@@ -9,39 +15,37 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-12-11 00:00:00 -08:00
18
+ date: 2010-05-19 00:00:00 -07:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: dm-core
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
23
- version: 0.10.2
24
- version:
28
+ segments:
29
+ - 1
30
+ - 0
31
+ - 0
32
+ - rc1
33
+ version: 1.0.0.rc1
34
+ type: :runtime
35
+ version_requirements: *id001
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
30
40
  requirements:
31
41
  - - ~>
32
42
  - !ruby/object:Gem::Version
33
- version: 1.2.9
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: yard
43
+ segments:
44
+ - 1
45
+ - 3
46
+ version: "1.3"
37
47
  type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- version: 0.4.0
44
- version:
48
+ version_requirements: *id002
45
49
  description: DataMapper plugin for writing and speccing migrations
46
50
  email: psadauskas [a] gmail [d] com
47
51
  executables: []
@@ -52,6 +56,8 @@ extra_rdoc_files:
52
56
  - LICENSE
53
57
  - README.rdoc
54
58
  files:
59
+ - .gitignore
60
+ - Gemfile
55
61
  - LICENSE
56
62
  - README.rdoc
57
63
  - Rakefile
@@ -63,33 +69,46 @@ files:
63
69
  - examples/sample_migration.rb
64
70
  - examples/sample_migration_spec.rb
65
71
  - lib/dm-migrations.rb
72
+ - lib/dm-migrations/adapters/dm-do-adapter.rb
73
+ - lib/dm-migrations/adapters/dm-mysql-adapter.rb
74
+ - lib/dm-migrations/adapters/dm-oracle-adapter.rb
75
+ - lib/dm-migrations/adapters/dm-postgres-adapter.rb
76
+ - lib/dm-migrations/adapters/dm-sqlite-adapter.rb
77
+ - lib/dm-migrations/adapters/dm-sqlserver-adapter.rb
78
+ - lib/dm-migrations/adapters/dm-yaml-adapter.rb
79
+ - lib/dm-migrations/auto_migration.rb
66
80
  - lib/dm-migrations/migration.rb
67
81
  - lib/dm-migrations/migration_runner.rb
68
82
  - lib/dm-migrations/sql.rb
69
83
  - lib/dm-migrations/sql/column.rb
70
84
  - lib/dm-migrations/sql/mysql.rb
71
- - lib/dm-migrations/sql/postgresql.rb
72
- - lib/dm-migrations/sql/sqlite3.rb
85
+ - lib/dm-migrations/sql/postgres.rb
86
+ - lib/dm-migrations/sql/sqlite.rb
73
87
  - lib/dm-migrations/sql/table.rb
74
88
  - lib/dm-migrations/sql/table_creator.rb
75
89
  - lib/dm-migrations/sql/table_modifier.rb
76
90
  - lib/spec/example/migration_example_group.rb
77
91
  - lib/spec/matchers/migration_matchers.rb
92
+ - spec/integration/auto_migration_spec.rb
78
93
  - spec/integration/migration_runner_spec.rb
79
94
  - spec/integration/migration_spec.rb
80
95
  - spec/integration/sql_spec.rb
96
+ - spec/isolated/require_after_setup_spec.rb
97
+ - spec/isolated/require_before_setup_spec.rb
98
+ - spec/isolated/require_spec.rb
81
99
  - spec/rcov.opts
82
100
  - spec/spec.opts
83
101
  - spec/spec_helper.rb
84
102
  - spec/unit/migration_spec.rb
85
103
  - spec/unit/sql/column_spec.rb
86
- - spec/unit/sql/postgresql_spec.rb
87
- - spec/unit/sql/sqlite3_extensions_spec.rb
104
+ - spec/unit/sql/postgres_spec.rb
105
+ - spec/unit/sql/sqlite_extensions_spec.rb
88
106
  - spec/unit/sql/table_creator_spec.rb
89
107
  - spec/unit/sql/table_modifier_spec.rb
90
108
  - spec/unit/sql/table_spec.rb
91
109
  - spec/unit/sql_spec.rb
92
110
  - tasks/ci.rake
111
+ - tasks/local_gemfile.rake
93
112
  - tasks/metrics.rake
94
113
  - tasks/spec.rake
95
114
  - tasks/yard.rake
@@ -107,20 +126,41 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
126
  requirements:
108
127
  - - ">="
109
128
  - !ruby/object:Gem::Version
129
+ segments:
130
+ - 0
110
131
  version: "0"
111
- version:
112
132
  required_rubygems_version: !ruby/object:Gem::Requirement
113
133
  requirements:
114
- - - ">="
134
+ - - ">"
115
135
  - !ruby/object:Gem::Version
116
- version: "0"
117
- version:
136
+ segments:
137
+ - 1
138
+ - 3
139
+ - 1
140
+ version: 1.3.1
118
141
  requirements: []
119
142
 
120
143
  rubyforge_project: datamapper
121
- rubygems_version: 1.3.5
144
+ rubygems_version: 1.3.6
122
145
  signing_key:
123
146
  specification_version: 3
124
147
  summary: DataMapper plugin for writing and speccing migrations
125
- test_files: []
126
-
148
+ test_files:
149
+ - spec/integration/auto_migration_spec.rb
150
+ - spec/integration/migration_runner_spec.rb
151
+ - spec/integration/migration_spec.rb
152
+ - spec/integration/sql_spec.rb
153
+ - spec/isolated/require_after_setup_spec.rb
154
+ - spec/isolated/require_before_setup_spec.rb
155
+ - spec/isolated/require_spec.rb
156
+ - spec/spec_helper.rb
157
+ - spec/unit/migration_spec.rb
158
+ - spec/unit/sql/column_spec.rb
159
+ - spec/unit/sql/postgres_spec.rb
160
+ - spec/unit/sql/sqlite_extensions_spec.rb
161
+ - spec/unit/sql/table_creator_spec.rb
162
+ - spec/unit/sql/table_modifier_spec.rb
163
+ - spec/unit/sql/table_spec.rb
164
+ - spec/unit/sql_spec.rb
165
+ - examples/sample_migration.rb
166
+ - examples/sample_migration_spec.rb