jt-rails-toolbox 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jt-rails-toolbox.gemspec +1 -1
- data/lib/generators/jt/toolbox/templates/jt-toolbox.yml +4 -0
- data/lib/jt-rails-toolbox.rb +15 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8efeb85d5103a77b383af309a088ff46ba4c0f06
|
4
|
+
data.tar.gz: ec59f9e4bbe1e748fc538bc830ee373beb0f098b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ca76fb38baeff44a943aaf7753a0654beb1f8f47f1784e476e35c6c42b687c77814ba02af8f302b80db5a4e7bc533ab3dde70e9249719e1acb2bfc8ae7942c6
|
7
|
+
data.tar.gz: cb71dd3f7101474347b8fc2b1edc8bd12236a6ce8a5bf93d986c44aa8c5e94767601f3f716033da132473166e6e3cd88df0050705cdb32b6146d44b633912373
|
data/jt-rails-toolbox.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = "Common libs used for Ruby On Rails development."
|
4
4
|
s.description = "JTRailsToolbox contains a list of common libs used for Ruby On Rails development."
|
5
5
|
s.homepage = 'https://github.com/jonathantribouharet/jt-rails-toolbox'
|
6
|
-
s.version = '2.4.
|
6
|
+
s.version = '2.4.3'
|
7
7
|
s.files = `git ls-files`.split("\n")
|
8
8
|
s.require_paths = ['lib']
|
9
9
|
s.authors = ['Jonathan TRIBOUHARET']
|
data/lib/jt-rails-toolbox.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'dotenv/rails-now'
|
2
2
|
require 'http_accept_language'
|
3
3
|
require 'paperclip'
|
4
|
-
require 'sidekiq'
|
5
4
|
require 'validates_email_format_of'
|
6
5
|
require 'validates_phone_format_of'
|
7
6
|
require 'rails_i18n'
|
@@ -11,10 +10,6 @@ require 'jt-rails-tokenizable'
|
|
11
10
|
|
12
11
|
require 'yaml'
|
13
12
|
|
14
|
-
# Don't move this require
|
15
|
-
require 'airbrake'
|
16
|
-
require 'airbrake/sidekiq/error_handler'
|
17
|
-
|
18
13
|
module JTRailsToolbox
|
19
14
|
|
20
15
|
class Engine < ::Rails::Engine
|
@@ -30,10 +25,10 @@ module JTRailsToolbox
|
|
30
25
|
end
|
31
26
|
|
32
27
|
process_params
|
28
|
+
configure_sidekiq(app)
|
33
29
|
configure_exception_notification(app)
|
34
30
|
configure_mail(app)
|
35
31
|
configure_paperclip(app)
|
36
|
-
configure_sidekiq(app)
|
37
32
|
end
|
38
33
|
|
39
34
|
def process_params
|
@@ -68,6 +63,7 @@ module JTRailsToolbox
|
|
68
63
|
# Should avoid namespace with Redis
|
69
64
|
# http://www.mikeperham.com/2015/09/24/storing-data-with-redis/
|
70
65
|
@params['sidekiq'] ||= {}
|
66
|
+
@params['sidekiq']['disable'] ||= false
|
71
67
|
@params['sidekiq']['redis_url'] ||= "redis://localhost:6379/0"
|
72
68
|
@params['sidekiq']['namespace'] ||= "#{Rails.application.class.parent_name.parameterize}#{Rails.env.production? ? '' : "-#{Rails.env.to_s}"}"
|
73
69
|
end
|
@@ -77,6 +73,9 @@ module JTRailsToolbox
|
|
77
73
|
|
78
74
|
if @params['exception']['airbrake']
|
79
75
|
|
76
|
+
require 'airbrake'
|
77
|
+
require 'airbrake/sidekiq/error_handler' unless sidekiq_disabled?
|
78
|
+
|
80
79
|
Airbrake.configure do |c|
|
81
80
|
if @params['exception']['airbrake']['host']
|
82
81
|
c.host = @params['exception']['airbrake']['host']
|
@@ -109,7 +108,7 @@ module JTRailsToolbox
|
|
109
108
|
|
110
109
|
require 'exception_notification'
|
111
110
|
require 'exception_notification/rails'
|
112
|
-
require 'exception_notification/sidekiq'
|
111
|
+
require 'exception_notification/sidekiq' unless sidekiq_disabled?
|
113
112
|
|
114
113
|
ExceptionNotification.configure do |config|
|
115
114
|
config.ignored_exceptions += %w{ActionController::InvalidCrossOriginRequest ActionController::InvalidAuthenticityToken}
|
@@ -142,7 +141,7 @@ module JTRailsToolbox
|
|
142
141
|
# Strip meta data from images
|
143
142
|
Paperclip::Attachment.default_options[:convert_options] = { all: '-strip' }
|
144
143
|
|
145
|
-
# Params in url are bad for SEO, it's better to use fingerprint for having
|
144
|
+
# Params in url are bad for SEO, it's better to use fingerprint for having an unique url
|
146
145
|
Paperclip::Attachment.default_options[:use_timestamp] = false
|
147
146
|
|
148
147
|
path = "#{@params['files']['folder']}/:class/:attachment/:id/:style/:fingerprint.:content_type_extension"
|
@@ -155,6 +154,10 @@ module JTRailsToolbox
|
|
155
154
|
end
|
156
155
|
|
157
156
|
def configure_sidekiq(app)
|
157
|
+
return if sidekiq_disabled?
|
158
|
+
|
159
|
+
require 'sidekiq'
|
160
|
+
|
158
161
|
Sidekiq.configure_server do |config|
|
159
162
|
config.redis = { url: @params['sidekiq']['redis_url'], namespace: @params['sidekiq']['namespace'] }
|
160
163
|
end
|
@@ -166,6 +169,10 @@ module JTRailsToolbox
|
|
166
169
|
ActiveJob::Base.queue_adapter = :sidekiq
|
167
170
|
end
|
168
171
|
|
172
|
+
def sidekiq_disabled?
|
173
|
+
@params['sidekiq']['disable'] == true
|
174
|
+
end
|
175
|
+
|
169
176
|
end
|
170
177
|
|
171
178
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jt-rails-toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan TRIBOUHARET
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|