schema_plus_association_inverses 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4783a9f0ae2986166372a16ff71d2ec9383ad1d1
4
- data.tar.gz: 9ec4cec25bbdb7a2c38cb708d3f6f28d6c2737a7
3
+ metadata.gz: 4534409fced9bb961b30e224eb1eb820d7fbc39c
4
+ data.tar.gz: c9c6dd35d78aab01b3b71ab316401c97c566fdd5
5
5
  SHA512:
6
- metadata.gz: 67d4aaba2f955469a67426ba524dc90f3544df3357605824d55a10fad393e9d9fbfaeb720e3a8ce309aa9803388770e651a62d401c8a136ad113faa376f1c9ea
7
- data.tar.gz: 00878045318018f7388854d3f51721cdb90ed30005e2f73b40df4c2238b0c1a238dd46bc89401009f81e1dfc8fb35dcb419aeebd0d75bbca552896e1f6c42e34
6
+ metadata.gz: 233d85149243faf8f82bacecbc2c65b297ac816140b713605ed9a76312a586e8780b1588d25c84208e05a023f6844635e2fb82e79da0fb26a5b7248b55aff6f2
7
+ data.tar.gz: b225e0805790115a6c3a9912ca2a3c598a8010eeaa7fdf81a63f418196a16e18a38f49bc630d94ec4a048feb977d2c28729927b85f4b4c0ad2480a1f9a530227
@@ -0,0 +1,3 @@
1
+ # This file is automatically loaded when `bundle console` is run. You can add
2
+ # fixtures and/or initialization code here to make experimenting with your gem
3
+ # easier.
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /gemfiles/**/*.lock
@@ -0,0 +1,18 @@
1
+ # This file was auto-generated by the schema_dev tool, based on the data in
2
+ # ./schema_dev.yml
3
+ # Please do not edit this file; any changes will be overwritten next time
4
+ # schema_dev gets run.
5
+ ---
6
+ sudo: false
7
+ rvm:
8
+ - 2.1.5
9
+ gemfile:
10
+ - gemfiles/activerecord-4.2/Gemfile.mysql2
11
+ - gemfiles/activerecord-4.2/Gemfile.postgresql
12
+ - gemfiles/activerecord-4.2/Gemfile.sqlite3
13
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
14
+ addons:
15
+ postgresql: '9.3'
16
+ before_script: bundle exec rake create_databases
17
+ after_script: bundle exec rake drop_databases
18
+ script: bundle exec rake travis
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in schema_plus_association_inverses.gemspec
4
+ gemspec
5
+
6
+ File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Joel Low
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # SchemaPlus Association Inverses [![Build Status](https://travis-ci.org/lowjoel/schema_plus_association_inverses.svg)](https://travis-ci.org/lowjoel/schema_plus_association_inverses) [![Coverage Status](https://coveralls.io/repos/lowjoel/schema_plus_association_inverses/badge.svg)](https://coveralls.io/r/lowjoel/schema_plus_association_inverses)
2
+
3
+ This little gem detects when an ActiveRecord association requires the programmer to explicitly set
4
+ `inverse_of` in the declaration.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'schema_plus_association_inverses'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install schema_plus_association_inverses
21
+
22
+ ## Usage
23
+
24
+ When a model requiring manual declaration of the inverse is detected, a little window appears at the
25
+ bottom of the page. This is inspired by [Bullet](https://github.com/flyerhzm/bullet).
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it (https://github.com/lowjoel/schema_plus_association_inverses/fork)
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
@@ -0,0 +1,9 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'schema_dev/tasks'
5
+
6
+ task :default => :spec
7
+
8
+ require 'rspec/core/rake_task'
9
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec :path => File.expand_path('..', __FILE__)
3
+
4
+ File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
@@ -0,0 +1,3 @@
1
+ eval File.read File.expand_path('../../Gemfile.base', __FILE__)
2
+
3
+ gem "activerecord", "~> 4.2.0"
@@ -0,0 +1,10 @@
1
+ require "pathname"
2
+ eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
+
4
+ platform :ruby do
5
+ gem "mysql2"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcmysql-adapter'
10
+ end
@@ -0,0 +1,8 @@
1
+ require "pathname"
2
+ eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
+
4
+ gem "pg", '~> 0.17.1', platforms: [:ruby, :mswin, :mswin64, :mingw, :x64_mingw]
5
+
6
+ platform :jruby do
7
+ gem 'activerecord-jdbcpostgresql-adapter'
8
+ end
@@ -0,0 +1,10 @@
1
+ require "pathname"
2
+ eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
+
4
+ platform :ruby do
5
+ gem "sqlite3"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
+ end
@@ -0,0 +1,8 @@
1
+ require 'schema_plus/core'
2
+
3
+ module AssociationInverses; end
4
+
5
+ require_relative 'association_inverses/middleware'
6
+ require_relative 'association_inverses/version'
7
+
8
+ SchemaMonkey.register(SchemaPlus::AssociationInverses)
@@ -0,0 +1 @@
1
+ require_relative 'middleware/association'
@@ -0,0 +1,20 @@
1
+ module SchemaPlus::AssociationInverses
2
+ module Middleware
3
+
4
+ module Model
5
+ module Association
6
+ module Declaration
7
+
8
+ def after(env)
9
+ reflection = env.model.reflect_on_association(env.name)
10
+ if !reflection.polymorphic? && !reflection.has_inverse?
11
+ raise ActiveRecord::InverseOfAssociationNotFoundError.new(reflection)
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ module SchemaPlus
2
+ module AssociationInverses
3
+ VERSION = '0.0.3'
4
+ end
5
+ end
6
+
@@ -0,0 +1 @@
1
+ require_relative 'schema_plus/association_inverses'
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'schema_plus/association_inverses/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'schema_plus_association_inverses'
8
+ spec.version = SchemaPlus::AssociationInverses::VERSION
9
+ spec.authors = ['Joel Low']
10
+ spec.email = ['joel@joelsplace.sg']
11
+
12
+ if spec.respond_to?(:metadata)
13
+ end
14
+
15
+ spec.summary = 'Warns when association inverses are not autodetected'
16
+ spec.description = ''
17
+ spec.homepage = 'https://github.com/lowjoel/schema_plus_association_inverses'
18
+ spec.license = 'MIT'
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_dependency 'schema_plus_core', '~> 0.3.0'
25
+
26
+ spec.add_development_dependency 'bundler', '~> 1.7'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3'
29
+ spec.add_development_dependency 'rspec-core', '~> 3'
30
+ spec.add_development_dependency 'schema_dev', '~> 3.3'
31
+ spec.add_development_dependency 'simplecov'
32
+ spec.add_development_dependency 'simplecov-gem-profile'
33
+ end
@@ -0,0 +1,8 @@
1
+ ruby:
2
+ - 2.1.5
3
+ activerecord:
4
+ - 4.2
5
+ db:
6
+ - mysql2
7
+ - sqlite3
8
+ - postgresql
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus_association_inverses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Low
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-06 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: schema_plus_core
@@ -128,7 +128,26 @@ email:
128
128
  executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
- files: []
131
+ files:
132
+ - ".consolerc"
133
+ - ".gitignore"
134
+ - ".travis.yml"
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - gemfiles/Gemfile.base
140
+ - gemfiles/activerecord-4.2/Gemfile.base
141
+ - gemfiles/activerecord-4.2/Gemfile.mysql2
142
+ - gemfiles/activerecord-4.2/Gemfile.postgresql
143
+ - gemfiles/activerecord-4.2/Gemfile.sqlite3
144
+ - lib/schema_plus/association_inverses.rb
145
+ - lib/schema_plus/association_inverses/middleware.rb
146
+ - lib/schema_plus/association_inverses/middleware/association.rb
147
+ - lib/schema_plus/association_inverses/version.rb
148
+ - lib/schema_plus_association_inverses.rb
149
+ - schema_association_inverses.gemspec
150
+ - schema_dev.yml
132
151
  homepage: https://github.com/lowjoel/schema_plus_association_inverses
133
152
  licenses:
134
153
  - MIT
@@ -149,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
168
  version: '0'
150
169
  requirements: []
151
170
  rubyforge_project:
152
- rubygems_version: 2.4.5
171
+ rubygems_version: 2.4.8
153
172
  signing_key:
154
173
  specification_version: 4
155
174
  summary: Warns when association inverses are not autodetected