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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4b3d7025a34fb4913c6ec1bac138771edf66ef7
4
- data.tar.gz: dc72bc7e1db359648b55957127946402f625c3ca
3
+ metadata.gz: 2a59aa0134494234f7d1601e3f5c764035c00969
4
+ data.tar.gz: d8af7c134c42e18f69f749d31bc3b9908179736e
5
5
  SHA512:
6
- metadata.gz: e585ae20a489a633f49635467122452c215e5aba2c5e35a3a49fc616ef62cb7b539b52df9b25bb6cebbafa7c0e89d00ced22e11728810acaa30498d0750fc5d6
7
- data.tar.gz: 003aaf743a991da00c00f4ba57c78ff544c9acdc3967c2356dc1f38324530a11dc75f6c9ea5023753f3df42bdcb614e2aead18fcbab2b736e88c76da8d0c6d06
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.3'
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
- |env|
22
- super(env.name, env.scope, env.options, &env.extension)
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
- |env|
29
- super(env.name, env.scope, env.options, &env.extension)
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
- |env|
36
- super(env.name, env.scope, env.options, &env.extension)
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
- |env|
43
- super(env.name, env.scope, env.options, &env.extension)
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
@@ -82,7 +82,7 @@ module SchemaPlus
82
82
  end
83
83
  module Association
84
84
  module Declaration
85
- ENV = [:model, :name, :scope, :options, :extension]
85
+ ENV = [:model, :name, :scope, :options, :extension, :result]
86
86
  end
87
87
  end
88
88
  end
@@ -1,5 +1,5 @@
1
1
  module SchemaPlus
2
2
  module Core
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  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 /Schema[.]define.*do\s+#{middleware}/ }
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 /create_table "other".*create_table "#{middleware}".*create_table "things"/m }
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 /t[.]integer.*option: #{middleware} \# comment: #{middleware}/ }
28
- Then { expect(dump).to match /statement: #{middleware}\s+end\s+(add_index.*)?\s+trailer: #{middleware}/ }
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 /add_index.*#{middleware}/ }
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.0
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-01 00:00:00.000000000 Z
11
+ date: 2015-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord