fishplate 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc82b1d36ec2b2e3d106d611c7bebd880d3ea0005ee1e2b17e45287c058d36ed
4
- data.tar.gz: c141461a5c19ecee5b0181d25d6de2f73e7b3c0f6dbf240d67095aa64b2fecd6
3
+ metadata.gz: 9157399e830abf212801ffe5aed9cb87fe36b433d7c92a066dc74b3068b0b49f
4
+ data.tar.gz: 3e99a882a4c91b66dce99462eca11ba156e26972bbf77b705650d14bdb5b409e
5
5
  SHA512:
6
- metadata.gz: e4e89fbd06dccfd57754540781ae861378b5909d98f53080c6610ad782a50d9d00897b77874c00dd2544c4532a2a04514350ed9720bb423820ddb92c9610d326
7
- data.tar.gz: 3f2b50c2fe51cd18c8cd3ac1cb1a35c054c98485c79a862634c28b0643fae0cf4d26bd87bc6e734f75ecab79f668ccf8ca655676a44f66d766a334bde45fa737
6
+ metadata.gz: 47f4ef7aceced1879eb3014faa227496d8d5b283830f7339630b3ab7a559f2d845a1429084ca050a71dcd0f42c42c13d6ccc65d03926bf281b6787bcd4007a79
7
+ data.tar.gz: 312baa8c60b1745bde06f41cc5a611a09d3807764ee193e50f225369efa217d891f7dc458610e28fa4401ba33a9c89cd814447d975bb140e78f8123e511cef78
data/.travis.yml CHANGED
@@ -7,5 +7,4 @@ rvm:
7
7
  - 2.6.5
8
8
  before_install: gem install bundler -v 2.0.2
9
9
  script:
10
- - bundle exec rspec
11
- - bundle exec rubocop
10
+ - bundle exec rake
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fishplate (0.2.2)
4
+ fishplate (0.3.0)
5
5
  a9n (~> 0.10)
6
6
  activemodel
7
7
  activerecord
@@ -33,7 +33,7 @@ GEM
33
33
  jaro_winkler (1.5.4)
34
34
  method_source (0.9.2)
35
35
  minitest (5.13.0)
36
- parallel (1.18.0)
36
+ parallel (1.19.1)
37
37
  parser (2.6.5.0)
38
38
  ast (~> 2.4.0)
39
39
  pry (0.12.2)
@@ -61,7 +61,7 @@ GEM
61
61
  rainbow (>= 2.2.2, < 4.0)
62
62
  ruby-progressbar (~> 1.7)
63
63
  unicode-display_width (>= 1.4.0, < 1.7)
64
- rubocop-performance (1.5.0)
64
+ rubocop-performance (1.5.1)
65
65
  rubocop (>= 0.71.0)
66
66
  ruby-progressbar (1.10.1)
67
67
  thread_safe (0.3.6)
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new
5
7
 
6
- task default: :spec
8
+ task default: %i[rubocop spec]
@@ -0,0 +1,9 @@
1
+ module Fishplate
2
+ class SidekiqMiddleware
3
+ def call(*)
4
+ yield
5
+ ensure
6
+ ActiveRecord::Base.clear_active_connections!
7
+ end
8
+ end
9
+ end
@@ -23,7 +23,7 @@ task "db:setup" => ["fail_if_prod", "db:create", "db:schema:load"]
23
23
  desc "Generate new migration with name given, example: rake generate:migration[CreateUsers]"
24
24
  namespace :generate do
25
25
  task :migration, [:name] do |name, args|
26
- klass = args[:name].gsub('-','_').camelize
26
+ klass = args[:name].tr('-', '_').camelize
27
27
  number = ActiveRecord::Migration.next_migration_number(0)
28
28
  file_name = "#{number}_#{klass.underscore}.rb"
29
29
  file_path = A9n.root.join("db/migrate", file_name)
@@ -1,3 +1,3 @@
1
1
  module Fishplate
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
data/lib/fishplate.rb CHANGED
@@ -6,6 +6,7 @@ require 'logger'
6
6
 
7
7
  require 'fishplate/version'
8
8
  require 'fishplate/rack'
9
+ require 'fishplate/sidekiq_middleware'
9
10
 
10
11
  module Fishplate
11
12
  class << self
@@ -61,6 +62,18 @@ module Fishplate
61
62
  ActiveRecord::Base.flush_idle_connections!
62
63
 
63
64
  ActiveRecord::Base.establish_connection
65
+
66
+ add_sidekiq_middleware if defined?(Sidekiq)
67
+ end
68
+
69
+ private
70
+
71
+ def add_sidekiq_middleware
72
+ Sidekiq.configure_server do |config|
73
+ config.server_middleware do |chain|
74
+ chain.add Fishplate::SidekiqMiddleware
75
+ end
76
+ end
64
77
  end
65
78
  end
66
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fishplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: a9n
@@ -202,6 +202,7 @@ files:
202
202
  - fishplate/.travis.yml
203
203
  - lib/fishplate.rb
204
204
  - lib/fishplate/rack.rb
205
+ - lib/fishplate/sidekiq_middleware.rb
205
206
  - lib/fishplate/tasks.rake
206
207
  - lib/fishplate/version.rb
207
208
  homepage: https://github.com/RenoFi/fishplate