pulse_meter-dygraphs_visualizer 0.4.23 → 0.4.25

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: dc32bbb3f4f40fbed4d12a5bccb6ea8c2909cdd4
4
- data.tar.gz: 2a372fe402af0789c0f5db684aa06725340b4f43
3
+ metadata.gz: 9faee7fb09463b9fe183b5e9bbb4bf617c7a5b9e
4
+ data.tar.gz: ede5bfc1e5eee4ab814d3347139098bff62bcf54
5
5
  SHA512:
6
- metadata.gz: 602bbd4effcf6c0af2bc28ad417b7e84663d1eb69c22a7ce5e13123703968ad1ac2b871e79fba32bf9f82ec9e7d824d7df458981761783e5ab72c9838626ee17
7
- data.tar.gz: 9ad24988746c2fd8936b96a0ac2602d5bb90383622b166cb033634695314a405c43c9fbc5d283df6ac6d5b43f6af64d5e04313098091fe09957dba23b72f9fd9
6
+ metadata.gz: 53df23a61115c1b6cab0c9ae338f9e78de201bd352b684e1716122614392d3fefd4d6f1837befcae99d674b7fe2ff7c12c3ba09465e60eb0c946f91e3d78bfdd
7
+ data.tar.gz: 67baddf24b70207711a9a3fbc1b9aa59e97e7508281a9adc9193bb5eba96331e7d5012c801ef2143fe5af36377818e20e068067a675521adc275ac84030c3d55
data/.travis.yml CHANGED
@@ -1,8 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- branches:
6
- only:
7
- - master
8
- - develop
3
+ - 2.2.5
4
+ - 2.3.1
data/LICENSE CHANGED
@@ -1,22 +1,8 @@
1
- Copyright (c) 2012 Ilya Averyanov
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Ilya Averyanov, Sergey Averyanov
2
3
 
3
- MIT License
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
- Permission is hereby granted, free of charge, to any person obtaining
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
- The above copyright notice and this permission notice shall be
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
- [![Gem Version](https://badge.fury.io/rb/pulse_meter_visualizer.png)](http://badge.fury.io/rb/pulse_meter_visualizer)
2
- [![Build Status](https://secure.travis-ci.org/savonarola/pulse_meter_visualizer.png)](http://travis-ci.org/savonarola/pulse_meter_visualizer)
3
- [![Dependency Status](https://gemnasium.com/savonarola/pulse_meter_visualizer.png)](https://gemnasium.com/savonarola/pulse_meter_visualizer)
4
- [![Code Climate](https://codeclimate.com/github/savonarola/pulse_meter_visualizer.png)](https://codeclimate.com/github/savonarola/pulse_meter_visualizer)
5
-
1
+ [![Gem Version](https://badge.fury.io/rb/pulse_meter-dygraphs_visualizer.svg)](http://badge.fury.io/rb/pulse_meter-dygraphs_visualizer)
2
+ [![Build Status](https://travis-ci.org/savonarola/pulse_meter-dygraphs_visualizer.svg?branch=master)](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
- The gem contains customizable web interface for [pulse-meter](https://github.com/savonarola/pulse-meter) gem.
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 'pulse_meter_visualizer'
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 pulse_meter_visualizer
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
- YARD::Rake::YardocTask.new(:yard)
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
- COFFEE_SCRIPT = "node_modules/coffee-script/bin/coffee"
38
+ COFFEE = "node_modules/coffee-script/bin/coffee"
45
39
 
46
- def compile_js
47
- command = "cat #{COFFEE_FILES} | #{COFFEE_SCRIPT} --compile --bare --stdio > #{APP_JS}"
48
- puts "running #{command}"
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
- compile_js
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
- compile_js
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)
@@ -8,6 +8,7 @@ module PulseMeter
8
8
 
9
9
  string_setter :values_label
10
10
  bool_setter :show_last_point
11
+ array_setter :filter_keys
11
12
 
12
13
  int_setter :timespan do |ts|
13
14
  raise BadWidgetTimeSpan, ts unless ts > 0
@@ -15,6 +15,7 @@ module PulseMeter
15
15
 
16
16
  string_setter :values_label
17
17
  bool_setter :show_last_point
18
+ array_setter :filter_keys
18
19
 
19
20
  int_setter :timespan do |ts|
20
21
  raise BadWidgetTimeSpan, ts unless ts > 0
@@ -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.23"
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
- gem.add_development_dependency('yard')
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.23
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: 2016-09-28 00:00:00.000000000 Z
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: []