guise 0.6.0 → 0.6.1
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 +5 -5
- data/.codeclimate.yml +36 -0
- data/.rubocop.yml +1063 -0
- data/.travis.yml +25 -5
- data/.yardopts +1 -0
- data/Appraisals +5 -0
- data/README.md +120 -29
- data/gemfiles/3.1.gemfile +1 -1
- data/gemfiles/3.1.gemfile.lock +39 -30
- data/gemfiles/3.2.gemfile +1 -1
- data/gemfiles/3.2.gemfile.lock +47 -38
- data/gemfiles/4.0.gemfile +1 -1
- data/gemfiles/4.0.gemfile.lock +47 -38
- data/gemfiles/4.1.gemfile +1 -1
- data/gemfiles/4.1.gemfile.lock +45 -38
- data/gemfiles/4.2.gemfile +1 -1
- data/gemfiles/4.2.gemfile.lock +44 -37
- data/gemfiles/5.0.gemfile +8 -0
- data/gemfiles/5.0.gemfile.lock +94 -0
- data/guise.gemspec +9 -14
- data/lib/guise.rb +29 -5
- data/lib/guise/builders.rb +129 -0
- data/lib/guise/callbacks.rb +3 -0
- data/lib/guise/errors.rb +32 -0
- data/lib/guise/introspection.rb +23 -11
- data/lib/guise/options.rb +75 -0
- data/lib/guise/registry.rb +19 -0
- data/lib/guise/scopes.rb +65 -0
- data/lib/guise/syntax.rb +158 -83
- data/lib/guise/version.rb +1 -1
- data/spec/guise_spec.rb +112 -46
- data/spec/spec_helper.rb +12 -8
- metadata +50 -29
- data/spec/factories.rb +0 -39
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'codeclimate-test-reporter'
|
2
2
|
CodeClimate::TestReporter.start
|
3
3
|
|
4
|
+
require "byebug"
|
4
5
|
require 'pry'
|
5
|
-
require 'active_record'
|
6
|
-
require 'factory_girl'
|
7
|
-
require 'shoulda-matchers'
|
8
6
|
require 'guise'
|
7
|
+
require 'active_record'
|
8
|
+
require "active_record/base"
|
9
9
|
|
10
10
|
if I18n.respond_to?(:enforce_available_locales)
|
11
11
|
I18n.enforce_available_locales = false
|
@@ -20,7 +20,6 @@ ActiveRecord::Migration.verbose = false
|
|
20
20
|
|
21
21
|
ActiveRecord::Schema.define do
|
22
22
|
create_table :users, force: true do |t|
|
23
|
-
t.string :name
|
24
23
|
t.string :email
|
25
24
|
end
|
26
25
|
|
@@ -39,7 +38,7 @@ ActiveRecord::Schema.define do
|
|
39
38
|
end
|
40
39
|
|
41
40
|
class User < ActiveRecord::Base
|
42
|
-
has_guises :Technician, :Supervisor, association: :user_roles, attribute: :name
|
41
|
+
has_guises :Technician, :Supervisor, :Explorer, association: :user_roles, attribute: :name
|
43
42
|
end
|
44
43
|
|
45
44
|
class Technician < User
|
@@ -59,7 +58,14 @@ class TechnicianUserRole < UserRole
|
|
59
58
|
end
|
60
59
|
|
61
60
|
class Person < ActiveRecord::Base
|
62
|
-
has_guises
|
61
|
+
has_guises(
|
62
|
+
:Admin,
|
63
|
+
:Manager,
|
64
|
+
:Reviewer,
|
65
|
+
association: :permissions,
|
66
|
+
attribute: :privilege,
|
67
|
+
foreign_key: :employee_id
|
68
|
+
)
|
63
69
|
end
|
64
70
|
|
65
71
|
class Permission < ActiveRecord::Base
|
@@ -68,8 +74,6 @@ class Permission < ActiveRecord::Base
|
|
68
74
|
guise_for :Person, foreign_key: :employee_id
|
69
75
|
end
|
70
76
|
|
71
|
-
FactoryGirl.find_definitions
|
72
77
|
RSpec.configure do |config|
|
73
78
|
config.order = 'random'
|
74
|
-
config.include FactoryGirl::Syntax::Methods
|
75
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Gutierrez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -51,103 +51,103 @@ dependencies:
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '5.0'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: appraisal
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '1.0'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '1.0'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
68
|
+
name: byebug
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '5.0'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
80
|
+
version: '5.0'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
82
|
+
name: codeclimate-test-reporter
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '0.3'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
94
|
+
version: '0.3'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
96
|
+
name: pry
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
101
|
+
version: '0.9'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
108
|
+
version: '0.9'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
|
-
name:
|
110
|
+
name: rake
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '
|
115
|
+
version: '10.1'
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
122
|
+
version: '10.1'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
|
-
name:
|
124
|
+
name: redcarpet
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '
|
129
|
+
version: '3.2'
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
136
|
+
version: '3.2'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
|
-
name:
|
138
|
+
name: rspec
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '0
|
143
|
+
version: '3.0'
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '0
|
150
|
+
version: '3.0'
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: sqlite3
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,6 +162,20 @@ dependencies:
|
|
162
162
|
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '1.3'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: yard
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0.8'
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0.8'
|
165
179
|
description: " Multiple inheritance STI "
|
166
180
|
email:
|
167
181
|
- edd_d@mit.edu
|
@@ -169,9 +183,12 @@ executables: []
|
|
169
183
|
extensions: []
|
170
184
|
extra_rdoc_files: []
|
171
185
|
files:
|
186
|
+
- ".codeclimate.yml"
|
172
187
|
- ".gitignore"
|
173
188
|
- ".rspec"
|
189
|
+
- ".rubocop.yml"
|
174
190
|
- ".travis.yml"
|
191
|
+
- ".yardopts"
|
175
192
|
- Appraisals
|
176
193
|
- Gemfile
|
177
194
|
- LICENSE
|
@@ -187,14 +204,19 @@ files:
|
|
187
204
|
- gemfiles/4.1.gemfile.lock
|
188
205
|
- gemfiles/4.2.gemfile
|
189
206
|
- gemfiles/4.2.gemfile.lock
|
207
|
+
- gemfiles/5.0.gemfile
|
208
|
+
- gemfiles/5.0.gemfile.lock
|
190
209
|
- guise.gemspec
|
191
210
|
- lib/guise.rb
|
211
|
+
- lib/guise/builders.rb
|
192
212
|
- lib/guise/callbacks.rb
|
213
|
+
- lib/guise/errors.rb
|
193
214
|
- lib/guise/introspection.rb
|
215
|
+
- lib/guise/options.rb
|
194
216
|
- lib/guise/registry.rb
|
217
|
+
- lib/guise/scopes.rb
|
195
218
|
- lib/guise/syntax.rb
|
196
219
|
- lib/guise/version.rb
|
197
|
-
- spec/factories.rb
|
198
220
|
- spec/guise_spec.rb
|
199
221
|
- spec/spec_helper.rb
|
200
222
|
homepage: https://github.com/ecbypi/guise
|
@@ -209,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
231
|
requirements:
|
210
232
|
- - ">="
|
211
233
|
- !ruby/object:Gem::Version
|
212
|
-
version:
|
234
|
+
version: 2.0.0
|
213
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
236
|
requirements:
|
215
237
|
- - ">="
|
@@ -217,12 +239,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
239
|
version: '0'
|
218
240
|
requirements: []
|
219
241
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.7.6
|
221
243
|
signing_key:
|
222
244
|
specification_version: 4
|
223
245
|
summary: Guise provides methods to setup single table inheritance with multiple inheritances
|
224
246
|
possible.
|
225
247
|
test_files:
|
226
|
-
- spec/factories.rb
|
227
248
|
- spec/guise_spec.rb
|
228
249
|
- spec/spec_helper.rb
|
data/spec/factories.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
|
3
|
-
factory :user do
|
4
|
-
name 'Micro Helpline'
|
5
|
-
email 'mrhalp@mit.edu'
|
6
|
-
|
7
|
-
factory :technician do
|
8
|
-
after(:create) do |user, proxy|
|
9
|
-
create(:user_role, name: 'Technician', user: user)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
factory :supervisor do
|
14
|
-
after(:create) do |user, proxy|
|
15
|
-
create(:user_role, name: 'Supervisor', user: user)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
factory :person do
|
21
|
-
end
|
22
|
-
|
23
|
-
factory :permission do
|
24
|
-
person
|
25
|
-
privilege 'Admin'
|
26
|
-
end
|
27
|
-
|
28
|
-
factory :user_role do
|
29
|
-
user
|
30
|
-
name 'Technician'
|
31
|
-
|
32
|
-
factory :technician_role do
|
33
|
-
end
|
34
|
-
|
35
|
-
factory :supervisor_role do
|
36
|
-
name 'Supervisor'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|