pulse-meter-rails 0.0.1
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.
- data/.gitignore +17 -0
- data/.rbenv-version +1 -0
- data/.rspec +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +93 -0
- data/Rakefile +20 -0
- data/lib/generators/pulse_toolbox/install_generator.rb +20 -0
- data/lib/pulse-meter-rails.rb +38 -0
- data/lib/pulse_toolbox/sensor/initializer.rb +23 -0
- data/lib/pulse_toolbox/sensor/manager.rb +181 -0
- data/lib/pulse_toolbox/sensor/mixins/iterators.rb +54 -0
- data/lib/pulse_toolbox/server/monitoring.rb +48 -0
- data/lib/pulse_toolbox/version.rb +3 -0
- data/pulse-meter-rails.gemspec +31 -0
- data/spec/dummy/.gitignore +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +58 -0
- data/spec/dummy/config/boot.rb +9 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +34 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/pulse.rb +23 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/generators/install_spec.rb +10 -0
- data/spec/pulse_meter_rails_spec.rb +19 -0
- data/spec/pulse_toolbox/sensor/manager_spec.rb +136 -0
- data/spec/pulse_toolbox/sensor/mixins/iterators_spec.rb +65 -0
- data/spec/requests/monitoring_spec.rb +54 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/helpers.rb +41 -0
- metadata +256 -0
data/.gitignore
ADDED
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.2-p290
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color -fd
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 s.averyanov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
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:
|
12
|
+
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
[](http://travis-ci.org/averyanov/pulse-meter-rails)
|
2
|
+
|
3
|
+
# PulseToolbox
|
4
|
+
Pulse toolbox provides various metrics for your Rails application out of box.
|
5
|
+
It is based on [pulse-meter](https://github.com/savonarola/pulse-meter) gem.
|
6
|
+
|
7
|
+
Beeing added to Gemfile Pulse Toolbox allows you to mount monitoring page in
|
8
|
+
your <tt>routes.rb</tt> file.
|
9
|
+
|
10
|
+
Requests processing times will be displayed there. You can also add custom
|
11
|
+
sensors to configuration to be displayed.
|
12
|
+
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
gem 'pulse-meter-rails'
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install pulse-meter-rails
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Create an initializer with the following config
|
31
|
+
|
32
|
+
PulseToolbox.redis = Redis.new :host => "localhost", :port => 6379, :db => 2
|
33
|
+
PulseToolbox::Server::Monitoring.use Rack::Auth::Basic do |username, password|
|
34
|
+
username == 'admin'
|
35
|
+
end
|
36
|
+
|
37
|
+
And mount monitoring server in your <tt>routes.rb</tt>
|
38
|
+
|
39
|
+
mount PulseToolbox::Server::Monitoring, :at => "/monitoring"
|
40
|
+
|
41
|
+
Or you can use generator to create initializer and add route:
|
42
|
+
|
43
|
+
$ bundle exec rails g pulse_toolbox:install
|
44
|
+
|
45
|
+
You can add your own groups of sensors to page in initializer:
|
46
|
+
|
47
|
+
group = PulseToolbox::Sensor::Manager.add_group(:min)
|
48
|
+
PulseToolbox::Sensor::Manager.add_sensor(group, :user_age, {
|
49
|
+
:sensor_type => 'timelined/min',
|
50
|
+
:color => '#0000FF',
|
51
|
+
:args => {
|
52
|
+
:ttl => 10.days,
|
53
|
+
:interval => 10.minutes,
|
54
|
+
:raw_data_ttl => 10.hours,
|
55
|
+
:reduce_delay => 2.minutes,
|
56
|
+
:annotation => "User ages"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
})
|
60
|
+
|
61
|
+
Default layout can be easily exteneded in initializer by standart pulse-meter [DSL](https://github.com/savonarola/pulse-meter#full-example-with-dsl-explanation)
|
62
|
+
|
63
|
+
PulseMeter::Sensor::Timelined::Counter.new(:custom_sensor,
|
64
|
+
:ttl => 1.hour,
|
65
|
+
:interval => 1.minute,
|
66
|
+
:raw_data_ttl => 10.minutes,
|
67
|
+
:reduce_delay => 2.minutes
|
68
|
+
)
|
69
|
+
|
70
|
+
PulseToolbox::Sensor::Manager.layout do |l|
|
71
|
+
l.page "Custom" do |p|
|
72
|
+
p.spline "Custom sensor" do |w|
|
73
|
+
w.sensor :custom_sensor, :color => "#0000FF"
|
74
|
+
|
75
|
+
w.timespan 60 * 60 * 3
|
76
|
+
w.redraw_interval 10
|
77
|
+
|
78
|
+
w.show_last_point true
|
79
|
+
w.values_label "Time"
|
80
|
+
w.width 10
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Launch your application and visit <tt>/monitoring</tt>
|
86
|
+
|
87
|
+
## Contributing
|
88
|
+
|
89
|
+
1. Fork it
|
90
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
91
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
92
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
93
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
require "yard"
|
5
|
+
require "yard/rake/yardoc_task"
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
YARD::Rake::YardocTask.new(:yard)
|
10
|
+
|
11
|
+
ROOT = File.dirname(__FILE__)
|
12
|
+
|
13
|
+
task :default => :spec
|
14
|
+
|
15
|
+
namespace :yard do
|
16
|
+
desc "Open doc index in a browser"
|
17
|
+
task :open do
|
18
|
+
system 'open', "#{ROOT}/doc/index.html"
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module PulseToolbox
|
4
|
+
class InstallGenerator < ::Rails::Generators::Base
|
5
|
+
def create_initalizer
|
6
|
+
initializer("pulse_toolbox.rb") do
|
7
|
+
data = ""
|
8
|
+
data << "PulseToolbox.redis = Redis.new\n"
|
9
|
+
data << "PulseToolbox::Server::Monitoring.use Rack::Auth::Basic do |username, password|\n"
|
10
|
+
data << " username == 'admin' && password == 'secret'\n"
|
11
|
+
data << "end\n"
|
12
|
+
data
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_route
|
17
|
+
route "mount PulseToolbox::Server::Monitoring, :at => '/monitoring'"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/all"
|
3
|
+
require "pulse-meter"
|
4
|
+
|
5
|
+
require "pulse_toolbox/sensor/initializer"
|
6
|
+
|
7
|
+
module PulseToolbox
|
8
|
+
extend ActiveSupport::Autoload
|
9
|
+
|
10
|
+
autoload :VERSION, 'pulse_toolbox/version'
|
11
|
+
|
12
|
+
module Generators
|
13
|
+
extend ActiveSupport::Autoload
|
14
|
+
autoload :InstallGenerator
|
15
|
+
end
|
16
|
+
|
17
|
+
module Server
|
18
|
+
extend ActiveSupport::Autoload
|
19
|
+
autoload :Monitoring
|
20
|
+
end
|
21
|
+
|
22
|
+
module Sensor
|
23
|
+
extend ActiveSupport::Autoload
|
24
|
+
autoload :Manager
|
25
|
+
module Mixins
|
26
|
+
extend ActiveSupport::Autoload
|
27
|
+
autoload :Iterators
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.redis=(redis)
|
32
|
+
PulseMeter.redis = redis
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.redis
|
36
|
+
PulseMeter.redis
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module PulseToolbox
|
4
|
+
module Sensor
|
5
|
+
# Registeres an initializer which creates sensors and subscribes to
|
6
|
+
# process_action.action_controller notification
|
7
|
+
class Initializer < ::Rails::Railtie
|
8
|
+
initializer "register_request_sensors", :after => :load_config_initializers do
|
9
|
+
if PulseToolbox.redis
|
10
|
+
PulseToolbox::Sensor::Manager.create_sensors
|
11
|
+
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload|
|
12
|
+
total_time = (finish - start) * 1000
|
13
|
+
view_time = payload[:view_runtime]
|
14
|
+
db_time = payload[:db_runtime]
|
15
|
+
PulseToolbox::Sensor::Manager.log_request(total_time, view_time, db_time)
|
16
|
+
end
|
17
|
+
else
|
18
|
+
Rails.logger.error("PulseToolbox.redis is not defined. Sensors cannot be created")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
module PulseMeter
|
2
|
+
module Sensor
|
3
|
+
class Base
|
4
|
+
attr_accessor :color
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'pulse-meter/visualizer'
|
10
|
+
|
11
|
+
module PulseToolbox
|
12
|
+
module Sensor
|
13
|
+
class Manager
|
14
|
+
extend PulseToolbox::Sensor::Mixins::Iterators
|
15
|
+
# @!attribute [rw] default_options
|
16
|
+
# @return [Hash] default sensor options
|
17
|
+
class_attribute :default_options
|
18
|
+
# @!attribute [rw] sensors_config
|
19
|
+
# @return [Hash] sensors config
|
20
|
+
class_attribute :sensors_config
|
21
|
+
# @!attribute [rw] configurator
|
22
|
+
# @return [PulseMeter::Sensor::Configuration] configurator instance
|
23
|
+
class_attribute :configurator
|
24
|
+
# @!attribute [rw] monitoring_layout
|
25
|
+
# @return [PulseMeter::Visualize::DSL::Layout] layout for monitoring page
|
26
|
+
class_attribute :monitoring_layout
|
27
|
+
|
28
|
+
self.monitoring_layout = PulseMeter::Visualize::DSL::Layout.new
|
29
|
+
|
30
|
+
self.default_options = {
|
31
|
+
:ttl => 1.day,
|
32
|
+
:interval => 1.minute,
|
33
|
+
:raw_data_ttl => 1.hour,
|
34
|
+
:reduce_delay => 2.minutes
|
35
|
+
}.freeze
|
36
|
+
|
37
|
+
self.sensors_config = {
|
38
|
+
:max => {
|
39
|
+
:title => "Max times",
|
40
|
+
:sensors => {
|
41
|
+
:db_time => {
|
42
|
+
:sensor_type => 'timelined/max',
|
43
|
+
:color => '#0000FF',
|
44
|
+
:args => {
|
45
|
+
:annotation => "DB"
|
46
|
+
}
|
47
|
+
},
|
48
|
+
:view_time => {
|
49
|
+
:sensor_type => 'timelined/max',
|
50
|
+
:color => '#00FF00',
|
51
|
+
:args => {
|
52
|
+
:annotation => "View"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
:total_time => {
|
56
|
+
:sensor_type => 'timelined/max',
|
57
|
+
:color => '#FF0000',
|
58
|
+
:args => {
|
59
|
+
:annotation => "Total"
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
:p95 => {
|
65
|
+
:title => "95% percentile times",
|
66
|
+
:sensors => {
|
67
|
+
:db_time => {
|
68
|
+
:sensor_type => 'timelined/percentile',
|
69
|
+
:color => '#0000FF',
|
70
|
+
:args => {
|
71
|
+
:annotation => "DB",
|
72
|
+
:p => 0.95
|
73
|
+
}
|
74
|
+
},
|
75
|
+
:view_time => {
|
76
|
+
:sensor_type => 'timelined/percentile',
|
77
|
+
:color => '#00FF00',
|
78
|
+
:args => {
|
79
|
+
:annotation => "View",
|
80
|
+
:p => 0.95
|
81
|
+
}
|
82
|
+
},
|
83
|
+
:total_time => {
|
84
|
+
:sensor_type => 'timelined/percentile',
|
85
|
+
:color => '#FF0000',
|
86
|
+
:args => {
|
87
|
+
:annotation => "Total",
|
88
|
+
:p => 0.95
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
# Creates all sensors from sensors_config
|
96
|
+
def self.create_sensors
|
97
|
+
config = cfg
|
98
|
+
self.configurator = PulseMeter::Sensor::Configuration.new(cfg)
|
99
|
+
each_sensor do |s|
|
100
|
+
s.color = config[s.name.to_sym][:color]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class << self
|
105
|
+
# Logs rails request timing to various sensors
|
106
|
+
# @param total_time [Float] total request time
|
107
|
+
# @param view_time [Float] view time of request
|
108
|
+
# @param db_time [Float] db time of request
|
109
|
+
def log_request(total_time, view_time, db_time)
|
110
|
+
[
|
111
|
+
[:max_db_time, db_time],
|
112
|
+
[:p95_db_time, db_time],
|
113
|
+
[:max_view_time, view_time],
|
114
|
+
[:p95_view_time, view_time],
|
115
|
+
[:max_total_time, total_time],
|
116
|
+
[:p95_total_time, total_time]
|
117
|
+
].each {|name, value = e| event(name, value)}
|
118
|
+
end
|
119
|
+
|
120
|
+
# Sends value to sensor by name
|
121
|
+
# @param sensor [Symbol] sensor name
|
122
|
+
# @param value [Float] event value
|
123
|
+
def event(sensor, value)
|
124
|
+
configurator.sensor(sensor).event(value.to_i)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Adds group to config
|
128
|
+
# @param name [Symbol] group name
|
129
|
+
# @param title [String] group title
|
130
|
+
def add_group(name, title = nil)
|
131
|
+
name = name.to_sym
|
132
|
+
sensors_config[name] ||= {}
|
133
|
+
sensors_config[name][:title] = title if title
|
134
|
+
sensors_config[name][:sensors] ||= {}
|
135
|
+
return name
|
136
|
+
end
|
137
|
+
|
138
|
+
# Adds sensor to group in config
|
139
|
+
# @param group [Symbol] group name
|
140
|
+
# @param name [Symbol] sensor name
|
141
|
+
# @param options [Hash] sensor options
|
142
|
+
def add_sensor(group, name, options)
|
143
|
+
name = name.to_sym
|
144
|
+
g = add_group(group)
|
145
|
+
sensors_config[g][:sensors][name] = options
|
146
|
+
return name_in_group(group, name)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Returns monitoring page layout
|
150
|
+
def layout
|
151
|
+
yield(monitoring_layout)
|
152
|
+
monitoring_layout
|
153
|
+
end
|
154
|
+
|
155
|
+
private
|
156
|
+
|
157
|
+
def cfg
|
158
|
+
cfg = {}
|
159
|
+
each_group do |group|
|
160
|
+
sensors_config[group][:sensors].each_pair do |key, params|
|
161
|
+
name = name_in_group(group, key)
|
162
|
+
full_args = default_options.merge(params[:args])
|
163
|
+
params[:args] = default_options.merge(params[:args])
|
164
|
+
cfg[name] = params
|
165
|
+
end
|
166
|
+
end
|
167
|
+
cfg
|
168
|
+
end
|
169
|
+
|
170
|
+
def name_in_group(group, sensor_name)
|
171
|
+
"#{group}_#{sensor_name}".to_sym
|
172
|
+
end
|
173
|
+
|
174
|
+
def get_sensor(group, name)
|
175
|
+
configurator.sensor(name_in_group(group, name))
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module PulseToolbox
|
2
|
+
module Sensor
|
3
|
+
module Mixins
|
4
|
+
module Iterators
|
5
|
+
|
6
|
+
# Executes block for each group
|
7
|
+
# @yieldparam group [Symbol] group name
|
8
|
+
def each_group
|
9
|
+
sensors_config.each_key do |group|
|
10
|
+
yield(group)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Executes block for each group
|
15
|
+
# @yieldparam group [Symbol] group name
|
16
|
+
# @yieldparam title [String] group title
|
17
|
+
def each_group_with_title
|
18
|
+
sensors_config.each_key do |group|
|
19
|
+
yield(group, sensors_config[group][:title] || group)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Executes block for each sensor in group
|
24
|
+
# @param group [Symbol] group name
|
25
|
+
# @yieldparam sensor [Symbol] sensor name
|
26
|
+
def each_sensor_in_group(group)
|
27
|
+
sensors_config[group][:sensors].each_key do |name|
|
28
|
+
sensor = get_sensor(group, name)
|
29
|
+
yield(sensor)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Executes block for each sensor
|
34
|
+
# @yieldparam sensor [Symbol] sensor name
|
35
|
+
def each_sensor
|
36
|
+
each_group do |group|
|
37
|
+
each_sensor_in_group(group) do |sensor|
|
38
|
+
yield(sensor)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns all sensors from config
|
44
|
+
# @return [Array<Symbol>] sensors list
|
45
|
+
def sensors
|
46
|
+
list = []
|
47
|
+
each_sensor {|s| list << s}
|
48
|
+
list
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'pulse-meter/visualizer'
|
2
|
+
|
3
|
+
module PulseToolbox::Server
|
4
|
+
class Monitoring < PulseMeter::Visualize::App
|
5
|
+
def initialize
|
6
|
+
super(layout)
|
7
|
+
end
|
8
|
+
|
9
|
+
def layout
|
10
|
+
PulseToolbox::Sensor::Manager.layout do |l|
|
11
|
+
l.use_utc false
|
12
|
+
|
13
|
+
l.outlier_color '#FF0000'
|
14
|
+
|
15
|
+
l.highchart_options({
|
16
|
+
x_axis: {
|
17
|
+
min_padding: 0,
|
18
|
+
max_padding: 0
|
19
|
+
}
|
20
|
+
})
|
21
|
+
|
22
|
+
l.page "Requests" do |p|
|
23
|
+
|
24
|
+
PulseToolbox::Sensor::Manager.each_group_with_title do |group, title|
|
25
|
+
p.spline title do |w|
|
26
|
+
PulseToolbox::Sensor::Manager.each_sensor_in_group(group) do |s|
|
27
|
+
w.sensor s.name, :color => s.color
|
28
|
+
end
|
29
|
+
|
30
|
+
w.timespan 60 * 60 * 3
|
31
|
+
w.redraw_interval 10
|
32
|
+
|
33
|
+
w.show_last_point true
|
34
|
+
w.values_label "Time"
|
35
|
+
w.width 10
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
p.highchart_options({
|
40
|
+
tooltip: {
|
41
|
+
value_decimals: 0
|
42
|
+
}
|
43
|
+
})
|
44
|
+
end
|
45
|
+
end.to_layout
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/pulse_toolbox/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Sergey Averyanov"]
|
6
|
+
gem.email = ["averyanov@gmail.com"]
|
7
|
+
gem.description = %q{Pulse meter toolbox}
|
8
|
+
gem.summary = %q{Contains rails-oriented sensors and mountable visualisation server}
|
9
|
+
gem.homepage = "https://github.com/averyanov/pulse-meter-rails"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "pulse-meter-rails"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = PulseToolbox::VERSION
|
17
|
+
|
18
|
+
gem.add_runtime_dependency('pulse-meter')
|
19
|
+
gem.add_runtime_dependency('activesupport', '>= 3.0')
|
20
|
+
gem.add_runtime_dependency('rails', '>= 3.0')
|
21
|
+
|
22
|
+
gem.add_development_dependency('capybara')
|
23
|
+
gem.add_development_dependency('rack-test')
|
24
|
+
gem.add_development_dependency('rails')
|
25
|
+
gem.add_development_dependency('rake')
|
26
|
+
gem.add_development_dependency('redcarpet')
|
27
|
+
gem.add_development_dependency('rspec')
|
28
|
+
gem.add_development_dependency('rspec-rails')
|
29
|
+
gem.add_development_dependency('simplecov')
|
30
|
+
gem.add_development_dependency('yard')
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
|
13
|
+
# Ignore all logfiles and tempfiles.
|
14
|
+
/log/*.log
|
15
|
+
/tmp
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "action_controller/railtie"
|
5
|
+
require "action_view/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
|
8
|
+
Bundler.require
|
9
|
+
require "pulse-meter-rails"
|
10
|
+
|
11
|
+
module Dummy
|
12
|
+
class Application < Rails::Application
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration should go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
16
|
+
|
17
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
18
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
19
|
+
|
20
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
21
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
22
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
23
|
+
|
24
|
+
# Activate observers that should always be running.
|
25
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
26
|
+
|
27
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
28
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
29
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
30
|
+
|
31
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
32
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
33
|
+
# config.i18n.default_locale = :de
|
34
|
+
|
35
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
36
|
+
config.encoding = "utf-8"
|
37
|
+
|
38
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
39
|
+
config.filter_parameters += [:password]
|
40
|
+
|
41
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
42
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
43
|
+
# like if you have constraints or database-specific column types
|
44
|
+
# config.active_record.schema_format = :sql
|
45
|
+
|
46
|
+
# Enforce whitelist mode for mass assignment.
|
47
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
48
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
49
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
50
|
+
# config.active_record.whitelist_attributes = true
|
51
|
+
|
52
|
+
# Enable the asset pipeline
|
53
|
+
config.assets.enabled = true
|
54
|
+
|
55
|
+
# Version of your assets, change this if you want to expire all your assets
|
56
|
+
config.assets.version = '1.0'
|
57
|
+
end
|
58
|
+
end
|