stoplight-admin 0.2.3 → 0.2.4

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: a0d3e92c60c0c0b7e66fed8c7ef789f55acb794a
4
- data.tar.gz: 0d8843671214375affd9adebc91f791d9173c80d
3
+ metadata.gz: 2bb02fe7651f5652d9327f2718b6f05c6ebc8b01
4
+ data.tar.gz: e45454e40b2c0fe3bf74c4a2063adeb545a5e72f
5
5
  SHA512:
6
- metadata.gz: a0cd4b925407eb42449f11bce636c1824e3029c740c301dd61a07f6dc53abf7df1bc0c53a0386080beaa6788a226481fe1f60a1cd8691a22a06dcb3803067d21
7
- data.tar.gz: 5b5e33874a12b746f2340839f56518ee49d8f374a7128c5a81a2bcd555ffdf626764dc2559c5e0eede6ccd000ca12894de511a8a6dd6db112ffc6af7aa9da521
6
+ metadata.gz: f7a314d8646ae6b6e7c2485f1080fb41cf917096df87bdf2a3ae324507596274ab9724968a1ea4e2dd03133781706df72b67014f5008eebe0f9a3a517b932c4e
7
+ data.tar.gz: ae06de52f512dadd77bddb035a1ff3b94e8a689af8ad191ae2dfb9d86f26e59afc4cdc15eabf63b0803014529b694c82ef52f96c23d965dc1a8e2ab3467b153e
data/README.md CHANGED
@@ -18,7 +18,7 @@ First you'll need a `Gemfile`:
18
18
  ``` rb
19
19
  source 'https://rubygems.org'
20
20
 
21
- gem 'stoplight-admin', '~> 0.2.3'
21
+ gem 'stoplight-admin', '~> 0.2.4'
22
22
  ```
23
23
 
24
24
  Run [Bundler][3] to install the dependencies:
@@ -20,17 +20,13 @@ module Sinatra
20
20
  end
21
21
 
22
22
  def light_info(light)
23
- green = Stoplight.green?(light)
24
- attempts = green ? 0 : data_store.attempts(light)
25
- failures = green ? [] : data_store.failures(light).map do |f|
26
- begin
27
- JSON.parse(f)
28
- rescue JSON::ParserError
29
- {
30
- 'error' => f,
31
- 'time' => 'unknown time'
32
- }
33
- end
23
+ green = Stoplight.data_store.green?(light)
24
+ attempts = green ? 0 : data_store.get_attempts(light)
25
+ failures = green ? [] : data_store.get_failures(light).map do |f|
26
+ {
27
+ 'error' => f.error.inspect,
28
+ 'time' => f.time.to_s
29
+ }
34
30
  end
35
31
 
36
32
  {
@@ -51,7 +47,7 @@ module Sinatra
51
47
  def locked?(light_name)
52
48
  [Stoplight::DataStore::STATE_LOCKED_GREEN,
53
49
  Stoplight::DataStore::STATE_LOCKED_RED]
54
- .include?(data_store.state(light_name))
50
+ .include?(data_store.get_state(light_name))
55
51
  end
56
52
 
57
53
  def stat_params(ls)
@@ -76,7 +72,7 @@ module Sinatra
76
72
 
77
73
  def lock(light)
78
74
  new_state =
79
- if Stoplight.green?(light)
75
+ if Stoplight.data_store.green?(light)
80
76
  Stoplight::DataStore::STATE_LOCKED_GREEN
81
77
  else
82
78
  Stoplight::DataStore::STATE_LOCKED_RED
@@ -90,7 +86,7 @@ module Sinatra
90
86
  end
91
87
 
92
88
  def green(light)
93
- if data_store.state(light) == Stoplight::DataStore::STATE_LOCKED_RED
89
+ if data_store.get_state(light) == Stoplight::DataStore::STATE_LOCKED_RED
94
90
  new_state = Stoplight::DataStore::STATE_LOCKED_GREEN
95
91
  data_store.set_state(light, new_state)
96
92
  end
@@ -104,7 +100,7 @@ module Sinatra
104
100
  end
105
101
 
106
102
  def purge
107
- data_store.purge
103
+ data_store.clear_stale
108
104
  end
109
105
 
110
106
  def with_lights
@@ -149,7 +145,7 @@ module Sinatra
149
145
 
150
146
  app.post '/green_all' do
151
147
  data_store.names
152
- .reject { |l| Stoplight.green?(l) }
148
+ .reject { |l| Stoplight.data_store.green?(l) }
153
149
  .each { |l| green(l) }
154
150
  redirect to('/')
155
151
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'stoplight-admin'
5
- spec.version = '0.2.3'
5
+ spec.version = '0.2.4'
6
6
  spec.authors = ['Cameron Desautels', 'Taylor Fausak']
7
7
  spec.email = %w(camdez@gmail.com taylor@fausak.me)
8
8
  spec.summary = %q{A simple administration interface for the stoplight gem.}
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'haml', '~> 4.0.4'
22
22
  spec.add_dependency 'redis', '~> 3.1.0'
23
23
  spec.add_dependency 'sinatra', '~> 1.4.5'
24
- spec.add_dependency 'stoplight', '~> 0.2.0'
24
+ spec.add_dependency 'stoplight', '~> 0.3.0'
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stoplight-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Desautels
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-20 00:00:00.000000000 Z
12
+ date: 2014-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: 0.2.0
90
+ version: 0.3.0
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: 0.2.0
97
+ version: 0.3.0
98
98
  description: A simple administration interface for the stoplight gem.
99
99
  email:
100
100
  - camdez@gmail.com