snfoil 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sn_foil/context.rb +12 -12
- data/lib/sn_foil/contexts/{build_context_concern.rb → build_context.rb} +5 -5
- data/lib/sn_foil/contexts/{change_context_concern.rb → change_context.rb} +4 -4
- data/lib/sn_foil/contexts/{create_context_concern.rb → create_context.rb} +5 -5
- data/lib/sn_foil/contexts/{destroy_context_concern.rb → destroy_context.rb} +5 -5
- data/lib/sn_foil/contexts/{index_context_concern.rb → index_context.rb} +3 -3
- data/lib/sn_foil/contexts/{setup_context_concern.rb → setup_context.rb} +4 -2
- data/lib/sn_foil/contexts/{show_context_concern.rb → show_context.rb} +3 -3
- data/lib/sn_foil/contexts/{update_context_concern.rb → update_context.rb} +5 -5
- data/lib/sn_foil/policy.rb +7 -2
- data/lib/sn_foil/searcher.rb +2 -8
- metadata +10 -24
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -28
- data/.ruby-version +0 -1
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -112
- data/LICENSE.txt +0 -21
- data/README.md +0 -43
- data/Rakefile +0 -4
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/lib/sn_foil/version.rb +0 -5
- data/lib/sn_foil.rb +0 -41
- data/snfoil.gemspec +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4c3c6c2bbf6b1d288ee5f82144854abeecad67d8d4f62bd59855daf19ebe8e
|
4
|
+
data.tar.gz: cfb7ba55d479ed8998418d4038ed12874f7463c1102fdb53e1f276edb12ef648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c2b4ef73d0dee5473903e3063a9472c4ba58f6715514711305ab19854135f8c16d4eecf3c7e00bb450b540ef81579c773bcd62f34d585c1ad046d5fa9803b59
|
7
|
+
data.tar.gz: 0e3d98d0275a02396381d1a7e63e32be803f792fde4ddcd4432d43eba642ed96bc3e35f5c79d1a831a799d21c9b68b41757699d9c280b14a8a7819b810a5a1a5
|
data/lib/sn_foil/context.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative 'contexts/
|
5
|
-
require_relative 'contexts/
|
6
|
-
require_relative 'contexts/
|
7
|
-
require_relative 'contexts/
|
8
|
-
require_relative 'contexts/
|
9
|
-
require_relative 'contexts/
|
4
|
+
require_relative 'contexts/build_context'
|
5
|
+
require_relative 'contexts/index_context'
|
6
|
+
require_relative 'contexts/show_context'
|
7
|
+
require_relative 'contexts/create_context'
|
8
|
+
require_relative 'contexts/update_context'
|
9
|
+
require_relative 'contexts/destroy_context'
|
10
10
|
|
11
11
|
module SnFoil
|
12
12
|
module Context
|
13
13
|
extend ActiveSupport::Concern
|
14
14
|
|
15
15
|
included do
|
16
|
-
include Contexts::
|
17
|
-
include Contexts::
|
18
|
-
include Contexts::
|
19
|
-
include Contexts::
|
20
|
-
include Contexts::
|
21
|
-
include Contexts::
|
16
|
+
include Contexts::BuildContext
|
17
|
+
include Contexts::IndexContext
|
18
|
+
include Contexts::ShowContext
|
19
|
+
include Contexts::CreateContext
|
20
|
+
include Contexts::UpdateContext
|
21
|
+
include Contexts::DestroyContext
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
5
|
-
require_relative './
|
4
|
+
require_relative './setup_context'
|
5
|
+
require_relative './change_context'
|
6
6
|
|
7
7
|
module SnFoil
|
8
8
|
module Contexts
|
9
|
-
module
|
9
|
+
module BuildContext
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
include
|
14
|
-
include
|
13
|
+
include SetupContext
|
14
|
+
include ChangeContext
|
15
15
|
end
|
16
16
|
|
17
17
|
class_methods do
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
4
|
+
require_relative './setup_context'
|
5
5
|
|
6
6
|
module SnFoil
|
7
7
|
module Contexts
|
8
|
-
module
|
8
|
+
module ChangeContext
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
11
|
included do
|
12
|
-
include
|
12
|
+
include SetupContext
|
13
13
|
end
|
14
14
|
|
15
15
|
class_methods do
|
@@ -90,7 +90,7 @@ module SnFoil
|
|
90
90
|
|
91
91
|
return send(hook[:method], **options) if hook[:method]
|
92
92
|
|
93
|
-
hook[:block]
|
93
|
+
instance_exec options, &hook[:block]
|
94
94
|
end
|
95
95
|
|
96
96
|
def hook_valid?(hook, **options)
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
5
|
-
require_relative './
|
4
|
+
require_relative './setup_context'
|
5
|
+
require_relative './change_context'
|
6
6
|
|
7
7
|
module SnFoil
|
8
8
|
module Contexts
|
9
|
-
module
|
9
|
+
module CreateContext # rubocop:disable Metrics/ModuleLength
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
include
|
14
|
-
include
|
13
|
+
include SetupContext
|
14
|
+
include ChangeContext
|
15
15
|
end
|
16
16
|
|
17
17
|
class_methods do
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
5
|
-
require_relative './
|
4
|
+
require_relative './setup_context'
|
5
|
+
require_relative './change_context'
|
6
6
|
|
7
7
|
module SnFoil
|
8
8
|
module Contexts
|
9
|
-
module
|
9
|
+
module DestroyContext
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
include
|
14
|
-
include
|
13
|
+
include SetupContext
|
14
|
+
include ChangeContext
|
15
15
|
end
|
16
16
|
|
17
17
|
class_methods do
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
4
|
+
require_relative './change_context'
|
5
5
|
|
6
6
|
module SnFoil
|
7
7
|
module Contexts
|
8
|
-
module
|
8
|
+
module IndexContext
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
11
|
included do
|
12
|
-
include
|
12
|
+
include SetupContext
|
13
13
|
end
|
14
14
|
|
15
15
|
class_methods do
|
@@ -5,7 +5,7 @@ require 'active_support/core_ext/string/inflections'
|
|
5
5
|
|
6
6
|
module SnFoil
|
7
7
|
module Contexts
|
8
|
-
module
|
8
|
+
module SetupContext
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
11
|
class_methods do
|
@@ -36,7 +36,9 @@ module SnFoil
|
|
36
36
|
def authorize(object, action, **options)
|
37
37
|
return unless user # Add logging
|
38
38
|
|
39
|
-
lookup_policy(object, options)
|
39
|
+
policy = lookup_policy(object, options)
|
40
|
+
raise Pundit::NotAuthorizedError, query: action, record: object, policy: policy unless policy.public_send(action)
|
41
|
+
true
|
40
42
|
end
|
41
43
|
|
42
44
|
def scope(object_class = nil, **options)
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
4
|
+
require_relative './setup_context'
|
5
5
|
|
6
6
|
module SnFoil
|
7
7
|
module Contexts
|
8
|
-
module
|
8
|
+
module ShowContext
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
11
|
included do
|
12
|
-
include
|
12
|
+
include SetupContext
|
13
13
|
end
|
14
14
|
|
15
15
|
class_methods do
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require_relative './
|
5
|
-
require_relative './
|
4
|
+
require_relative './setup_context'
|
5
|
+
require_relative './change_context'
|
6
6
|
|
7
7
|
module SnFoil
|
8
8
|
module Contexts
|
9
|
-
module
|
9
|
+
module UpdateContext # rubocop:disable Metrics/ModuleLength
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
include
|
14
|
-
include
|
13
|
+
include SetupContext
|
14
|
+
include ChangeContext
|
15
15
|
end
|
16
16
|
|
17
17
|
class_methods do
|
data/lib/sn_foil/policy.rb
CHANGED
@@ -6,10 +6,11 @@ module SnFoil
|
|
6
6
|
module Policy
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
|
-
attr_reader :record, :entity
|
10
|
-
def initialize(record, entity = nil)
|
9
|
+
attr_reader :record, :entity, :options
|
10
|
+
def initialize(record, entity = nil, options = {})
|
11
11
|
@record = record
|
12
12
|
@entity = entity
|
13
|
+
@options = options
|
13
14
|
end
|
14
15
|
|
15
16
|
def index?
|
@@ -32,6 +33,10 @@ module SnFoil
|
|
32
33
|
false
|
33
34
|
end
|
34
35
|
|
36
|
+
def associate?
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
35
40
|
class Scope
|
36
41
|
attr_reader :scope, :entity
|
37
42
|
|
data/lib/sn_foil/searcher.rb
CHANGED
@@ -1,17 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
5
4
|
|
6
5
|
module SnFoil
|
7
6
|
module Searcher
|
8
7
|
extend ActiveSupport::Concern
|
9
8
|
|
10
|
-
included do
|
11
|
-
TRUECAST = 'true'
|
12
|
-
FALSECAST = 'false'
|
13
|
-
end
|
14
|
-
|
15
9
|
class_methods do
|
16
10
|
attr_reader :i_model, :i_setup, :i_filters, :i_search_step
|
17
11
|
|
@@ -96,9 +90,9 @@ module SnFoil
|
|
96
90
|
|
97
91
|
def transform_params_booleans(params)
|
98
92
|
params.map do |key, value|
|
99
|
-
value = if value ==
|
93
|
+
value = if value == 'true'
|
100
94
|
true
|
101
|
-
elsif value ==
|
95
|
+
elsif value == 'false'
|
102
96
|
false
|
103
97
|
else
|
104
98
|
value
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snfoil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Howes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-02-
|
12
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -159,33 +159,19 @@ executables: []
|
|
159
159
|
extensions: []
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
|
-
- ".gitignore"
|
163
|
-
- ".rubocop.yml"
|
164
|
-
- ".ruby-version"
|
165
|
-
- CODE_OF_CONDUCT.md
|
166
|
-
- Gemfile
|
167
|
-
- Gemfile.lock
|
168
|
-
- LICENSE.txt
|
169
|
-
- README.md
|
170
|
-
- Rakefile
|
171
|
-
- bin/console
|
172
|
-
- bin/setup
|
173
|
-
- lib/sn_foil.rb
|
174
162
|
- lib/sn_foil/adapters/orms/active_record.rb
|
175
163
|
- lib/sn_foil/adapters/orms/base_adapter.rb
|
176
164
|
- lib/sn_foil/context.rb
|
177
|
-
- lib/sn_foil/contexts/
|
178
|
-
- lib/sn_foil/contexts/
|
179
|
-
- lib/sn_foil/contexts/
|
180
|
-
- lib/sn_foil/contexts/
|
181
|
-
- lib/sn_foil/contexts/
|
182
|
-
- lib/sn_foil/contexts/
|
183
|
-
- lib/sn_foil/contexts/
|
184
|
-
- lib/sn_foil/contexts/
|
165
|
+
- lib/sn_foil/contexts/build_context.rb
|
166
|
+
- lib/sn_foil/contexts/change_context.rb
|
167
|
+
- lib/sn_foil/contexts/create_context.rb
|
168
|
+
- lib/sn_foil/contexts/destroy_context.rb
|
169
|
+
- lib/sn_foil/contexts/index_context.rb
|
170
|
+
- lib/sn_foil/contexts/setup_context.rb
|
171
|
+
- lib/sn_foil/contexts/show_context.rb
|
172
|
+
- lib/sn_foil/contexts/update_context.rb
|
185
173
|
- lib/sn_foil/policy.rb
|
186
174
|
- lib/sn_foil/searcher.rb
|
187
|
-
- lib/sn_foil/version.rb
|
188
|
-
- snfoil.gemspec
|
189
175
|
homepage: https://github.com/howeszy/snfoil
|
190
176
|
licenses:
|
191
177
|
- MIT
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-rspec
|
3
|
-
|
4
|
-
# ================ Style ===============
|
5
|
-
# TODO: Activate later
|
6
|
-
Style/Documentation:
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
# ================ LINT ================
|
10
|
-
Lint/AmbiguousBlockAssociation:
|
11
|
-
Exclude:
|
12
|
-
- spec/**/*_spec.rb
|
13
|
-
|
14
|
-
# ================ Metics ================
|
15
|
-
Metrics/LineLength:
|
16
|
-
Max: 150
|
17
|
-
|
18
|
-
Metrics/BlockLength:
|
19
|
-
Exclude:
|
20
|
-
- spec/**/*_spec.rb
|
21
|
-
|
22
|
-
# ================ RSPEC ================
|
23
|
-
|
24
|
-
RSpec/MultipleExpectations:
|
25
|
-
Max: 5
|
26
|
-
|
27
|
-
Rspec/NestedGroups:
|
28
|
-
Max: 5
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.6.5
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at howeszy@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
snfoil (0.1.0)
|
5
|
-
activesupport (>= 5.1)
|
6
|
-
logger (~> 1.0)
|
7
|
-
pundit (~> 2.0)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
activesupport (6.0.2.1)
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>= 0.7, < 2)
|
15
|
-
minitest (~> 5.1)
|
16
|
-
tzinfo (~> 1.1)
|
17
|
-
zeitwerk (~> 2.2)
|
18
|
-
ast (2.4.0)
|
19
|
-
byebug (11.0.1)
|
20
|
-
coderay (1.1.2)
|
21
|
-
concurrent-ruby (1.1.5)
|
22
|
-
diff-lcs (1.3)
|
23
|
-
dry-configurable (0.9.0)
|
24
|
-
concurrent-ruby (~> 1.0)
|
25
|
-
dry-core (~> 0.4, >= 0.4.7)
|
26
|
-
dry-container (0.7.2)
|
27
|
-
concurrent-ruby (~> 1.0)
|
28
|
-
dry-configurable (~> 0.1, >= 0.1.3)
|
29
|
-
dry-core (0.4.9)
|
30
|
-
concurrent-ruby (~> 1.0)
|
31
|
-
dry-equalizer (0.3.0)
|
32
|
-
dry-inflector (0.2.0)
|
33
|
-
dry-logic (1.0.5)
|
34
|
-
concurrent-ruby (~> 1.0)
|
35
|
-
dry-core (~> 0.2)
|
36
|
-
dry-equalizer (~> 0.2)
|
37
|
-
dry-struct (1.1.1)
|
38
|
-
dry-core (~> 0.4, >= 0.4.3)
|
39
|
-
dry-equalizer (~> 0.2)
|
40
|
-
dry-types (~> 1.0)
|
41
|
-
ice_nine (~> 0.11)
|
42
|
-
dry-types (1.2.2)
|
43
|
-
concurrent-ruby (~> 1.0)
|
44
|
-
dry-container (~> 0.3)
|
45
|
-
dry-core (~> 0.4, >= 0.4.4)
|
46
|
-
dry-equalizer (~> 0.3)
|
47
|
-
dry-inflector (~> 0.1, >= 0.1.2)
|
48
|
-
dry-logic (~> 1.0, >= 1.0.2)
|
49
|
-
i18n (1.8.2)
|
50
|
-
concurrent-ruby (~> 1.0)
|
51
|
-
ice_nine (0.11.2)
|
52
|
-
jaro_winkler (1.5.4)
|
53
|
-
logger (1.4.2)
|
54
|
-
method_source (0.9.2)
|
55
|
-
minitest (5.14.0)
|
56
|
-
parallel (1.19.0)
|
57
|
-
parser (2.6.5.0)
|
58
|
-
ast (~> 2.4.0)
|
59
|
-
pry (0.12.2)
|
60
|
-
coderay (~> 1.1.0)
|
61
|
-
method_source (~> 0.9.0)
|
62
|
-
pry-byebug (3.7.0)
|
63
|
-
byebug (~> 11.0)
|
64
|
-
pry (~> 0.10)
|
65
|
-
pundit (2.1.0)
|
66
|
-
activesupport (>= 3.0.0)
|
67
|
-
rainbow (3.0.0)
|
68
|
-
rake (13.0.1)
|
69
|
-
rspec (3.9.0)
|
70
|
-
rspec-core (~> 3.9.0)
|
71
|
-
rspec-expectations (~> 3.9.0)
|
72
|
-
rspec-mocks (~> 3.9.0)
|
73
|
-
rspec-core (3.9.0)
|
74
|
-
rspec-support (~> 3.9.0)
|
75
|
-
rspec-expectations (3.9.0)
|
76
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
-
rspec-support (~> 3.9.0)
|
78
|
-
rspec-mocks (3.9.0)
|
79
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.9.0)
|
81
|
-
rspec-support (3.9.0)
|
82
|
-
rubocop (0.76.0)
|
83
|
-
jaro_winkler (~> 1.5.1)
|
84
|
-
parallel (~> 1.10)
|
85
|
-
parser (>= 2.6)
|
86
|
-
rainbow (>= 2.2.2, < 4.0)
|
87
|
-
ruby-progressbar (~> 1.7)
|
88
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
89
|
-
rubocop-rspec (1.36.0)
|
90
|
-
rubocop (>= 0.68.1)
|
91
|
-
ruby-progressbar (1.10.1)
|
92
|
-
thread_safe (0.3.6)
|
93
|
-
tzinfo (1.2.6)
|
94
|
-
thread_safe (~> 0.1)
|
95
|
-
unicode-display_width (1.6.0)
|
96
|
-
zeitwerk (2.2.2)
|
97
|
-
|
98
|
-
PLATFORMS
|
99
|
-
ruby
|
100
|
-
|
101
|
-
DEPENDENCIES
|
102
|
-
bundler (~> 2.0)
|
103
|
-
dry-struct (~> 1.0)
|
104
|
-
pry-byebug (~> 3.0)
|
105
|
-
rake (~> 13.0)
|
106
|
-
rspec (~> 3.9)
|
107
|
-
rubocop (~> 0.76.0)
|
108
|
-
rubocop-rspec (~> 1.36.0)
|
109
|
-
snfoil!
|
110
|
-
|
111
|
-
BUNDLED WITH
|
112
|
-
2.0.2
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2019 Matthew Howes
|
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.
|
data/README.md
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# Sn::Foil
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sn_foil`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'snfoil'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install snfoil
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/snfoil. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the Sn::Foil project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/snfoil/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'sn_foil'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/lib/sn_foil/version.rb
DELETED
data/lib/sn_foil.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'logger'
|
4
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
5
|
-
require 'sn_foil/context'
|
6
|
-
require 'sn_foil/policy'
|
7
|
-
require 'sn_foil/searcher'
|
8
|
-
require 'sn_foil/version'
|
9
|
-
|
10
|
-
module SnFoil
|
11
|
-
class Error < StandardError; end
|
12
|
-
|
13
|
-
mattr_accessor :orm, default: 'active_record'
|
14
|
-
mattr_writer :logger
|
15
|
-
|
16
|
-
class << self
|
17
|
-
def logger
|
18
|
-
@logger ||= Logger.new($stdout).tap do |log|
|
19
|
-
log.progname = name
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def adapter
|
24
|
-
return @adapter if @adapter
|
25
|
-
|
26
|
-
@adapter ||= if orm.instance_of?(String) || orm.instance_of?(Symbol)
|
27
|
-
if Object.const_defined?("SnFoil::Adapters::ORMs::#{orm.camelcase}")
|
28
|
-
"SnFoil::Adapters::ORMs::#{orm.camelcase}".constantize
|
29
|
-
else
|
30
|
-
orm.constantize
|
31
|
-
end
|
32
|
-
else
|
33
|
-
orm
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def configure
|
38
|
-
yield self
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/snfoil.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'sn_foil/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
8
|
-
spec.name = 'snfoil'
|
9
|
-
spec.version = SnFoil::VERSION
|
10
|
-
spec.authors = ['Matthew Howes', 'Danny Murphy']
|
11
|
-
spec.email = ['howeszy@gmail.com', 'dmurph24@gmail.com']
|
12
|
-
spec.summary = 'A boilerplate gem for providing basic contexts'
|
13
|
-
spec.homepage = 'https://github.com/howeszy/snfoil'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
spec.bindir = 'exe'
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = ['lib']
|
24
|
-
|
25
|
-
spec.add_dependency 'activesupport', '>= 5.1'
|
26
|
-
spec.add_dependency 'logger', '~> 1.0'
|
27
|
-
spec.add_dependency 'pundit', '~> 2.0'
|
28
|
-
|
29
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
30
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
31
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
32
|
-
spec.add_development_dependency 'rspec', '~> 3.9'
|
33
|
-
spec.add_development_dependency 'rubocop', '~> 0.76.0'
|
34
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.36.0'
|
35
|
-
spec.add_development_dependency 'dry-struct', '~> 1.0'
|
36
|
-
end
|