worker_scoreboard 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/worker_scoreboard/version.rb +1 -1
- data/lib/worker_scoreboard.rb +4 -3
- data/spec/worker_scoreboard_spec.rb +11 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f29ecafa714a3e969c3537b3b204b12b72bb652
|
4
|
+
data.tar.gz: 44b354d486856a4aabfcd7f5a14ea801da0a87cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cf322b8fe1561725c8b6fa3fa330468ad7fcd9ac54cd8d0b5f927e5c37f696e19d2088e37289e13df0b3e3b6ade07a1a0a80cea012ee101bb131b741c68b8e2
|
7
|
+
data.tar.gz: 8f8875afaf9c9ec290ddc7779e8cd96a852e01e80c549a910e4bc8e8e4192b789140cce661c2dbdb6cd40a1e83616fb278aa4394eae45ae6d301ca2ec2e1589e
|
data/README.md
CHANGED
@@ -22,9 +22,13 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
TODO: Write usage instructions here
|
24
24
|
|
25
|
+
## See Also
|
26
|
+
|
27
|
+
https://github.com/SpringMT/rack-server_status
|
28
|
+
|
25
29
|
## Contributing
|
26
30
|
|
27
|
-
1. Fork it ( https://github.com/
|
31
|
+
1. Fork it ( https://github.com/SpringMT/worker_scoreboard/fork )
|
28
32
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
33
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
34
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/worker_scoreboard.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "worker_scoreboard/version"
|
2
2
|
require 'digest/md5'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
class WorkerScoreboard
|
5
6
|
def initialize(base_dir)
|
@@ -15,7 +16,7 @@ class WorkerScoreboard
|
|
15
16
|
ObjectSpace.define_finalizer(self, @clean_proc)
|
16
17
|
|
17
18
|
unless Dir.exist? @base_dir
|
18
|
-
|
19
|
+
FileUtils.mkdir_p @base_dir or fail "failed to create directory:#{@base_dir}:#{$!}"
|
19
20
|
end
|
20
21
|
begin
|
21
22
|
File.unlink build_filename
|
@@ -34,8 +35,8 @@ class WorkerScoreboard
|
|
34
35
|
tmp_filename = "#{filename}.tmp"
|
35
36
|
f = File.open(tmp_filename, 'wb')
|
36
37
|
f.flush
|
37
|
-
f.flock File::LOCK_EX or raise "failed to flock LOCK_EX file:#{
|
38
|
-
File.rename(tmp_filename, filename) or raise "failed to rename file:#{
|
38
|
+
f.flock File::LOCK_EX or raise "failed to flock LOCK_EX file:#{tmp_filename}:#{$!}"
|
39
|
+
File.rename(tmp_filename, filename) or raise "failed to rename file:#{tmp_filename} to #{filename}:#{$!}"
|
39
40
|
@fh = f
|
40
41
|
@id_for_fh = worker_id
|
41
42
|
end
|
@@ -2,7 +2,17 @@ require 'spec_helper'
|
|
2
2
|
require 'tmpdir'
|
3
3
|
|
4
4
|
describe WorkerScoreboard do
|
5
|
-
|
5
|
+
describe '.new' do
|
6
|
+
context 'For nested directory' do
|
7
|
+
let(:base_dir) { File.join(Dir.tmpdir, 'level1', 'level2') }
|
8
|
+
subject { WorkerScoreboard.new(base_dir) }
|
9
|
+
example do
|
10
|
+
expect { subject }.not_to raise_error
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#update' do
|
6
16
|
let(:base_dir) { Dir.tmpdir }
|
7
17
|
subject { WorkerScoreboard.new(base_dir) }
|
8
18
|
it do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worker_scoreboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SpringMT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,11 +92,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '2.0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.5.1
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: a scoreboard for monitoring status of many workers
|
99
99
|
test_files:
|
100
100
|
- spec/spec_helper.rb
|
101
101
|
- spec/worker_scoreboard_spec.rb
|
102
|
-
has_rdoc:
|