snfoil-controller 1.1.2 → 1.1.4
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 +4 -4
- data/Dockerfile +18 -0
- data/Gemfile +6 -6
- data/docker-compose.yaml +11 -0
- data/lib/snfoil/controller/version.rb +1 -1
- data/lib/snfoil/deserializer/json.rb +15 -3
- data/lib/snfoil/deserializer/jsonapi.rb +1 -1
- data/snfoil-controller.gemspec +2 -2
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 538a1fd0f1cc8d07a2c1c176a8f75976b00f533650566b8d43ae54de2bca5391
|
4
|
+
data.tar.gz: ea8edd0a7cb0877042b49462c3b569b116acf37a925ffbc4476eff5c296b51e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4049035530b425c2d0fff1e229d50fb62ec46a287089da6aae879d10ef40555ba83a723e085509c80455f11ccf0d7a6fdb7046aa3babfbce7f7428abfbc23496
|
7
|
+
data.tar.gz: 470d872c8d035c9b7babac7fd51e1861dc66677500714a9f33d1646dd44ce5a7e7b0990ed89822805cab1086b732750f77f3021bdfd5c042847af55d97e250bb
|
data/Dockerfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
ARG RUBY_VERSION=3.4.3
|
2
|
+
|
3
|
+
FROM ruby:${RUBY_VERSION}-slim
|
4
|
+
|
5
|
+
RUN apt update && \
|
6
|
+
apt install -y --no-install-recommends \
|
7
|
+
build-essential \
|
8
|
+
libyaml-dev \
|
9
|
+
git \
|
10
|
+
curl
|
11
|
+
|
12
|
+
WORKDIR /workspace
|
13
|
+
|
14
|
+
COPY . .
|
15
|
+
|
16
|
+
RUN bundle install
|
17
|
+
|
18
|
+
CMD ["bundle", "exec", "rspec"]
|
data/Gemfile
CHANGED
@@ -6,12 +6,12 @@ source 'https://rubygems.org'
|
|
6
6
|
gemspec
|
7
7
|
|
8
8
|
group :development, :text do
|
9
|
-
gem '
|
10
|
-
gem '
|
11
|
-
gem '
|
9
|
+
gem 'bundler-audit', '~> 0.9.0'
|
10
|
+
gem 'debug', '~> 1.10'
|
11
|
+
gem 'fasterer', '~> 0.11.0'
|
12
12
|
gem 'rake', '~> 13.0'
|
13
13
|
gem 'rspec', '~> 3.10'
|
14
|
-
gem 'rubocop', '1.
|
15
|
-
gem 'rubocop-performance', '1.
|
16
|
-
gem 'rubocop-rspec', '
|
14
|
+
gem 'rubocop', '~> 1.75'
|
15
|
+
gem 'rubocop-performance', '~> 1.25'
|
16
|
+
gem 'rubocop-rspec', '~> 3.6'
|
17
17
|
end
|
data/docker-compose.yaml
ADDED
@@ -28,7 +28,7 @@ module SnFoil
|
|
28
28
|
module JSON
|
29
29
|
extend ActiveSupport::Concern
|
30
30
|
|
31
|
-
included do # rubocop:disable Metrics/BlockLength reason: These methods need to be in included to be overridable
|
31
|
+
included do # rubocop:disable Metrics/BlockLength --- reason: These methods need to be in included to be overridable
|
32
32
|
include SnFoil::Deserializer::Base
|
33
33
|
|
34
34
|
def parse
|
@@ -46,7 +46,19 @@ module SnFoil
|
|
46
46
|
|
47
47
|
def apply_transforms(output, input)
|
48
48
|
(self.class.snfoil_attribute_transforms || {}).reduce(output) do |transformed_output, transform|
|
49
|
-
|
49
|
+
transform_options = transform[1]
|
50
|
+
next transformed_output if transform_options[:if] && !check_conditional(transform_options[:if], input)
|
51
|
+
next transformed_output if transform_options[:unless] && check_conditional(transform_options[:unless], input)
|
52
|
+
|
53
|
+
apply_transform(transformed_output, input, transform[0], **transform_options)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def check_conditional(conditional, input)
|
58
|
+
if conditional.is_a? Symbol
|
59
|
+
send(conditional, input)
|
60
|
+
else
|
61
|
+
instance_exec(input, &conditional)
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
@@ -99,7 +111,7 @@ module SnFoil
|
|
99
111
|
|
100
112
|
def find_by_key(input, key, **options)
|
101
113
|
value_key = options.fetch(:key) { key }
|
102
|
-
value_key = "#{options[:prefix]}#{key}"
|
114
|
+
value_key = :"#{options[:prefix]}#{key}" if options[:prefix]
|
103
115
|
|
104
116
|
if options[:namespace]
|
105
117
|
input.dig(*options[:namespace], value_key.to_sym)
|
@@ -28,7 +28,7 @@ module SnFoil
|
|
28
28
|
module JSONAPI
|
29
29
|
extend ActiveSupport::Concern
|
30
30
|
|
31
|
-
included do # rubocop:disable Metrics/BlockLength reason: These methods need to be in included to be overridable
|
31
|
+
included do # rubocop:disable Metrics/BlockLength --- reason: These methods need to be in included to be overridable
|
32
32
|
include SnFoil::Deserializer::JSON
|
33
33
|
|
34
34
|
def parse
|
data/snfoil-controller.gemspec
CHANGED
@@ -6,13 +6,13 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'snfoil-controller'
|
7
7
|
spec.version = SnFoil::Controller::VERSION
|
8
8
|
spec.authors = ['Matthew Howes', 'Cliff Campbell']
|
9
|
-
spec.email = ['
|
9
|
+
spec.email = ['matt.howes@limitedeffort.io', 'cliffcampbell@hey.com']
|
10
10
|
|
11
11
|
spec.summary = 'Seperate Display Logic from Business Logic'
|
12
12
|
spec.description = 'A context-like experience for your controllers'
|
13
13
|
spec.homepage = 'https://github.com/limited-effort/snfoil-controller'
|
14
14
|
spec.license = 'Apache-2.0'
|
15
|
-
spec.required_ruby_version = '>=
|
15
|
+
spec.required_ruby_version = '>= 3.0'
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
18
|
spec.metadata['source_code_uri'] = spec.homepage
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snfoil-controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Howes
|
8
8
|
- Cliff Campbell
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
@@ -47,7 +46,7 @@ dependencies:
|
|
47
46
|
version: '2.0'
|
48
47
|
description: A context-like experience for your controllers
|
49
48
|
email:
|
50
|
-
-
|
49
|
+
- matt.howes@limitedeffort.io
|
51
50
|
- cliffcampbell@hey.com
|
52
51
|
executables: []
|
53
52
|
extensions: []
|
@@ -55,9 +54,11 @@ extra_rdoc_files: []
|
|
55
54
|
files:
|
56
55
|
- CHANGELOG.md
|
57
56
|
- CODE_OF_CONDUCT.md
|
57
|
+
- Dockerfile
|
58
58
|
- Gemfile
|
59
59
|
- LICENSE.txt
|
60
60
|
- README.md
|
61
|
+
- docker-compose.yaml
|
61
62
|
- lib/snfoil/controller.rb
|
62
63
|
- lib/snfoil/controller/version.rb
|
63
64
|
- lib/snfoil/deserializer/base.rb
|
@@ -72,7 +73,6 @@ metadata:
|
|
72
73
|
source_code_uri: https://github.com/limited-effort/snfoil-controller
|
73
74
|
changelog_uri: https://github.com/limited-effort/snfoil-controller/blob/main/CHANGELOG.md
|
74
75
|
rubygems_mfa_required: 'true'
|
75
|
-
post_install_message:
|
76
76
|
rdoc_options: []
|
77
77
|
require_paths:
|
78
78
|
- lib
|
@@ -80,15 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '3.0'
|
84
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
91
|
-
signing_key:
|
90
|
+
rubygems_version: 3.6.7
|
92
91
|
specification_version: 4
|
93
92
|
summary: Seperate Display Logic from Business Logic
|
94
93
|
test_files: []
|