db_nazi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +36 -7
- data/CHANGELOG +4 -0
- data/Gemfile +13 -3
- data/Rakefile +2 -2
- data/db_nazi.gemspec +1 -3
- data/lib/db_nazi.rb +2 -0
- data/lib/db_nazi/schema.rb +16 -0
- data/lib/db_nazi/version.rb +1 -1
- data/test/database.yml +9 -1
- data/test/integration/test_integration.rb +1 -4
- data/test/test_helper.rb +6 -1
- data/test/unit/db_nazi/test_migration_proxy.rb +1 -4
- data/test/unit/db_nazi/test_schema.rb +16 -0
- metadata +9 -38
data/.travis.yml
CHANGED
@@ -1,10 +1,39 @@
|
|
1
1
|
language: ruby
|
2
2
|
bundler_args: --without dev
|
3
3
|
script: bundle exec rake ci
|
4
|
-
rvm:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
rvm: [] # only run the builds in the matrix below
|
5
|
+
matrix:
|
6
|
+
include:
|
7
|
+
- rvm: 1.9.2
|
8
|
+
env: DB_NAZI_ADAPTER=sqlite3
|
9
|
+
- rvm: 1.9.2
|
10
|
+
env: DB_NAZI_ADAPTER=mysql
|
11
|
+
- rvm: 1.9.2
|
12
|
+
env: DB_NAZI_ADAPTER=mysql2
|
13
|
+
- rvm: 1.9.2
|
14
|
+
before_script: psql -c 'create database myapp_test;' -U postgres
|
15
|
+
env: DB_NAZI_ADAPTER=postgresql
|
16
|
+
|
17
|
+
- rvm: 1.9.3
|
18
|
+
env: DB_NAZI_ADAPTER=sqlite3
|
19
|
+
- rvm: 1.9.3
|
20
|
+
env: DB_NAZI_ADAPTER=mysql
|
21
|
+
- rvm: 1.9.3
|
22
|
+
env: DB_NAZI_ADAPTER=mysql2
|
23
|
+
- rvm: 1.9.3
|
24
|
+
before_script: psql -c 'create database myapp_test;' -U postgres
|
25
|
+
env: DB_NAZI_ADAPTER=postgresql
|
26
|
+
|
27
|
+
- rvm: rbx-19mode
|
28
|
+
env: DB_NAZI_ADAPTER=sqlite3
|
29
|
+
- rvm: rbx-19mode
|
30
|
+
env: DB_NAZI_ADAPTER=mysql
|
31
|
+
- rvm: rbx-19mode
|
32
|
+
env: DB_NAZI_ADAPTER=mysql2
|
33
|
+
- rvm: rbx-19mode
|
34
|
+
before_script: psql -c 'create database myapp_test;' -U postgres
|
35
|
+
env: DB_NAZI_ADAPTER=postgresql
|
36
|
+
|
37
|
+
# jruby-1.6.7 has a broken testrb - use head for now
|
38
|
+
- rvm: jruby-head
|
39
|
+
env: DB_NAZI_ADAPTER=jdbcmysql
|
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
source :rubygems
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
gem '
|
4
|
+
case ENV['DB_NAZI_ADAPTER']
|
5
|
+
when 'mysql'
|
6
|
+
gem 'mysql'
|
7
|
+
when 'mysql'
|
8
|
+
gem 'mysql'
|
9
|
+
when 'mysql2'
|
10
|
+
gem 'mysql2'
|
11
|
+
when 'postgresql'
|
12
|
+
gem 'pg'
|
13
|
+
when 'jdbcmysql'
|
14
|
+
gem 'activerecord-jdbcmysql-adapter'
|
15
|
+
else
|
16
|
+
gem 'sqlite3'
|
7
17
|
end
|
data/Rakefile
CHANGED
data/db_nazi.gemspec
CHANGED
@@ -19,7 +19,5 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_runtime_dependency 'activerecord', '~> 3.2.6'
|
20
20
|
gem.add_development_dependency 'ritual', '~> 0.4.1'
|
21
21
|
gem.add_development_dependency 'minitest', '~> 3.1.0'
|
22
|
-
gem.add_development_dependency 'temporaries', '~> 0.
|
23
|
-
gem.add_development_dependency 'sqlite3', '~> 1.3.6'
|
24
|
-
gem.add_development_dependency 'mysql2', '~> 0.3.11'
|
22
|
+
gem.add_development_dependency 'temporaries', '~> 0.3.0'
|
25
23
|
end
|
data/lib/db_nazi.rb
CHANGED
@@ -2,6 +2,7 @@ module DBNazi
|
|
2
2
|
autoload :AbstractAdapter, 'db_nazi/abstract_adapter'
|
3
3
|
autoload :Migration, 'db_nazi/migration'
|
4
4
|
autoload :MigrationProxy, 'db_nazi/migration_proxy'
|
5
|
+
autoload :Schema, 'db_nazi/schema'
|
5
6
|
autoload :Table, 'db_nazi/table'
|
6
7
|
autoload :TableDefinition, 'db_nazi/table_definition'
|
7
8
|
autoload :VERSION, 'db_nazi/version'
|
@@ -85,3 +86,4 @@ ActiveRecord::ConnectionAdapters::TableDefinition.__send__ :include, DBNazi::Tab
|
|
85
86
|
ActiveRecord::ConnectionAdapters::Table.__send__ :include, DBNazi::Table
|
86
87
|
ActiveRecord::Migration.__send__ :include, DBNazi::Migration
|
87
88
|
ActiveRecord::MigrationProxy.__send__ :include, DBNazi::MigrationProxy
|
89
|
+
ActiveRecord::Schema.__send__ :include, DBNazi::Schema
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DBNazi
|
2
|
+
module Schema
|
3
|
+
def self.included(base)
|
4
|
+
base.extend ClassMethods
|
5
|
+
base.singleton_class.alias_method_chain :define, :db_nazi
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def define_with_db_nazi(*args, &block)
|
10
|
+
DBNazi.disable do
|
11
|
+
define_without_db_nazi(*args, &block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/db_nazi/version.rb
CHANGED
data/test/database.yml
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
sqlite3:
|
2
2
|
database: ':memory:'
|
3
|
+
mysql:
|
4
|
+
username: root
|
5
|
+
password:
|
6
|
+
database: db_nazi_test
|
3
7
|
mysql2:
|
4
8
|
username: root
|
5
9
|
password:
|
6
10
|
database: db_nazi_test
|
7
11
|
postgresql:
|
12
|
+
username: postgres
|
13
|
+
password:
|
14
|
+
database: db_nazi_test
|
15
|
+
min_messages: warning
|
16
|
+
jdbcmysql:
|
8
17
|
username: root
|
9
18
|
password:
|
10
19
|
database: db_nazi_test
|
11
|
-
min_messages: warning
|
@@ -3,10 +3,7 @@ require_relative '../test_helper'
|
|
3
3
|
describe DBNazi do
|
4
4
|
use_database
|
5
5
|
use_temporary_directory "#{ROOT}/test/tmp"
|
6
|
-
|
7
|
-
# Migrations use Kernel.puts. Lame.
|
8
|
-
out = Class.new { def write(*) end; def flush(*) end }.new
|
9
|
-
use_global_value :stdout, out
|
6
|
+
silence_stdout
|
10
7
|
|
11
8
|
before do
|
12
9
|
DBNazi.reset
|
data/test/test_helper.rb
CHANGED
@@ -5,7 +5,6 @@ require 'minitest/spec'
|
|
5
5
|
require 'yaml'
|
6
6
|
require 'active_record'
|
7
7
|
require 'temporaries'
|
8
|
-
require 'debugger'
|
9
8
|
require 'db_nazi'
|
10
9
|
|
11
10
|
ADAPTER = ENV['DB_NAZI_ADAPTER'] || 'sqlite3'
|
@@ -53,4 +52,10 @@ MiniTest::Spec.class_eval do
|
|
53
52
|
before { recreate_database }
|
54
53
|
after { drop_database }
|
55
54
|
end
|
55
|
+
|
56
|
+
# Migrations use Kernel.puts. Lame. This shuts them up.
|
57
|
+
def self.silence_stdout
|
58
|
+
out = Class.new { def puts(*); end; def write(*) end; def flush(*) end }.new
|
59
|
+
use_global_value :stdout, out
|
60
|
+
end
|
56
61
|
end
|
@@ -3,10 +3,7 @@ require_relative '../../test_helper'
|
|
3
3
|
describe DBNazi::MigrationProxy do
|
4
4
|
use_database
|
5
5
|
use_temporary_directory "#{ROOT}/test/tmp"
|
6
|
-
|
7
|
-
# Migrations use Kernel.puts. Lame.
|
8
|
-
out = Class.new { def write(*) end; def flush(*) end }.new
|
9
|
-
use_global_value :stdout, out
|
6
|
+
silence_stdout
|
10
7
|
|
11
8
|
before do
|
12
9
|
@original_pwd = Dir.pwd
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
describe DBNazi::Schema do
|
4
|
+
use_database
|
5
|
+
silence_stdout
|
6
|
+
|
7
|
+
describe ".define" do
|
8
|
+
it "should not be policed" do
|
9
|
+
ActiveRecord::Schema.define(:version => 1) do
|
10
|
+
create_table 'test_table' do |t|
|
11
|
+
t.boolean :test_column
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_nazi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.3.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,39 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: sqlite3
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 1.3.6
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 1.3.6
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: mysql2
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 0.3.11
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 0.3.11
|
77
|
+
version: 0.3.0
|
110
78
|
description: ''
|
111
79
|
email:
|
112
80
|
- george.ogata@gmail.com
|
@@ -126,6 +94,7 @@ files:
|
|
126
94
|
- lib/db_nazi/abstract_adapter.rb
|
127
95
|
- lib/db_nazi/migration.rb
|
128
96
|
- lib/db_nazi/migration_proxy.rb
|
97
|
+
- lib/db_nazi/schema.rb
|
129
98
|
- lib/db_nazi/table.rb
|
130
99
|
- lib/db_nazi/table_definition.rb
|
131
100
|
- lib/db_nazi/version.rb
|
@@ -135,6 +104,7 @@ files:
|
|
135
104
|
- test/unit/db_nazi/test_abstract_adapter.rb
|
136
105
|
- test/unit/db_nazi/test_migration.rb
|
137
106
|
- test/unit/db_nazi/test_migration_proxy.rb
|
107
|
+
- test/unit/db_nazi/test_schema.rb
|
138
108
|
- test/unit/db_nazi/test_table.rb
|
139
109
|
- test/unit/db_nazi/test_table_definition.rb
|
140
110
|
- test/unit/test_db_nazi.rb
|
@@ -153,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
123
|
version: '0'
|
154
124
|
segments:
|
155
125
|
- 0
|
156
|
-
hash: -
|
126
|
+
hash: -2333184105652215530
|
157
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
128
|
none: false
|
159
129
|
requirements:
|
@@ -162,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
132
|
version: '0'
|
163
133
|
segments:
|
164
134
|
- 0
|
165
|
-
hash: -
|
135
|
+
hash: -2333184105652215530
|
166
136
|
requirements: []
|
167
137
|
rubyforge_project:
|
168
138
|
rubygems_version: 1.8.24
|
@@ -176,6 +146,7 @@ test_files:
|
|
176
146
|
- test/unit/db_nazi/test_abstract_adapter.rb
|
177
147
|
- test/unit/db_nazi/test_migration.rb
|
178
148
|
- test/unit/db_nazi/test_migration_proxy.rb
|
149
|
+
- test/unit/db_nazi/test_schema.rb
|
179
150
|
- test/unit/db_nazi/test_table.rb
|
180
151
|
- test/unit/db_nazi/test_table_definition.rb
|
181
152
|
- test/unit/test_db_nazi.rb
|