pulse_meter_visualizer 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2JiMjc2MWMyYmJhYmFjYmExYjcyNWYyODE2NzZhNzA4NWI0OWQ3Ng==
5
+ data.tar.gz: !binary |-
6
+ MjlmYmNhNThkNGI0OGM5Y2ZmNGQzYjdiZDVkYTEyMjI2Y2VmNTU4Nw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDZiNGFhMzlmODEwMThhMTM5ZjNhZTFlZDBlNjQ0MWU4MTRhNzk3ZDY2ZjQx
10
+ Mjg2OWQ2YzU0ZWJmZTIxMjI3ZGFhOGI4YmJmM2JlZWJlYjc5ZDk1ZTQ5NDJi
11
+ OWMxOTQ0YmQxNzkyOWI5Y2Q5M2I0MWE5NGM4MGZkODljNWY1ZTk=
12
+ data.tar.gz: !binary |-
13
+ NDM5ZTYzZDc3YTVmZDU4ODAwNmQwMjE4ZTY0NzA5ODNlMmRiODBhOTgyMDBl
14
+ M2JmNmE5ODRjMjEzOWM4YTIxNTY3N2U4NDllMjRkNzgwNWFmZTFhNjZkNzg3
15
+ MjZhNzc3NThiNTliNjlhM2EyOWRiMGZkM2YzYmUyM2E2NmUwYmM=
data/Rakefile CHANGED
@@ -52,21 +52,3 @@ namespace :yard do
52
52
  end
53
53
  end
54
54
 
55
- namespace :example do
56
- desc "Run minimal example"
57
- task :minimal do
58
- chdir(ROOT) do
59
- system "bundle"
60
- system "cd examples/minimal && bundle exec foreman start"
61
- end
62
- end
63
-
64
- desc "Run full example"
65
- task :full do
66
- chdir(ROOT) do
67
- system "bundle"
68
- system "cd examples/full && bundle exec foreman start"
69
- end
70
- end
71
-
72
- end
@@ -41,7 +41,7 @@ module PulseMeter
41
41
  def interval
42
42
  real_sensor.interval
43
43
  end
44
-
44
+
45
45
  def value
46
46
  real_sensor.value
47
47
  end
@@ -50,6 +50,13 @@ module PulseMeter
50
50
  PulseMeter::Visualize.extractor(self)
51
51
  end
52
52
 
53
+ def valid?
54
+ real_sensor
55
+ true
56
+ rescue PulseMeter::RestoreError
57
+ false
58
+ end
59
+
53
60
  protected
54
61
 
55
62
  def real_sensor
@@ -8,6 +8,10 @@ module PulseMeter
8
8
  @opts[:sensors] ||= []
9
9
  end
10
10
 
11
+ def sensors
12
+ @opts[:sensors].select{|s| s.valid? }
13
+ end
14
+
11
15
  def data
