rails_migrate_mutex 1.1.1 → 1.2.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
  SHA1:
3
- metadata.gz: 403135d84eb6019a77c7853ddbad7d7639f0e9eb
4
- data.tar.gz: 5a4ce737eb7da632c17be6ade1e0befab8c33dbb
3
+ metadata.gz: e90b0249a724e31ff7b4614e03b2ed362367932a
4
+ data.tar.gz: b461921ac5f8b634cc370a48800affb94470f2f7
5
5
  SHA512:
6
- metadata.gz: 75ab54becf508963c2f1f8c18f39e9660035a1c48a87cd7af1fb7b2cd7185b1c5e5c84f7ccd90d274dbba42e701ad3c1192da1bb107bfa3db5538f6f5bfa14d3
7
- data.tar.gz: c6066346a7a1019deb3f994d39ece7dae907be7c8ff24ecbfb7f87610f0466cc80cb0e7d9d427e30838c2e7b426551ae318bc9d2780a8c28cf48302638c9da2f
6
+ metadata.gz: 8aa2122ad763a9ae64854bab0ff979258fbb5ce2cc0fa895c3e477f8d9805cbaf18fde0618c954b4f59648ece714847740d24269d89b1a6d09f096c91743d04d
7
+ data.tar.gz: 7b4dfff0112e501d11de53d5362407c8de3d4b1ae38ea2b6887d567c01f299bbb0ee417c12b9814ae86b72433824d76379e2a804f4db61914d77e671496ffaa8
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  if defined?(Rails)
2
3
  class RailsMigrateMutexRailtie < Rails::Railtie
3
4
  rake_tasks do
@@ -1,10 +1,17 @@
1
+ # frozen_string_literal: true
1
2
  namespace :db do
2
3
  namespace :migrate do
3
4
  desc 'Runs db:migrate in a redis-backed mutex'
4
- task :mutex do
5
+ task mutex: [:environment] do
5
6
  TIMEOUT = 5 * 60 * 60
6
7
 
7
- RedisClassy.redis ||= Redis.current
8
+ # We want to set the redis instance to a sensible default, but only if it has not been set.
9
+ # If it has not been set, it will raise an error. It's a bit messy, but works fine.
10
+ begin
11
+ RedisClassy.redis
12
+ rescue RedisClassy::Error
13
+ RedisClassy.redis = Redis.current
14
+ end
8
15
 
9
16
  RedisMutex.with_lock('db-migrate-mutex', block: TIMEOUT, expire: TIMEOUT) do
10
17
  Rake::Task['db:migrate'].invoke
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_migrate_mutex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.4.8
83
+ rubygems_version: 2.6.8
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Runs Rails migrations in a Redis-backed mutex.