blue_green_workers 0.3.0 → 0.4.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: c96c7a8ef051cb569bebc77c5a238c89fc144e3f
4
- data.tar.gz: 7f79f568346ddc3f366959c093f7945e8627eaa7
3
+ metadata.gz: 36dc067f1550f6d20bb5a6c08ec16b485ad0bf59
4
+ data.tar.gz: 58d5ec2379babc58b1f5323aee6df0ee01e7f8c2
5
5
  SHA512:
6
- metadata.gz: a5d48348169ba0fb2bf5772804fc83f87e7aef3a0bc0baabe94bc6468b7cb8a40f1afd182a3fc64e12d8d1e2fc97c680882d940aa32b31235cd986f36302e6c8
7
- data.tar.gz: e0d9e7723a5aa28045a7cd3b2e98ff324b0912574066f7c8fe2d624769fff842411a0d07c55577840e85ec3a5ef53f2b63405cfb5d805d2ff32783de1d7ec520
6
+ metadata.gz: e9062f007c45b6f134b73a15c2f3e34bf23aed16bed8310118c135031f2ea32c7f50958d37021cf1afc5a79b7d7b233f63755210874d970f2b829eaa7660934b
7
+ data.tar.gz: 9ef1fecdb6a308ee49e0b9fe1ef2a716d62234e2991ec6fe5912fd22adf2ef638bf30ad6e933e51ae5520fd151a3ecb4fd63f66481ca02e16481cbea48087552
@@ -0,0 +1,53 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ # specify the version you desire here
10
+ - image: circleci/ruby:2.4.1-node-browsers
11
+
12
+ # Specify service dependencies here if necessary
13
+ # CircleCI maintains a library of pre-built images
14
+ # documented at https://circleci.com/docs/2.0/circleci-images/
15
+ # - image: circleci/postgres:9.4
16
+
17
+ working_directory: ~/repo
18
+
19
+ steps:
20
+ - checkout
21
+
22
+ # Download and cache dependencies
23
+ - restore_cache:
24
+ keys:
25
+ - v1-dependencies-{{ checksum "blue_green_workers.gemspec" }}
26
+ # fallback to using the latest cache if no exact match is found
27
+ - v1-dependencies-
28
+
29
+ - run:
30
+ name: install dependencies
31
+ command: |
32
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
33
+
34
+ - save_cache:
35
+ paths:
36
+ - ./vendor/bundle
37
+ key: v1-dependencies-{{ checksum "blue_green_workers.gemspec" }}
38
+
39
+ # run tests!
40
+ - run:
41
+ name: run tests
42
+ command: |
43
+ bundle exec rspec --format progress \
44
+ --format RspecJunitFormatter \
45
+ --out /tmp/test-results/rspec.xml \
46
+ --format progress
47
+
48
+ # collect reports
49
+ - store_test_results:
50
+ path: /tmp/test-results
51
+ - store_artifacts:
52
+ path: /tmp/test-results
53
+ destination: test-results
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![CircleCI](https://circleci.com/gh/hawknewton/blue_green_workers/tree/master.svg?style=svg)](https://circleci.com/gh/hawknewton/blue_green_workers/tree/master)
2
+
1
3
  # BlueGreenWorkers
2
4
 
3
5
  This gem provides helpers to coordiante workers across multiple clusters that for which only one cluster should be active at a time. Think [blue green deployments](https://martinfowler.com/bliki/BlueGreenDeployment.html)
@@ -45,14 +47,14 @@ In addition to attaching event handles to `activate` and `deactivate` you can al
45
47
 
46
48
  ```ruby
47
49
  loop do
48
- BlueGreenWorkers.execute(opts) do
50
+ BlueGreenWorkers.when_active(opts) do
49
51
  # Do some work, poll for stuff, etc
50
52
  end
51
53
  sleep 60
52
54
  end
53
55
  ```
54
56
 
55
- Options include*
57
+ Options include:
56
58
  * `delay` -- Delay for `n` seconds if we're not the active cluster
57
59
  * `return` -- What to return if we're not the active cluster
58
60
 
@@ -27,11 +27,12 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_development_dependency 'bundler', '~> 1.16'
30
+ spec.add_development_dependency 'bundler', '~> 1.15'
31
31
  spec.add_development_dependency 'null-logger', '~> 0.1'
32
32
  spec.add_development_dependency 'pry', '~> 0.11'
33
33
  spec.add_development_dependency 'rake', '~> 10.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
35
35
  spec.add_development_dependency 'rspec-eventually', '~> 0.2'
36
- spec.add_development_dependency 'rubocop', '~> 0.52'
36
+ spec.add_development_dependency 'rspec_junit_formatter', '~> 0.3'
37
+ spec.add_development_dependency 'rubocop', '~> 0.52.1'
37
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlueGreenWorkers
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -21,11 +21,11 @@ module BlueGreenWorkers
21
21
  config.validate
22
22
  end
23
23
 
24
- def self.execute(opts = {})
24
+ def self.when_active(opts = {})
25
25
  if config.active_cluster_block.call == config.cluster_name
26
26
  yield
27
27
  else
28
- logger.debug 'Workers not active, skipping BlueGreenWorkers#execute'
28
+ logger.debug 'Cluster not active, skipping BlueGreenWorkers#when_active'
29
29
  opts[:delay] && sleep(opts[:delay])
30
30
  opts[:return]
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blue_green_workers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hawknewton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '1.15'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '1.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: null-logger
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +94,34 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec_junit_formatter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.3'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rubocop
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '0.52'
117
+ version: 0.52.1
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '0.52'
124
+ version: 0.52.1
111
125
  description: |-
112
126
  Deactive any type of background worker when the cluster is standby. This is
113
127
  useful when deploying apps that utilize timers or queues with a blue/green
@@ -118,6 +132,7 @@ executables: []
118
132
  extensions: []
119
133
  extra_rdoc_files: []
120
134
  files:
135
+ - ".circleci/config.yml"
121
136
  - ".gitignore"
122
137
  - ".rspec"
123
138
  - ".rubocop.yml"
@@ -150,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
165
  version: '0'
151
166
  requirements: []
152
167
  rubyforge_project:
153
- rubygems_version: 2.6.13
168
+ rubygems_version: 2.6.14
154
169
  signing_key:
155
170
  specification_version: 4
156
171
  summary: Deactivate background workers when we're the standbycluster