dboard 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04384209716740e5394ba02c66fba4d50e28c0f6
4
+ data.tar.gz: 23d2937eaca6b80626763e587ee122a0a9374c43
5
+ SHA512:
6
+ metadata.gz: d5e1cdb57eba9528812865e60a42d3bcedb75c9ca805b9dc173850ff474a211eff6f06a2a9ae758d525ceb7248bb7b47774d8159e0ff51c7061c9529d1c3bdef
7
+ data.tar.gz: 956a3f0fa80db28543d66731c4bec8f00e9f44838e2e187a7f5cefa2b0b48fc91e8072247f4ff317989c354d4651a94d0665d20f16155a005a7be36a9b2e032a
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm ree-1.8.7-2011.03@dboard --create
1
+ rvm ruby-2.1.0@dboard --create
@@ -26,6 +26,8 @@ module Dboard
26
26
 
27
27
  def start
28
28
  @sources.each do |source, instance|
29
+ wait_a_little_bit_to_not_start_all_fetches_at_once
30
+
29
31
  Thread.new do
30
32
  loop do
31
33
  update_in_thread(source, instance)
@@ -35,20 +37,15 @@ module Dboard
35
37
  loop { sleep 1 }
36
38
  end
37
39
 
38
- def update_in_thread(source, instance)
39
- time = Time.now
40
- puts "#{source} updating..."
41
- update_source(source, instance)
42
- elapsed_time = Time.now - time
43
- time_until_next_update = instance.update_interval - elapsed_time
44
- time_until_next_update = 0 if time_until_next_update < 0
45
- puts "#{source} done in #{elapsed_time} seconds, will update again in #{time_until_next_update} seconds (interval: #{instance.update_interval})."
46
- sleep time_until_next_update
47
- rescue Exception => ex
48
- puts "Something failed outside the update_source method. #{ex.message}"
49
- puts ex.backtrace
40
+ def register_source(key, instance)
41
+ @sources.merge!({ key => instance })
42
+ end
43
+
44
+ def register_after_update_callback(callback)
45
+ @after_update_callback = callback
50
46
  end
51
47
 
48
+ # Public because the old tests depend on it
52
49
  def update_source(source, instance)
53
50
  begin
54
51
  data = instance.fetch
@@ -61,16 +58,28 @@ module Dboard
61
58
  puts ex.backtrace
62
59
  end
63
60
 
64
- def register_source(key, instance)
65
- @sources.merge!({ key => instance })
66
- end
61
+ private
67
62
 
68
- def register_after_update_callback(callback)
69
- @after_update_callback = callback
63
+ def update_in_thread(source, instance)
64
+ time = Time.now
65
+ puts "#{source} updating..."
66
+ update_source(source, instance)
67
+ elapsed_time = Time.now - time
68
+ time_until_next_update = instance.update_interval - elapsed_time
69
+ time_until_next_update = 0 if time_until_next_update < 0
70
+ puts "#{source} done in #{elapsed_time} seconds, will update again in #{time_until_next_update} seconds (interval: #{instance.update_interval})."
71
+ sleep time_until_next_update
72
+ rescue Exception => ex
73
+ puts "Something failed outside the update_source method. #{ex.message}"
74
+ puts ex.backtrace
70
75
  end
71
76
 
72
77
  def publish_data(source, data)
73
78
  Publisher.publish(source, data)
74
79
  end
80
+
81
+ def wait_a_little_bit_to_not_start_all_fetches_at_once
82
+ sleep 10 * rand
83
+ end
75
84
  end
76
85
  end
@@ -1,3 +1,3 @@
1
1
  module Dboard
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -1,7 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
 
3
3
  describe Dboard::Collector, "register_source" do
4
-
5
4
  before do
6
5
  Dboard::Collector.instance.sources.clear
7
6
  end
@@ -26,7 +25,6 @@ describe Dboard::Collector, "register_source" do
26
25
  # since it is a singleton, and this callbacks leaks into the other tests
27
26
  Dboard::Collector.register_after_update_callback(lambda {})
28
27
  end
29
-
30
28
  end
31
29
 
32
30
  describe Dboard::Collector, "update_source" do
@@ -47,5 +45,4 @@ describe Dboard::Collector, "update_source" do
47
45
  Dboard::Collector.instance.should_receive(:puts).twice
48
46
  Dboard::Collector.instance.update_source(:new_relic, new_relic)
49
47
  end
50
-
51
48
  end
metadata CHANGED
@@ -1,121 +1,108 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dboard
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- version: 1.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
11
5
  platform: ruby
12
- authors:
13
- - "Joakim Kolsj\xC3\xB6"
6
+ authors:
7
+ - Joakim Kolsjö
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-09-05 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2014-04-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: httparty
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rake
37
21
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
41
24
  - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
47
34
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: json
51
35
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
55
38
  - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
61
48
  type: :runtime
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: dalli
65
49
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dalli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
69
59
  - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
75
62
  type: :runtime
76
- version_requirements: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: sinatra
79
63
  prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
83
66
  - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sinatra
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
89
76
  type: :runtime
90
- version_requirements: *id005
91
- - !ruby/object:Gem::Dependency
92
- name: rspec
93
77
  prerelease: false
94
- requirement: &id006 !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
97
- - - "="
98
- - !ruby/object:Gem::Version
99
- hash: 23
100
- segments:
101
- - 2
102
- - 6
103
- - 0
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
104
89
  version: 2.6.0
105
90
  type: :development
106
- version_requirements: *id006
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.6.0
107
97
  description: Dashboard framework
108
- email:
98
+ email:
109
99
  - joakim.kolsjo@gmail.com
110
100
  executables: []
111
-
112
101
  extensions: []
113
-
114
102
  extra_rdoc_files: []
115
-
116
- files:
117
- - .gitignore
118
- - .rvmrc
103
+ files:
104
+ - ".gitignore"
105
+ - ".rvmrc"
119
106
  - Gemfile
120
107
  - LICENCE
121
108
  - README.md
@@ -132,39 +119,28 @@ files:
132
119
  - spec/integration_spec.rb
133
120
  - spec/publisher_spec.rb
134
121
  - spec/spec_helper.rb
135
- has_rdoc: true
136
- homepage: ""
137
- licenses:
122
+ homepage: ''
123
+ licenses:
138
124
  - MIT
125
+ metadata: {}
139
126
  post_install_message:
140
127
  rdoc_options: []
141
-
142
- require_paths:
128
+ require_paths:
143
129
  - lib
144
- required_ruby_version: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
147
132
  - - ">="
148
- - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 0
152
- version: "0"
153
- required_rubygems_version: !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
156
137
  - - ">="
157
- - !ruby/object:Gem::Version
158
- hash: 3
159
- segments:
160
- - 0
161
- version: "0"
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
162
140
  requirements: []
163
-
164
141
  rubyforge_project:
165
- rubygems_version: 1.5.3
142
+ rubygems_version: 2.2.1
166
143
  signing_key:
167
- specification_version: 3
144
+ specification_version: 4
168
145
  summary: Dashboard framework
169
146
  test_files: []
170
-