schema_plus_core 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +1 -0
- data/lib/schema_plus/core/active_record/base.rb +16 -16
- data/lib/schema_plus/core/middleware.rb +1 -1
- data/lib/schema_plus/core/version.rb +1 -1
- data/spec/dumper_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a59aa0134494234f7d1601e3f5c764035c00969
|
4
|
+
data.tar.gz: d8af7c134c42e18f69f749d31bc3b9908179736e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07bb287598da65c41da7c50e7a0ae7711e45653012cebcb9e8bf69f66c4c9e96ff363ef6ebdbe0cfd8965d927b518aa2cefc84a2168f8f11ca847ae2cb653a31
|
7
|
+
data.tar.gz: d0834cc8c8da80f8aa19395c5a25f06c6eee457bb0aabdde90d957fad0fad5879bf7d88d9925a716e1e826df3d4457f296fbba9af1530d9504e91a4440dacaba
|
data/.travis.yml
CHANGED
@@ -12,7 +12,7 @@ gemfile:
|
|
12
12
|
- gemfiles/activerecord-4.2/Gemfile.sqlite3
|
13
13
|
env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
|
14
14
|
addons:
|
15
|
-
postgresql: '9.
|
15
|
+
postgresql: '9.4'
|
16
16
|
before_script: bundle exec rake create_databases
|
17
17
|
after_script: bundle exec rake drop_databases
|
18
18
|
script: bundle exec rake travis
|
data/README.md
CHANGED
@@ -435,6 +435,7 @@ SchemaPlus::Core provides a state object and of callbacks to various phases of t
|
|
435
435
|
|
436
436
|
## History
|
437
437
|
|
438
|
+
* 0.3.1 Pass along (undocumented) return values from association declarations
|
438
439
|
* 0.3.0 Added `Model::Association::Declaration`
|
439
440
|
* 0.2.1 Added `Migration::CreateTable` and `Schema::Define`; removed dependency on (defunct) `schema_monkey_rails` gem. [Oops, this should have been a minor version bump]
|
440
441
|
* 0.2.0 Added `Migration::DropTable`
|
@@ -16,32 +16,32 @@ module SchemaPlus
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
# has_many, has_one, has_and_belongs_to_many, and belongs_to
|
20
|
+
# don't have a documented return value. But at least one gem
|
21
|
+
# (https://github.com/hzamani/active_record-acts_as/blob/master/lib/active_record/acts_as/relation.rb#L14)
|
22
|
+
# relies on the undocumented return value.
|
19
23
|
def has_many(name, scope = nil, options = {}, &extension)
|
20
|
-
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
+
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do |env|
|
25
|
+
env.result = super(env.name, env.scope, env.options, &env.extension)
|
26
|
+
end.result
|
24
27
|
end
|
25
28
|
|
26
29
|
def has_one(name, scope = nil, options = {}, &extension)
|
27
|
-
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do
|
28
|
-
|
29
|
-
|
30
|
-
end
|
30
|
+
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do |env|
|
31
|
+
env.result = super(env.name, env.scope, env.options, &env.extension)
|
32
|
+
end.result
|
31
33
|
end
|
32
34
|
|
33
35
|
def has_and_belongs_to_many(name, scope = nil, options = {}, &extension)
|
34
|
-
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do
|
35
|
-
|
36
|
-
|
37
|
-
end
|
36
|
+
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do |env|
|
37
|
+
env.result = super(env.name, env.scope, env.options, &env.extension)
|
38
|
+
end.result
|
38
39
|
end
|
39
40
|
|
40
41
|
def belongs_to(name, scope = nil, options = {}, &extension)
|
41
|
-
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do
|
42
|
-
|
43
|
-
|
44
|
-
end
|
42
|
+
SchemaMonkey::Middleware::Model::Association::Declaration.start(model: self, name: name, scope: scope, options: options, extension: extension) do |env|
|
43
|
+
env.result = super(env.name, env.scope, env.options, &env.extension)
|
44
|
+
end.result
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/spec/dumper_spec.rb
CHANGED
@@ -16,20 +16,20 @@ describe SchemaMonkey::Middleware::Dumper do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
context TestDumper::Middleware::Dumper::Initial do
|
19
|
-
Then { expect(dump).to match
|
19
|
+
Then { expect(dump).to match(/Schema[.]define.*do\s+#{middleware}/) }
|
20
20
|
end
|
21
21
|
|
22
22
|
context TestDumper::Middleware::Dumper::Tables do
|
23
|
-
Then { expect(dump).to match
|
23
|
+
Then { expect(dump).to match(/create_table "other".*create_table "#{middleware}".*create_table "things"/m) }
|
24
24
|
end
|
25
25
|
|
26
26
|
context TestDumper::Middleware::Dumper::Table do
|
27
|
-
Then { expect(dump).to match
|
28
|
-
Then { expect(dump).to match
|
27
|
+
Then { expect(dump).to match(/t[.]integer.*option: #{middleware} \# comment: #{middleware}/) }
|
28
|
+
Then { expect(dump).to match(/statement: #{middleware}\s+end\s+(add_index.*)?\s+trailer: #{middleware}/) }
|
29
29
|
end
|
30
30
|
|
31
31
|
context TestDumper::Middleware::Dumper::Indexes do
|
32
|
-
Then { expect(dump).to match
|
32
|
+
Then { expect(dump).to match(/add_index.*#{middleware}/) }
|
33
33
|
end
|
34
34
|
|
35
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ronen barzel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|