thumbor_helpers 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c43665acba064ebb65e0b6c35c23b0c0c97bd295979d019ae86def6e8df9465f
4
+ data.tar.gz: 3b0658e26c608185978ff8cbee7de339c8e8e3b9ac2c741c66ace2b4a62e646a
5
+ SHA512:
6
+ metadata.gz: 0d266f2a3b1122aa899bc3d160cafb38a9e4e75240019cd2bf3ceec8379c96f5538b2248d02e3e7289aaac4420313fd6c0696245a100503e92f42df1c2f11e3a
7
+ data.tar.gz: 9c44ef26932a6cc6e4680c6c9851de7988677c5f36d37305328572551242375caa9a909521b51e5c21fd7ae0744a1ae19498fe66171c2d0889f89fe08495181a
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
4
+ --order rand
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.2
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source "https://rubygems.org"
2
+
3
+
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "rspec-rails", "~> 6.0.0.rc1"
8
+ gem 'standard', group: 'development'
9
+ gem 'simplecov', group: 'development'
10
+
11
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
12
+ gem 'rails', '~> 6.1.6'
13
+ gem 'sqlite3'
14
+ # Use Puma as the app server
15
+ gem 'puma', '~> 5.0'
16
+ # Use SCSS for stylesheets
17
+ gem 'sass-rails', '>= 6'
18
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
19
+ gem 'jbuilder', '~> 2.7'
20
+ # Use Active Model has_secure_password
21
+ # gem 'bcrypt', '~> 3.1.7'
22
+
23
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
24
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
25
+
26
+ gem 'alchemy_cms'
27
+ gem 'alchemy-devise'
28
+
29
+ # Specify your gem's dependencies in thumbor_helpers.gemspec
30
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,359 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ thumbor_helpers (0.1.0)
5
+ ruby-thumbor (>= 4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.1.6)
11
+ actionpack (= 6.1.6)
12
+ activesupport (= 6.1.6)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.1.6)
16
+ actionpack (= 6.1.6)
17
+ activejob (= 6.1.6)
18
+ activerecord (= 6.1.6)
19
+ activestorage (= 6.1.6)
20
+ activesupport (= 6.1.6)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.6)
23
+ actionpack (= 6.1.6)
24
+ actionview (= 6.1.6)
25
+ activejob (= 6.1.6)
26
+ activesupport (= 6.1.6)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.1.6)
30
+ actionview (= 6.1.6)
31
+ activesupport (= 6.1.6)
32
+ rack (~> 2.0, >= 2.0.9)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.6)
37
+ actionpack (= 6.1.6)
38
+ activerecord (= 6.1.6)
39
+ activestorage (= 6.1.6)
40
+ activesupport (= 6.1.6)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.6)
43
+ activesupport (= 6.1.6)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ active_model_serializers (0.10.13)
49
+ actionpack (>= 4.1, < 7.1)
50
+ activemodel (>= 4.1, < 7.1)
51
+ case_transform (>= 0.2)
52
+ jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
53
+ activejob (6.1.6)
54
+ activesupport (= 6.1.6)
55
+ globalid (>= 0.3.6)
56
+ activemodel (6.1.6)
57
+ activesupport (= 6.1.6)
58
+ activerecord (6.1.6)
59
+ activemodel (= 6.1.6)
60
+ activesupport (= 6.1.6)
61
+ activestorage (6.1.6)
62
+ actionpack (= 6.1.6)
63
+ activejob (= 6.1.6)
64
+ activerecord (= 6.1.6)
65
+ activesupport (= 6.1.6)
66
+ marcel (~> 1.0)
67
+ mini_mime (>= 1.1.0)
68
+ activesupport (6.1.6)
69
+ concurrent-ruby (~> 1.0, >= 1.0.2)
70
+ i18n (>= 1.6, < 2)
71
+ minitest (>= 5.1)
72
+ tzinfo (~> 2.0)
73
+ zeitwerk (~> 2.3)
74
+ acts_as_list (1.0.4)
75
+ activerecord (>= 4.2)
76
+ addressable (2.8.0)
77
+ public_suffix (>= 2.0.2, < 5.0)
78
+ alchemy-devise (6.0.0)
79
+ alchemy_cms (>= 5.0.0, < 6.1)
80
+ devise (>= 4.7.1, < 5)
81
+ alchemy_cms (6.0.6)
82
+ actionmailer (>= 6.0, < 7.1)
83
+ actionpack (>= 6.0, < 7.1)
84
+ actionview (>= 6.0, < 7.1)
85
+ active_model_serializers (~> 0.10.0)
86
+ activejob (>= 6.0, < 7.1)
87
+ activemodel (>= 6.0, < 7.1)
88
+ activerecord (>= 6.0, < 7.1)
89
+ activesupport (>= 6.0, < 7.1)
90
+ acts_as_list (>= 0.3, < 2)
91
+ awesome_nested_set (~> 3.1)
92
+ cancancan (>= 2.1, < 4.0)
93
+ coffee-rails (>= 4.0, < 6.0)
94
+ dragonfly (~> 1.4)
95
+ dragonfly_svg (~> 0.0.4)
96
+ gutentag (~> 2.2, >= 2.2.1)
97
+ handlebars_assets (~> 0.23)
98
+ jquery-rails (~> 4.0, >= 4.0.4)
99
+ jquery-ui-rails (~> 6.0)
100
+ kaminari (~> 1.1)
101
+ non-stupid-digest-assets (~> 1.0.8)
102
+ originator (~> 3.1)
103
+ railties (>= 6.0, < 7.1)
104
+ ransack (>= 1.8, < 4.0)
105
+ request_store (~> 1.2)
106
+ responders (>= 2.0, < 4.0)
107
+ sassc-rails (~> 2.1)
108
+ simple_form (>= 4.0, < 6)
109
+ sprockets (>= 3.0, < 5)
110
+ turbolinks (>= 2.5)
111
+ webpacker (>= 4.0, < 6)
112
+ ast (2.4.2)
113
+ awesome_nested_set (3.5.0)
114
+ activerecord (>= 4.0.0, < 7.1)
115
+ bcrypt (3.1.18)
116
+ builder (3.2.4)
117
+ cancancan (3.3.0)
118
+ case_transform (0.2)
119
+ activesupport
120
+ coffee-rails (5.0.0)
121
+ coffee-script (>= 2.2.0)
122
+ railties (>= 5.2.0)
123
+ coffee-script (2.4.1)
124
+ coffee-script-source
125
+ execjs
126
+ coffee-script-source (1.12.2)
127
+ concurrent-ruby (1.1.10)
128
+ crass (1.0.6)
129
+ devise (4.8.1)
130
+ bcrypt (~> 3.0)
131
+ orm_adapter (~> 0.1)
132
+ railties (>= 4.1.0)
133
+ responders
134
+ warden (~> 1.2.3)
135
+ diff-lcs (1.5.0)
136
+ docile (1.4.0)
137
+ dragonfly (1.4.0)
138
+ addressable (~> 2.3)
139
+ multi_json (~> 1.0)
140
+ rack (>= 1.3)
141
+ dragonfly_svg (0.0.4)
142
+ dragonfly (~> 1.0)
143
+ nokogiri
144
+ erubi (1.10.0)
145
+ execjs (2.8.1)
146
+ ffi (1.15.5)
147
+ globalid (1.0.0)
148
+ activesupport (>= 5.0)
149
+ gutentag (2.6.1)
150
+ activerecord (>= 3.2.0)
151
+ handlebars_assets (0.23.9)
152
+ execjs (~> 2.0)
153
+ sprockets (>= 2.0.0)
154
+ tilt (>= 1.2)
155
+ i18n (1.10.0)
156
+ concurrent-ruby (~> 1.0)
157
+ jbuilder (2.11.5)
158
+ actionview (>= 5.0.0)
159
+ activesupport (>= 5.0.0)
160
+ jquery-rails (4.5.0)
161
+ rails-dom-testing (>= 1, < 3)
162
+ railties (>= 4.2.0)
163
+ thor (>= 0.14, < 2.0)
164
+ jquery-ui-rails (6.0.1)
165
+ railties (>= 3.2.16)
166
+ jsonapi-renderer (0.2.2)
167
+ kaminari (1.2.2)
168
+ activesupport (>= 4.1.0)
169
+ kaminari-actionview (= 1.2.2)
170
+ kaminari-activerecord (= 1.2.2)
171
+ kaminari-core (= 1.2.2)
172
+ kaminari-actionview (1.2.2)
173
+ actionview
174
+ kaminari-core (= 1.2.2)
175
+ kaminari-activerecord (1.2.2)
176
+ activerecord
177
+ kaminari-core (= 1.2.2)
178
+ kaminari-core (1.2.2)
179
+ loofah (2.18.0)
180
+ crass (~> 1.0.2)
181
+ nokogiri (>= 1.5.9)
182
+ mail (2.7.1)
183
+ mini_mime (>= 0.1.1)
184
+ marcel (1.0.2)
185
+ method_source (1.0.0)
186
+ mini_mime (1.1.2)
187
+ mini_portile2 (2.8.0)
188
+ minitest (5.15.0)
189
+ multi_json (1.15.0)
190
+ nio4r (2.5.8)
191
+ nokogiri (1.13.6)
192
+ mini_portile2 (~> 2.8.0)
193
+ racc (~> 1.4)
194
+ non-stupid-digest-assets (1.0.9)
195
+ sprockets (>= 2.0)
196
+ originator (3.1)
197
+ actionpack (>= 4.0)
198
+ activerecord (>= 4.0)
199
+ orm_adapter (0.5.0)
200
+ parallel (1.22.1)
201
+ parser (3.1.2.0)
202
+ ast (~> 2.4.1)
203
+ public_suffix (4.0.7)
204
+ puma (5.6.4)
205
+ nio4r (~> 2.0)
206
+ racc (1.6.0)
207
+ rack (2.2.3.1)
208
+ rack-proxy (0.7.2)
209
+ rack
210
+ rack-test (1.1.0)
211
+ rack (>= 1.0, < 3)
212
+ rails (6.1.6)
213
+ actioncable (= 6.1.6)
214
+ actionmailbox (= 6.1.6)
215
+ actionmailer (= 6.1.6)
216
+ actionpack (= 6.1.6)
217
+ actiontext (= 6.1.6)
218
+ actionview (= 6.1.6)
219
+ activejob (= 6.1.6)
220
+ activemodel (= 6.1.6)
221
+ activerecord (= 6.1.6)
222
+ activestorage (= 6.1.6)
223
+ activesupport (= 6.1.6)
224
+ bundler (>= 1.15.0)
225
+ railties (= 6.1.6)
226
+ sprockets-rails (>= 2.0.0)
227
+ rails-dom-testing (2.0.3)
228
+ activesupport (>= 4.2.0)
229
+ nokogiri (>= 1.6)
230
+ rails-html-sanitizer (1.4.2)
231
+ loofah (~> 2.3)
232
+ railties (6.1.6)
233
+ actionpack (= 6.1.6)
234
+ activesupport (= 6.1.6)
235
+ method_source
236
+ rake (>= 12.2)
237
+ thor (~> 1.0)
238
+ rainbow (3.1.1)
239
+ rake (12.3.3)
240
+ ransack (3.2.1)
241
+ activerecord (>= 6.1.5)
242
+ activesupport (>= 6.1.5)
243
+ i18n
244
+ regexp_parser (2.5.0)
245
+ request_store (1.5.1)
246
+ rack (>= 1.4)
247
+ responders (3.0.1)
248
+ actionpack (>= 5.0)
249
+ railties (>= 5.0)
250
+ rexml (3.2.5)
251
+ rspec (3.11.0)
252
+ rspec-core (~> 3.11.0)
253
+ rspec-expectations (~> 3.11.0)
254
+ rspec-mocks (~> 3.11.0)
255
+ rspec-core (3.11.0)
256
+ rspec-support (~> 3.11.0)
257
+ rspec-expectations (3.11.0)
258
+ diff-lcs (>= 1.2.0, < 2.0)
259
+ rspec-support (~> 3.11.0)
260
+ rspec-mocks (3.11.1)
261
+ diff-lcs (>= 1.2.0, < 2.0)
262
+ rspec-support (~> 3.11.0)
263
+ rspec-rails (6.0.0.rc1)
264
+ actionpack (>= 6.1)
265
+ activesupport (>= 6.1)
266
+ railties (>= 6.1)
267
+ rspec-core (~> 3.11)
268
+ rspec-expectations (~> 3.11)
269
+ rspec-mocks (~> 3.11)
270
+ rspec-support (~> 3.11)
271
+ rspec-support (3.11.0)
272
+ rubocop (1.29.1)
273
+ parallel (~> 1.10)
274
+ parser (>= 3.1.0.0)
275
+ rainbow (>= 2.2.2, < 4.0)
276
+ regexp_parser (>= 1.8, < 3.0)
277
+ rexml (>= 3.2.5, < 4.0)
278
+ rubocop-ast (>= 1.17.0, < 2.0)
279
+ ruby-progressbar (~> 1.7)
280
+ unicode-display_width (>= 1.4.0, < 3.0)
281
+ rubocop-ast (1.18.0)
282
+ parser (>= 3.1.1.0)
283
+ rubocop-performance (1.13.3)
284
+ rubocop (>= 1.7.0, < 2.0)
285
+ rubocop-ast (>= 0.4.0)
286
+ ruby-progressbar (1.11.0)
287
+ ruby-thumbor (4.0.2)
288
+ sass-rails (6.0.0)
289
+ sassc-rails (~> 2.1, >= 2.1.1)
290
+ sassc (2.4.0)
291
+ ffi (~> 1.9)
292
+ sassc-rails (2.1.2)
293
+ railties (>= 4.0.0)
294
+ sassc (>= 2.0)
295
+ sprockets (> 3.0)
296
+ sprockets-rails
297
+ tilt
298
+ semantic_range (3.0.0)
299
+ simple_form (5.1.0)
300
+ actionpack (>= 5.2)
301
+ activemodel (>= 5.2)
302
+ simplecov (0.21.2)
303
+ docile (~> 1.1)
304
+ simplecov-html (~> 0.11)
305
+ simplecov_json_formatter (~> 0.1)
306
+ simplecov-html (0.12.3)
307
+ simplecov_json_formatter (0.1.4)
308
+ sprockets (4.0.3)
309
+ concurrent-ruby (~> 1.0)
310
+ rack (> 1, < 3)
311
+ sprockets-rails (3.4.2)
312
+ actionpack (>= 5.2)
313
+ activesupport (>= 5.2)
314
+ sprockets (>= 3.0.0)
315
+ sqlite3 (1.4.2)
316
+ standard (1.12.1)
317
+ rubocop (= 1.29.1)
318
+ rubocop-performance (= 1.13.3)
319
+ thor (1.2.1)
320
+ tilt (2.0.10)
321
+ turbolinks (5.2.1)
322
+ turbolinks-source (~> 5.2)
323
+ turbolinks-source (5.2.0)
324
+ tzinfo (2.0.4)
325
+ concurrent-ruby (~> 1.0)
326
+ unicode-display_width (2.1.0)
327
+ warden (1.2.9)
328
+ rack (>= 2.0.9)
329
+ webpacker (5.4.3)
330
+ activesupport (>= 5.2)
331
+ rack-proxy (>= 0.6.1)
332
+ railties (>= 5.2)
333
+ semantic_range (>= 2.3.0)
334
+ websocket-driver (0.7.5)
335
+ websocket-extensions (>= 0.1.0)
336
+ websocket-extensions (0.1.5)
337
+ zeitwerk (2.5.4)
338
+
339
+ PLATFORMS
340
+ ruby
341
+
342
+ DEPENDENCIES
343
+ alchemy-devise
344
+ alchemy_cms
345
+ jbuilder (~> 2.7)
346
+ puma (~> 5.0)
347
+ rails (~> 6.1.6)
348
+ rake (~> 12.0)
349
+ rspec (~> 3.0)
350
+ rspec-rails (~> 6.0.0.rc1)
351
+ sass-rails (>= 6)
352
+ simplecov
353
+ sqlite3
354
+ standard
355
+ thumbor_helpers!
356
+ tzinfo-data
357
+
358
+ BUNDLED WITH
359
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Marino Bonetti
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 ADDED
@@ -0,0 +1,51 @@
1
+ # ThumborHelpers - WIP
2
+
3
+ A collection of helpers/overrides to simplify live for use thumbor with rails and alchemy.
4
+ The concept is to install the gem in a project and without change of code have access
5
+ to features of thumbor.
6
+
7
+ Thumbor documentation: https://thumbor.readthedocs.io/en/latest/index.html
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'thumbor_helpers'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ And then install the initializer:
22
+
23
+ $ bin/rails generate thumbor_helpers:initializer
24
+
25
+ Now go in config/initializers and configure the thumbors with the server creadentials.
26
+
27
+ ## Usage
28
+
29
+ TODO: Write usage instructions here
30
+
31
+ ## Development
32
+
33
+ Start a thumbor server with the command:
34
+
35
+ ```shell
36
+ docker run --network host -e THUMBOR_PORT=8888 -e SECURITY_KEY='1234567890123456' -e ALLOW_UNSAFE_URL=0 minimalcompact/thumbor thumbor
37
+ ```
38
+
39
+ ## Version Release
40
+
41
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
42
+ 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).
43
+
44
+ ## Contributing
45
+
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/thumbor_helpers.
47
+
48
+
49
+ ## License
50
+
51
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Create the initializer for configuration of the plugin
3
+
4
+ Example:
5
+ bin/rails generate thumbor_helpers:initializer
6
+
7
+ This will create:
8
+ config/initializers/thumbor_helpers.rb
@@ -0,0 +1,10 @@
1
+ module ThumborHelpers
2
+ class InitializerGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates', __dir__)
4
+
5
+ def copy_initializer_file
6
+ copy_file "initializer.rb", "config/initializers/thumbor_helpers.rb"
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ ThumborHelpers.setup do |c|
2
+ if ENV.key?("THUMBOR_SECURITY_KEY") and ENV.key?("THUMBOR_URL")
3
+ c.server_url = ENV.fetch("THUMBOR_URL")
4
+ c.security_key = ENV.fetch("THUMBOR_SECURITY_KEY")
5
+ c.enabled = ENV.key?("THUMBOR_ENABLED")
6
+ end
7
+ c.image_root_host = ENV.fetch("SITE_IMAGE_ROOT_HOST", "http://0.0.0.0:3000")
8
+ end
@@ -0,0 +1,21 @@
1
+ module ThumborHelpers
2
+ module AlchemyOverrides
3
+ ##
4
+ # Override Alchemy::Picture
5
+ module Picture
6
+
7
+ def url(options = {})
8
+ url = super(options)
9
+
10
+ if ThumborHelpers.config.enabled?
11
+ escaped = CGI.escape("#{ThumborHelpers.config.image_root_host}#{url}")
12
+ encrypted_request = ThumborHelpers.config.cripto_generator.generate(image: escaped)
13
+ "#{ThumborHelpers.config.server_url}#{encrypted_request}"
14
+ else
15
+ url
16
+ end
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,43 @@
1
+ require 'ruby-thumbor'
2
+
3
+ module ThumborHelpers
4
+ class Config
5
+
6
+ ##
7
+ # Identifica l'host di thumbor
8
+ # @return [String]
9
+ # ES:
10
+ # https://thumbor.archimedianet.it
11
+ attr_accessor :server_url
12
+
13
+ ##
14
+ # Chiave per generare l'url correttamente criptato per thumbor
15
+ # @return [String]
16
+ attr_accessor :security_key
17
+
18
+ ##
19
+ # Definisce se l'override è attivo o meno
20
+ # @return [Boolean]
21
+ attr_accessor :enabled
22
+
23
+ ##
24
+ # Dominio dove andare a cercare l'immagine
25
+ # @return [String]
26
+ attr_accessor :image_root_host
27
+
28
+ attr_reader :cripto_generator
29
+
30
+ def initialize
31
+ @enabled = false
32
+ reconfigure_thumbor
33
+ end
34
+
35
+ def reconfigure_thumbor
36
+ @cripto_generator = Thumbor::CryptoURL.new(@security_key)
37
+ nil
38
+ end
39
+
40
+ alias enabled? enabled
41
+
42
+ end
43
+ end
@@ -0,0 +1,12 @@
1
+ module ThumborHelper
2
+ class Railtie < Rails::Railtie
3
+
4
+ config.to_prepare do
5
+ Alchemy::Picture.prepend ThumborHelpers::AlchemyOverrides::Picture
6
+ end
7
+
8
+ # config.after_initialize do
9
+ #
10
+ # end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module ThumborHelpers
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,23 @@
1
+ require "thumbor_helpers/version"
2
+ require "thumbor_helpers/config"
3
+ require "thumbor_helpers/alchemy_overrides/picture"
4
+ require "thumbor_helpers/railtie" if defined?(Rails::Railtie)
5
+
6
+ module ThumborHelpers
7
+ class Error < StandardError; end
8
+
9
+ @@config = ThumborHelpers::Config.new
10
+
11
+ ##
12
+ # Setup della gemma
13
+ def self.setup
14
+ yield @@config
15
+
16
+ @@config.reconfigure_thumbor
17
+ end
18
+
19
+ # @return [ThumborHelpers::Config]
20
+ def self.config
21
+ @@config
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'lib/thumbor_helpers/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "thumbor_helpers"
5
+ spec.version = ThumborHelpers::VERSION
6
+ spec.authors = ["Marino Bonetti"]
7
+ spec.email = ["marinobonetti@gmail.com"]
8
+
9
+ spec.summary = %q{collection of helpers to simplify live for use thumbor with rails and alchemy}
10
+ spec.description = %q{collection of helpers to simplify live for use thumbor with rails and alchemy}
11
+ spec.homepage = "https://github.com/ArchimediaZerogroup/ThumborHelpers"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/ArchimediaZerogroup/ThumborHelpers"
19
+ spec.metadata["changelog_uri"] = "https://github.com/ArchimediaZerogroup/ThumborHelpers/CHANGELOG"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_dependency "ruby-thumbor", ">= 4"
29
+
30
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thumbor_helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marino Bonetti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-thumbor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ description: collection of helpers to simplify live for use thumbor with rails and
28
+ alchemy
29
+ email:
30
+ - marinobonetti@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - ".travis.yml"
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - lib/generators/thumbor_helpers/initializer/USAGE
44
+ - lib/generators/thumbor_helpers/initializer/initializer_generator.rb
45
+ - lib/generators/thumbor_helpers/initializer/templates/initializer.rb
46
+ - lib/thumbor_helpers.rb
47
+ - lib/thumbor_helpers/alchemy_overrides/picture.rb
48
+ - lib/thumbor_helpers/config.rb
49
+ - lib/thumbor_helpers/railtie.rb
50
+ - lib/thumbor_helpers/version.rb
51
+ - thumbor_helpers.gemspec
52
+ homepage: https://github.com/ArchimediaZerogroup/ThumborHelpers
53
+ licenses:
54
+ - MIT
55
+ metadata:
56
+ allowed_push_host: https://rubygems.org
57
+ homepage_uri: https://github.com/ArchimediaZerogroup/ThumborHelpers
58
+ source_code_uri: https://github.com/ArchimediaZerogroup/ThumborHelpers
59
+ changelog_uri: https://github.com/ArchimediaZerogroup/ThumborHelpers/CHANGELOG
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.3.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.1.4
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: collection of helpers to simplify live for use thumbor with rails and alchemy
79
+ test_files: []