12
16
  {
13
17
  type: type,
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
15
  gem.name = "pulse_meter_visualizer"
16
16
  gem.require_paths = ["lib"]
17
- gem.version = "0.4.15"
17
+ gem.version = "0.4.16"
18
18
 
19
19
  gem.add_runtime_dependency('pulse_meter_core')
20
20
  gem.add_runtime_dependency('gon-sinatra')
@@ -77,6 +77,18 @@ describe PulseMeter::Visualize::Sensor do
77
77
  end
78
78
  end
79
79
 
80
+ describe "valid?" do
81
+ subject{ checked_sensor.valid? }
82
+ context "when sensor exists" do
83
+ let(:checked_sensor){ sensor }
84
+ it{ should be_true }
85
+ end
86
+ context "when sensor does not exist" do
87
+ let(:checked_sensor){ bad_sensor }
88
+ it{ should be_false }
89
+ end
90
+ end
91
+
80
92
  describe "#timeline_data" do
81
93
  before(:each) do
82
94
  Timecop.freeze(interval_start) do
@@ -3,7 +3,7 @@ shared_examples_for "dsl widget" do
3
3
  let(:interval){ 100 }
4
4
  let(:name) { "some_sensor" }
5
5
  let!(:sensor){ PulseMeter::Sensor::Timelined::Max.new(name, :ttl => 1000, :interval => interval) }
6
-
6
+
7
7
  let(:widget_name){ "some_widget" }
8
8
  let(:w){ described_class.new(widget_name) }
9
9
 
@@ -21,10 +21,10 @@ shared_examples_for "dsl widget" do
21
21
 
22
22
  describe "#process_args" do
23
23
  it "should set sensor by :sensor param" do
24
- w.process_args :sensor => :sss
24
+ w.process_args :sensor => :some_sensor
25
25
  sensors = w.to_data.sensors
26
26
  sensors.size.should == 1
27
- sensors.first.name.to_s.should == 'sss'
27
+ sensors.first.name.to_s.should == 'some_sensor'
28
28
  end
29
29
 
30
30
  it "should set title by :title param" do
@@ -40,6 +40,10 @@ shared_examples_for "dsl widget" do
40
40
  end
41
41
 
42
42
  describe "#sensor" do
43
+ let!(:s1){ PulseMeter::Sensor::Timelined::Max.new('s1', :ttl => 1000, :interval => interval) }
44
+ let!(:s2){ PulseMeter::Sensor::Timelined::Max.new('s2', :ttl => 1000, :interval => interval) }
45
+
46
+
43
47
  it "should add sensor" do
44
48
  w.sensor :s1
45
49
  w.sensor :s2
@@ -38,7 +38,21 @@ shared_examples_for "widget" do
38
38
  end
39
39
 
40
40
  describe "#data" do
41
- it "should contain type, title, redraw_interval, width, gchart_options, timespan attriutes" do
41
+
42
+ context "when widget has nonexistant sensor" do
43
+ let(:broken_widget) do
44
+ w = dsl_class.new(widget_name)
45
+ w.sensor :c_sensor
46
+ w.to_data
47
+ end
48
+
49
+ it "handles nonexistant widgets seamlessly" do
50
+ expect{broken_widget.data}.not_to raise_exception
51
+ end
52
+ end
53
+
54
+
55
+ it "should contains type, title, redraw_interval, width, gchart_options, timespan attriutes" do
42
56
  wdata = widget.data
43
57
  wdata[:type].should == class_name.downcase
44
58
  wdata[:title].should == widget_name
@@ -61,7 +75,7 @@ shared_examples_for "widget" do
61
75
  @current_time = interval_start + 2 * interval - 1
62
76
  end
63
77
 
64
- it "should contain valid series" do
78
+ it "contains valid series" do
65
79
  Timecop.freeze(@current_time) do
66
80
  widget.data[:series].should ==
67
81
  {
@@ -75,14 +89,14 @@ shared_examples_for "widget" do
75
89
  end
76
90
  end
77
91
 
78
- it "should accept custom timespan" do
92
+ it "accepts custom timespan" do
79
93
  Timecop.freeze(@current_time + interval) do
80
94
  widget.data(timespan: timespan)[:series][:rows].size.should == 1
81
95
  widget.data(timespan: timespan + interval)[:series][:rows].size.should == 2
82
96
  end
83
97
  end
84
98
 
85
- it "should accept start_time and end_time" do
99
+ it "accepts start_time and end_time" do
86
100
  Timecop.freeze(@current_time + interval) do
87
101
  widget.data(start_time: (Time.now - timespan).to_i)[:series][:rows].size.should == 1
88
102
  widget.data(
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulse_meter_visualizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
5
- prerelease:
4
+ version: 0.4.16
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ilya Averyanov
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-06-24 00:00:00.000000000 Z
12
+ date: 2014-05-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: pulse_meter_core
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: gon-sinatra
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: haml
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :runtime
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,6 @@ dependencies:
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: sinatra
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
60
  - - ! '>='
69
61
  - !ruby/object:Gem::Version
@@ -71,7 +63,6 @@ dependencies:
71
63
  type: :runtime
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ! '>='
77
68
  - !ruby/object:Gem::Version
@@ -79,7 +70,6 @@ dependencies:
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: sinatra-partial
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
74
  - - ! '>='
85
75
  - !ruby/object:Gem::Version
@@ -87,7 +77,6 @@ dependencies:
87
77
  type: :runtime
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
81
  - - ! '>='
93
82
  - !ruby/object:Gem::Version
@@ -95,7 +84,6 @@ dependencies:
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: aquarium
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
88
  - - ! '>='
101
89
  - !ruby/object:Gem::Version
@@ -103,7 +91,6 @@ dependencies:
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
95
  - - ! '>='
109
96
  - !ruby/object:Gem::Version
@@ -111,7 +98,6 @@ dependencies:
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: coffee-script
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
102
  - - ! '>='
117
103
  - !ruby/object:Gem::Version
@@ -119,7 +105,6 @@ dependencies:
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
109
  - - ! '>='
125
110
  - !ruby/object:Gem::Version
@@ -127,7 +112,6 @@ dependencies:
127
112
  - !ruby/object:Gem::Dependency
128
113
  name: foreman
129
114
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
116
  - - ! '>='
133
117
  - !ruby/object:Gem::Version
@@ -135,7 +119,6 @@ dependencies:
135
119
  type: :development
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
123
  - - ! '>='
141
124
  - !ruby/object:Gem::Version
@@ -143,7 +126,6 @@ dependencies:
143
126
  - !ruby/object:Gem::Dependency
144
127
  name: hashie
145
128
  requirement: !ruby/object:Gem::Requirement
146
- none: false
147
129
  requirements:
148
130
  - - ! '>='
149
131
  - !ruby/object:Gem::Version
@@ -151,7 +133,6 @@ dependencies:
151
133
  type: :development
152
134
  prerelease: false
153
135
  version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
136
  requirements:
156
137
  - - ! '>='
157
138
  - !ruby/object:Gem::Version
@@ -159,7 +140,6 @@ dependencies:
159
140
  - !ruby/object:Gem::Dependency
160
141
  name: listen
161
142
  requirement: !ruby/object:Gem::Requirement
162
- none: false
163
143
  requirements:
164
144
  - - ! '>='
165
145
  - !ruby/object:Gem::Version
@@ -167,7 +147,6 @@ dependencies:
167
147
  type: :development
168
148
  prerelease: false
169
149
  version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
150
  requirements:
172
151
  - - ! '>='
173
152
  - !ruby/object:Gem::Version
@@ -175,7 +154,6 @@ dependencies:
175
154
  - !ruby/object:Gem::Dependency
176
155
  name: mock_redis
177
156
  requirement: !ruby/object:Gem::Requirement
178
- none: false
179
157
  requirements:
180
158
  - - ! '>='
181
159
  - !ruby/object:Gem::Version
@@ -183,7 +161,6 @@ dependencies:
183
161
  type: :development
184
162
  prerelease: false
185
163
  version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
164
  requirements:
188
165
  - - ! '>='
189
166
  - !ruby/object:Gem::Version
@@ -191,7 +168,6 @@ dependencies:
191
168
  - !ruby/object:Gem::Dependency
192
169
  name: rack-test
193
170
  requirement: !ruby/object:Gem::Requirement
194
- none: false
195
171
  requirements:
196
172
  - - ! '>='
197
173
  - !ruby/object:Gem::Version
@@ -199,7 +175,6 @@ dependencies:
199
175
  type: :development
200
176
  prerelease: false
201
177
  version_requirements: !ruby/object:Gem::Requirement
202
- none: false
203
178
  requirements:
204
179
  - - ! '>='
205
180
  - !ruby/object:Gem::Version
@@ -207,7 +182,6 @@ dependencies:
207
182
  - !ruby/object:Gem::Dependency
208
183
  name: rake
209
184
  requirement: !ruby/object:Gem::Requirement
210
- none: false
211
185
  requirements:
212
186
  - - ! '>='
213
187
  - !ruby/object:Gem::Version
@@ -215,7 +189,6 @@ dependencies:
215
189
  type: :development
216
190
  prerelease: false
217
191
  version_requirements: !ruby/object:Gem::Requirement
218
- none: false
219
192
  requirements:
220
193
  - - ! '>='
221
194
  - !ruby/object:Gem::Version
@@ -223,7 +196,6 @@ dependencies:
223
196
  - !ruby/object:Gem::Dependency
224
197
  name: rb-fsevent
225
198
  requirement: !ruby/object:Gem::Requirement
226
- none: false
227
199
  requirements:
228
200
  - - ! '>='
229
201
  - !ruby/object:Gem::Version
@@ -231,7 +203,6 @@ dependencies:
231
203
  type: :development
232
204
  prerelease: false
233
205
  version_requirements: !ruby/object:Gem::Requirement
234
- none: false
235
206
  requirements:
236
207
  - - ! '>='
237
208
  - !ruby/object:Gem::Version
@@ -239,7 +210,6 @@ dependencies:
239
210
  - !ruby/object:Gem::Dependency
240
211
  name: redcarpet
241
212
  requirement: !ruby/object:Gem::Requirement
242
- none: false
243
213
  requirements:
244
214
  - - ! '>='
245
215
  - !ruby/object:Gem::Version
@@ -247,7 +217,6 @@ dependencies:
247
217
  type: :development
248
218
  prerelease: false
249
219
  version_requirements: !ruby/object:Gem::Requirement
250
- none: false
251
220
  requirements:
252
221
  - - ! '>='
253
222
  - !ruby/object:Gem::Version
@@ -255,7 +224,6 @@ dependencies:
255
224
  - !ruby/object:Gem::Dependency
256
225
  name: rspec
257
226
  requirement: !ruby/object:Gem::Requirement
258
- none: false
259
227
  requirements:
260
228
  - - ! '>='
261
229
  - !ruby/object:Gem::Version
@@ -263,7 +231,6 @@ dependencies:
263
231
  type: :development
264
232
  prerelease: false
265
233
  version_requirements: !ruby/object:Gem::Requirement
266
- none: false
267
234
  requirements:
268
235
  - - ! '>='
269
236
  - !ruby/object:Gem::Version
@@ -271,7 +238,6 @@ dependencies:
271
238
  - !ruby/object:Gem::Dependency
272
239
  name: simplecov
273
240
  requirement: !ruby/object:Gem::Requirement
274
- none: false
275
241
  requirements:
276
242
  - - ! '>='
277
243
  - !ruby/object:Gem::Version
@@ -279,7 +245,6 @@ dependencies:
279
245
  type: :development
280
246
  prerelease: false
281
247
  version_requirements: !ruby/object:Gem::Requirement
282
- none: false
283
248
  requirements:
284
249
  - - ! '>='
285
250
  - !ruby/object:Gem::Version
@@ -287,7 +252,6 @@ dependencies:
287
252
  - !ruby/object:Gem::Dependency
288
253
  name: sprockets
289
254
  requirement: !ruby/object:Gem::Requirement
290
- none: false
291
255
  requirements:
292
256
  - - ! '>='
293
257
  - !ruby/object:Gem::Version
@@ -295,7 +259,6 @@ dependencies:
295
259
  type: :development
296
260
  prerelease: false
297
261
  version_requirements: !ruby/object:Gem::Requirement
298
- none: false
299
262
  requirements:
300
263
  - - ! '>='
301
264
  - !ruby/object:Gem::Version
@@ -303,7 +266,6 @@ dependencies:
303
266
  - !ruby/object:Gem::Dependency
304
267
  name: timecop
305
268
  requirement: !ruby/object:Gem::Requirement
306
- none: false
307
269
  requirements:
308
270
  - - ! '>='
309
271
  - !ruby/object:Gem::Version
@@ -311,7 +273,6 @@ dependencies:
311
273
  type: :development
312
274
  prerelease: false
313
275
  version_requirements: !ruby/object:Gem::Requirement
314
- none: false
315
276
  requirements:
316
277
  - - ! '>='
317
278
  - !ruby/object:Gem::Version
@@ -319,7 +280,6 @@ dependencies:
319
280
  - !ruby/object:Gem::Dependency
320
281
  name: yard
321
282
  requirement: !ruby/object:Gem::Requirement
322
- none: false
323
283
  requirements:
324
284
  - - ! '>='
325
285
  - !ruby/object:Gem::Version
@@ -327,7 +287,6 @@ dependencies:
327
287
  type: :development
328
288
  prerelease: false
329
289
  version_requirements: !ruby/object:Gem::Requirement
330
- none: false
331
290
  requirements:
332
291
  - - ! '>='
333
292
  - !ruby/object:Gem::Version
@@ -465,27 +424,26 @@ files:
465
424
  - spec/spec_helper.rb
466
425
  homepage: https://github.com/savonarola/pulse_meter_visualizer
467
426
  licenses: []
427
+ metadata: {}
468
428
  post_install_message:
469
429
  rdoc_options: []
470
430
  require_paths:
471
431
  - lib
472
432
  required_ruby_version: !ruby/object:Gem::Requirement
473
- none: false
474
433
  requirements:
475
434
  - - ! '>='
476
435
  - !ruby/object:Gem::Version
477
436
  version: 1.9.2
478
437
  required_rubygems_version: !ruby/object:Gem::Requirement
479
- none: false
480
438
  requirements:
481
439
  - - ! '>='
482
440
  - !ruby/object:Gem::Version
483
441
  version: '0'
484
442
  requirements: []
485
443
  rubyforge_project:
486
- rubygems_version: 1.8.23
444
+ rubygems_version: 2.2.2
487
445
  signing_key:
488
- specification_version: 3
446
+ specification_version: 4
489
447
  summary: Customizable web interface for lightweight Redis-based metrics aggregator
490
448
  and processor PulseMeter
491
449
  test_files: