active_facet 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module ActiveFacet
2
+ VERSION = "1.2.8"
3
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ module ActiveFacet
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ desc 'Creates a ActiveFacet gem configuration file at config/active_facet.yml, and an initializer at config/initializers/active_facet.rb'
7
+
8
+ def self.source_root
9
+ @_af_source_root ||= File.expand_path("../templates", __FILE__)
10
+ end
11
+
12
+ def create_config_file
13
+ template 'active_facet.yml', File.join('config', 'active_facet.yml')
14
+ end
15
+
16
+ def create_initializer_file
17
+ template 'initializer.rb', File.join('config', 'initializers', 'active_facet.rb')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ default:
2
+ opts_key: af_opts
3
+ fields_key: fields
4
+ field_overrides_key: field_overrides
5
+ version_key: version
6
+ filters_key: filters
7
+ cache_bypass_key: cache_bypass
8
+ cache_force_key: cache_force
9
+ filters_force_key: cache_force
10
+ strict_lookups: false
11
+ preload_associations: false
12
+ cache_enabled: false
13
+ filters_enabled: false
14
+ test:
15
+ strict_lookups: false
16
+ preload_associations: false
17
+ cache_enabled: false
18
+ filters_enabled: false
@@ -0,0 +1,85 @@
1
+ ActiveFacet.configure do |config|
2
+ config_file_path = File.join(Rails.root, 'config', 'active_facet.yml')
3
+ environment = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || 'development'
4
+
5
+ @config_file = YAML::load_file(config_file_path)
6
+ @env_config = (@config_file['default'] || {}).merge(@config_file[environment] || {})
7
+
8
+ # The version to use if none is designated in context for serialization. 1.0 by default.
9
+ # config.default_version = 1.0
10
+
11
+ # The symbol which acts as the options key that designates context for serialization. :rsb_opts by default.
12
+ # config.opts_key = @env_config['opts_key'].to_sym
13
+
14
+ # The symbol which acts as the context key that designates fields for serialization. :fields by default.
15
+ # config.fields_key = @env_config['fields_key'].to_sym
16
+
17
+ # The symbol which acts as the context key that designates field overrides for serialization. :field_overrides by default.
18
+ # config.field_overrides_key = @env_config['field_overrides_key'].to_sym
19
+
20
+ # The symbol which acts as the context key that designates version for serialization. :version by default.
21
+ # config.version_key = @env_config['version_key'].to_sym
22
+
23
+ # The symbol which acts as the context key that designates filters for serialization. :filters by default.
24
+ # config.filters_key = @env_config['filters_key'].to_sym
25
+
26
+ # The symbol which acts as the context key that designates force for cache. :cache_bypass by default.
27
+ # config.cache_bypass_key = @env_config['cache_bypass_key'].to_sym
28
+
29
+ # The symbol which acts as the context key that designates force for cache. :cache_force by default.
30
+ # config.cache_force_key = @env_config['cache_force_key'].to_sym
31
+
32
+ # The symbol which acts as the context key that designates filters state override. :filters_force by default.
33
+ # config.filters_force_key = @env_config['filters_force_key'].to_sym
34
+
35
+ # Tell if exception should be raised when serializer_mapper returns nil. False by default.
36
+ # config.strict_lookups = @env_config['strict_lookups']
37
+
38
+ # Tell if associations should be preloaded to mitigate N+1 problems. False by default.
39
+ # config.preload_associations = @env_config['preload_associations']
40
+
41
+ # Tell serializers to cache
42
+ # config.cache_enabled = @env_config['cache_enabled']
43
+
44
+ # Tell ActiveRecord to treat enable acts_as_active_facet for all models. False by default.
45
+ # config.acts_as_active_facet_enabled = @env_config['acts_as_active_facet_enabled']
46
+
47
+ # Tell serializers to enable/disable filters
48
+ # config.filters_enabled = @env_config['filters_enabled']
49
+
50
+ # Default options for Rails.cache.fetch
51
+ # config.default_cache_options = { expires_in: 5.minutes }
52
+
53
+ # Tell document cache adaptor to use
54
+ # config.document_cache = ::ActiveFacet::DocumentCache
55
+
56
+ # Tell which filters and field_overrides apply to a given resource
57
+ # config.resource_mapper do |resource_class|
58
+ # [].tap do |map|
59
+ # until(resource_class.superclass == BasicObject) do
60
+ # map << resource_class.name.tableize
61
+ # resource_class = resource_class.superclass
62
+ # end
63
+ # end
64
+ # end
65
+
66
+ # Tell which serializer to apply for a given resource
67
+ # config.serializer_mapper do |resource_class, serializer, type, version, options|
68
+ # case type
69
+ # when :serializer
70
+ # (version.to_s + '::' + resource_class.name.camelcase + type.to_s.camecase).constantize.new
71
+ # else
72
+ # (version.to_s + '::' + resource_class.name.camelcase + type.to_s.camecase).constantize
73
+ # end
74
+ # end
75
+
76
+ # Define global filters to apply for all resources
77
+ # config.global_filter(:active) do |state = :enabled|
78
+ # case state.to_sym
79
+ # when :enabled
80
+ # enabled if respond_to?(:enabled)
81
+ # when :disabled
82
+ # disabled
83
+ # end
84
+ # end
85
+ end
metadata ADDED
@@ -0,0 +1,317 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_facet
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.8
5
+ platform: ruby
6
+ authors:
7
+ - The Honest Company
8
+ - Jay Crouch
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-04-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 3.2.22
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 3.2.22
28
+ - !ruby/object:Gem::Dependency
29
+ name: oj
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: w_g
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.4.1
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.4.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.11'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.11'
70
+ - !ruby/object:Gem::Dependency
71
+ name: sqlite3
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-rails
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: test-unit
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: factory_girl_rails
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: database_cleaner
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: ffaker
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: fivemat
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: fuubar
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ - !ruby/object:Gem::Dependency
183
+ name: parallel_tests
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ - !ruby/object:Gem::Dependency
197
+ name: pry
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ type: :development
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ - !ruby/object:Gem::Dependency
211
+ name: pry-rails
212
+ requirement: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: '0'
217
+ type: :development
218
+ prerelease: false
219
+ version_requirements: !ruby/object:Gem::Requirement
220
+ requirements:
221
+ - - ">="
222
+ - !ruby/object:Gem::Version
223
+ version: '0'
224
+ - !ruby/object:Gem::Dependency
225
+ name: pry-nav
226
+ requirement: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ type: :development
232
+ prerelease: false
233
+ version_requirements: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
238
+ - !ruby/object:Gem::Dependency
239
+ name: pry-stack_explorer
240
+ requirement: !ruby/object:Gem::Requirement
241
+ requirements:
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ version: '0'
245
+ type: :development
246
+ prerelease: false
247
+ version_requirements: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ">="
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ - !ruby/object:Gem::Dependency
253
+ name: rapido
254
+ requirement: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ">="
257
+ - !ruby/object:Gem::Version
258
+ version: '0'
259
+ type: :development
260
+ prerelease: false
261
+ version_requirements: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ version: '0'
266
+ description: Fast JSON serializer for nested PORO and ActiveRecord Objects supporting
267
+ decoration, field filters, record filters and caching
268
+ email:
269
+ - i.jaycrouch@gmail.com
270
+ executables: []
271
+ extensions: []
272
+ extra_rdoc_files: []
273
+ files:
274
+ - MIT-LICENSE.txt
275
+ - README.md
276
+ - Rakefile
277
+ - lib/active_facet.rb
278
+ - lib/active_facet/acts_as_active_facet.rb
279
+ - lib/active_facet/config.rb
280
+ - lib/active_facet/document_cache.rb
281
+ - lib/active_facet/errors/attribute_error.rb
282
+ - lib/active_facet/errors/configuration_error.rb
283
+ - lib/active_facet/errors/lookup_error.rb
284
+ - lib/active_facet/filter.rb
285
+ - lib/active_facet/helper.rb
286
+ - lib/active_facet/serializer/base.rb
287
+ - lib/active_facet/serializer/facade.rb
288
+ - lib/active_facet/version.rb
289
+ - lib/rails/generators/active_facet/install/install_generator.rb
290
+ - lib/rails/generators/active_facet/install/templates/active_facet.yml
291
+ - lib/rails/generators/active_facet/install/templates/initializer.rb
292
+ homepage: https://github.com/honest/active_facet
293
+ licenses:
294
+ - MIT
295
+ metadata:
296
+ allowed_push_host: https://rubygems.org
297
+ post_install_message:
298
+ rdoc_options: []
299
+ require_paths:
300
+ - lib
301
+ required_ruby_version: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - ">="
304
+ - !ruby/object:Gem::Version
305
+ version: '0'
306
+ required_rubygems_version: !ruby/object:Gem::Requirement
307
+ requirements:
308
+ - - ">="
309
+ - !ruby/object:Gem::Version
310
+ version: '0'
311
+ requirements: []
312
+ rubyforge_project:
313
+ rubygems_version: 2.4.8
314
+ signing_key:
315
+ specification_version: 4
316
+ summary: Inline JSON serializer
317
+ test_files: []