pulse_meter-dygraphs_visualizer 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -6
- data/LICENSE +5 -19
- data/README.md +6 -15
- data/Rakefile +14 -24
- data/lib/pulse_meter/dygraphs_visualize/dsl/base.rb +9 -4
- data/lib/pulse_meter/dygraphs_visualize/dsl/widgets/line.rb +1 -0
- data/lib/pulse_meter/dygraphs_visualize/dsl/widgets/stack.rb +1 -0
- data/lib/pulse_meter/dygraphs_visualize/widgets/timeline.rb +8 -2
- data/pulse_meter-dygraphs_visualizer.gemspec +3 -2
- data/spec/shared_examples/widget.rb +5 -0
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9faee7fb09463b9fe183b5e9bbb4bf617c7a5b9e
|
4
|
+
data.tar.gz: ede5bfc1e5eee4ab814d3347139098bff62bcf54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53df23a61115c1b6cab0c9ae338f9e78de201bd352b684e1716122614392d3fefd4d6f1837befcae99d674b7fe2ff7c12c3ba09465e60eb0c946f91e3d78bfdd
|
7
|
+
data.tar.gz: 67baddf24b70207711a9a3fbc1b9aa59e97e7508281a9adc9193bb5eba96331e7d5012c801ef2143fe5af36377818e20e068067a675521adc275ac84030c3d55
|
data/.travis.yml
CHANGED
data/LICENSE
CHANGED
@@ -1,22 +1,8 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
Copyright (c) 2016 Ilya Averyanov, Sergey Averyanov
|
2
3
|
|
3
|
-
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
5
|
|
5
|
-
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
12
7
|
|
13
|
-
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,26 +1,17 @@
|
|
1
|
-
[](https://gemnasium.com/savonarola/pulse_meter_visualizer)
|
4
|
-
[](https://codeclimate.com/github/savonarola/pulse_meter_visualizer)
|
5
|
-
|
1
|
+
[](http://badge.fury.io/rb/pulse_meter-dygraphs_visualizer)
|
2
|
+
[](https://travis-ci.org/savonarola/pulse_meter-dygraphs_visualizer)
|
6
3
|
# PulseMeter
|
7
4
|
|
8
|
-
PulseMeter is a gem for fast and convenient realtime aggregating of software internal stats through Redis.
|
9
|
-
|
10
|
-
## Live Demo
|
11
|
-
|
12
|
-
A small live demo for [pulse-meter](https://github.com/savonarola/pulse-meter) gem is located here: [pulse-meter.rubybox.ru](http://pulse-meter.rubybox.ru), its source code can be found here: [https://github.com/savonarola/pulse-meter-demo](https://github.com/savonarola/pulse-meter-demo)
|
13
|
-
|
14
|
-
## Features
|
5
|
+
[PulseMeter](https://github.com/savonarola/pulse-meter) is a gem for fast and convenient realtime aggregating of software internal stats through Redis.
|
15
6
|
|
16
|
-
|
7
|
+
This gem contains DSL for customizable web interface for [PulseMeter](https://github.com/savonarola/pulse-meter). See [example usage](examples/basic.ru).
|
17
8
|
|
18
9
|
## Installation
|
19
10
|
|
20
11
|
Add this line to your application's Gemfile:
|
21
12
|
|
22
13
|
```ruby
|
23
|
-
gem '
|
14
|
+
gem 'pulse_meter-dygraphs_visualizer'
|
24
15
|
```
|
25
16
|
|
26
17
|
And then execute:
|
@@ -29,7 +20,7 @@ And then execute:
|
|
29
20
|
|
30
21
|
Or install it yourself as:
|
31
22
|
|
32
|
-
$ gem install
|
23
|
+
$ gem install pulse_meter-dygraphs_visualizer
|
33
24
|
|
34
25
|
## Contributing
|
35
26
|
|
data/Rakefile
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
require 'bundler/gem_tasks'
|
3
|
-
require 'listen'
|
4
2
|
require 'rspec/core/rake_task'
|
5
|
-
require 'yard'
|
6
|
-
require 'yard/rake/yardoc_task'
|
7
3
|
|
8
4
|
RSpec::Core::RakeTask.new(:spec)
|
9
5
|
|
10
|
-
|
6
|
+
Bundler::GemHelper.install_tasks
|
11
7
|
|
12
8
|
task :default => :spec
|
13
9
|
|
14
|
-
STDOUT.sync = true
|
15
|
-
|
16
10
|
namespace :coffee do
|
17
11
|
COFFEE_PATH = "lib/pulse_meter/dygraphs_visualize/coffee"
|
18
12
|
COFFEE_FILES = %w{
|
@@ -41,37 +35,33 @@ namespace :coffee do
|
|
41
35
|
application
|
42
36
|
}.map{|f| "#{COFFEE_PATH}/#{f}.coffee"}.join(" ")
|
43
37
|
APP_JS = "lib/pulse_meter/dygraphs_visualize/public/js/application.js"
|
44
|
-
|
38
|
+
COFFEE = "node_modules/coffee-script/bin/coffee"
|
45
39
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
system(command)
|
50
|
-
puts "application.js compiled"
|
40
|
+
file COFFEE do
|
41
|
+
puts "Running npm install"
|
42
|
+
system "npm install" or raise "npm install failed"
|
51
43
|
end
|
52
44
|
|
53
45
|
desc "Compile coffee to js"
|
54
|
-
task :compile do
|
55
|
-
|
46
|
+
task :compile => [COFFEE] do
|
47
|
+
command = "cat #{COFFEE_FILES} | #{COFFEE} --compile --bare --stdio > #{APP_JS}"
|
48
|
+
puts "running #{command}"
|
49
|
+
system(command)
|
50
|
+
puts "application.js compiled"
|
56
51
|
end
|
57
52
|
|
58
53
|
desc "Watch coffee files and recomplile them immediately"
|
59
|
-
task :watch do
|
54
|
+
task :watch => [:compile] do
|
55
|
+
require 'listen'
|
56
|
+
STDOUT.sync = true
|
60
57
|
listener = Listen.to(COFFEE_PATH) do |modified, added, removed|
|
61
58
|
puts "Modified: #{modified}" unless modified.empty?
|
62
59
|
puts "Added: #{added}" unless added.empty?
|
63
60
|
puts "Removed: #{removed}" unless removed.empty?
|
64
61
|
puts "Recompiling..."
|
65
|
-
|
62
|
+
Rake::Task["coffee:compile"].execute
|
66
63
|
end
|
67
64
|
listener.start
|
68
65
|
sleep
|
69
66
|
end
|
70
67
|
end
|
71
|
-
|
72
|
-
namespace :yard do
|
73
|
-
desc "Open doc index in a browser"
|
74
|
-
task :open do
|
75
|
-
system 'open', "#{ROOT}/doc/index.html"
|
76
|
-
end
|
77
|
-
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module PulseMeter
|
2
2
|
module DygraphsVisualize
|
3
3
|
module DSL
|
4
|
-
class DArray < Array; end
|
4
|
+
class DArray < Array; end
|
5
5
|
class BadDataClass < PulseMeter::DygraphsVisualize::DSL::Error; end
|
6
6
|
class Base
|
7
7
|
include PulseMeter::Mixins::Utils
|
@@ -17,13 +17,12 @@ module PulseMeter
|
|
17
17
|
end
|
18
18
|
|
19
19
|
class << self
|
20
|
-
|
21
20
|
def deprecated_setter(name)
|
22
21
|
define_method(name) do |*args|
|
23
22
|
STDERR.puts "DEPRECATION: #{name} DSL helper does not take any effect anymore."
|
24
23
|
end
|
25
24
|
end
|
26
|
-
|
25
|
+
|
27
26
|
def setter(name, &block)
|
28
27
|
define_method(name) do |val|
|
29
28
|
block.call(val) if block
|
@@ -37,6 +36,12 @@ module PulseMeter
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
39
|
+
def array_setter(name)
|
40
|
+
define_method(name) do |val|
|
41
|
+
@opts[name] = Array[*val]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
40
45
|
def string_setter(name, &block)
|
41
46
|
define_method(name) do |val|
|
42
47
|
val = val.to_s
|
@@ -67,7 +72,7 @@ module PulseMeter
|
|
67
72
|
@opts[name] << val
|
68
73
|
end
|
69
74
|
end
|
70
|
-
|
75
|
+
|
71
76
|
def dsl_setter(name, klass)
|
72
77
|
define_method(name) do |*args, &block|
|
73
78
|
@opts[name] = create_dsl_obj(args, klass, block)
|
@@ -45,7 +45,13 @@ module PulseMeter
|
|
45
45
|
def series_data(from, till)
|
46
46
|
ensure_equal_intervals!
|
47
47
|
sensor_datas = sensors.map{ |s|
|
48
|
-
s.timeline_data(from, till, show_last_point)
|
48
|
+
data = s.timeline_data(from, till, show_last_point)
|
49
|
+
keys = @opts.fetch(:filter_keys, []).map(&:to_s)
|
50
|
+
if keys.any?
|
51
|
+
data.select { |d| keys.include?(d[:name]) }
|
52
|
+
else
|
53
|
+
data
|
54
|
+
end
|
49
55
|
}
|
50
56
|
rows = []
|
51
57
|
titles = []
|
@@ -100,7 +106,7 @@ module PulseMeter
|
|
100
106
|
|
101
107
|
class Stack < Timeline; end
|
102
108
|
class Line < Timeline; end
|
103
|
-
|
109
|
+
|
104
110
|
end
|
105
111
|
end
|
106
112
|
end
|
@@ -14,7 +14,8 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
15
|
gem.name = "pulse_meter-dygraphs_visualizer"
|
16
16
|
gem.require_paths = ["lib"]
|
17
|
-
gem.version = "0.4.
|
17
|
+
gem.version = "0.4.25"
|
18
|
+
gem.license = 'MIT'
|
18
19
|
|
19
20
|
gem.add_runtime_dependency('pulse_meter_core')
|
20
21
|
gem.add_runtime_dependency('gon-sinatra')
|
@@ -34,6 +35,6 @@ Gem::Specification.new do |gem|
|
|
34
35
|
gem.add_development_dependency('rspec')
|
35
36
|
gem.add_development_dependency('simplecov')
|
36
37
|
gem.add_development_dependency('timecop')
|
37
|
-
|
38
|
+
|
38
39
|
|
39
40
|
end
|
@@ -2,6 +2,7 @@ shared_examples_for "widget" do
|
|
2
2
|
let(:interval){ 100 }
|
3
3
|
let!(:a_sensor){ PulseMeter::Sensor::Timelined::Counter.new(:a_sensor, :ttl => 1000, :interval => interval, annotation: 'A') }
|
4
4
|
let!(:b_sensor){ PulseMeter::Sensor::Timelined::Counter.new(:b_sensor, :ttl => 1000, :interval => interval, annotation: 'B') }
|
5
|
+
let!(:c_sensor){ PulseMeter::Sensor::Timelined::Counter.new(:c_sensor, :ttl => 1000, :interval => interval, annotation: 'C') }
|
5
6
|
|
6
7
|
let(:widget_name){ "some_widget" }
|
7
8
|
|
@@ -11,6 +12,7 @@ shared_examples_for "widget" do
|
|
11
12
|
let(:timespan){interval * 2}
|
12
13
|
let(:a_color){'#FF0000'}
|
13
14
|
let(:b_color){'#FFFF00'}
|
15
|
+
let(:c_color){'#FFFFFF'}
|
14
16
|
|
15
17
|
let(:interval_start){ Time.at((Time.now.to_i / interval) * interval) }
|
16
18
|
|
@@ -32,6 +34,8 @@ shared_examples_for "widget" do
|
|
32
34
|
w.width width
|
33
35
|
w.sensor :a_sensor, color: a_color
|
34
36
|
w.sensor :b_sensor, color: b_color
|
37
|
+
w.sensor :c_sensor, color: c_color
|
38
|
+
w.filter_keys ["A", "B"]
|
35
39
|
w.dygraphs_options a: 1
|
36
40
|
w.timespan timespan
|
37
41
|
w.to_data
|
@@ -66,6 +70,7 @@ shared_examples_for "widget" do
|
|
66
70
|
Timecop.freeze(interval_start + 1) do
|
67
71
|
a_sensor.event(12)
|
68
72
|
b_sensor.event(33)
|
73
|
+
c_sensor.event(45)
|
69
74
|
end
|
70
75
|
Timecop.freeze(interval_start + interval + 1) do
|
71
76
|
a_sensor.event(111)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pulse_meter-dygraphs_visualizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Averyanov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pulse_meter_core
|
@@ -249,20 +249,6 @@ dependencies:
|
|
249
249
|
- - ">="
|
250
250
|
- !ruby/object:Gem::Version
|
251
251
|
version: '0'
|
252
|
-
- !ruby/object:Gem::Dependency
|
253
|
-
name: yard
|
254
|
-
requirement: !ruby/object:Gem::Requirement
|
255
|
-
requirements:
|
256
|
-
- - ">="
|
257
|
-
- !ruby/object:Gem::Version
|
258
|
-
version: '0'
|
259
|
-
type: :development
|
260
|
-
prerelease: false
|
261
|
-
version_requirements: !ruby/object:Gem::Requirement
|
262
|
-
requirements:
|
263
|
-
- - ">="
|
264
|
-
- !ruby/object:Gem::Version
|
265
|
-
version: '0'
|
266
252
|
description: Customizable web interface for PulseMeter gem
|
267
253
|
email:
|
268
254
|
- av@fun-box.ru
|
@@ -381,7 +367,8 @@ files:
|
|
381
367
|
- spec/shared_examples/widget.rb
|
382
368
|
- spec/spec_helper.rb
|
383
369
|
homepage: https://github.com/savonarola/pulse_meter-dygraphs_visualizer
|
384
|
-
licenses:
|
370
|
+
licenses:
|
371
|
+
- MIT
|
385
372
|
metadata: {}
|
386
373
|
post_install_message:
|
387
374
|
rdoc_options: []
|