ifttt-gdash 0.0.4 → 0.0.5

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGU3ZjlhYTQ1ZGVkOTlhMTgwZGVjNzU2MzZkNmFjNGYzN2ViMTY0Yw==
5
+ data.tar.gz: !binary |-
6
+ NjczNGNiZGYyNTY2NzZmOWJmMWZjN2FiZDVkNTdiNmI5ZThmZWM0MA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDNmNjgyNjNjNWIyZjRjMTYzMzg1YmFkNDQ1YjM4NDZlYzA2YTFkNjBiNTQ0
10
+ OGFiNzczOTUxOGMxNzI5MDM0YzljMjM5YzJiZWY3NTI5YWJhMzQzMTgwZmE4
11
+ MWQ3NTg2MzViNDViNDMzMDIwZGY0NTJmMTExMGQ5YjBkOWI2NjE=
12
+ data.tar.gz: !binary |-
13
+ OGIyZGRkYjc2MDNmMDViYjkzYjZhMjY5ZjQ1MjRhZDA0MGYxZmVhMzJhOThk
14
+ ZGI0YjU3YzBiOTFhZmY4MTk2ZjJlYjQ1NzI2OGIwZmNlNDU0Y2Y2NzQxZWVl
15
+ MTYzNmIwZmRlOWIzMjgwNTQwNmYxNWQxNjU3NjQ0MGRkYmZkNTM=
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifttt-gdash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - R.I.Pienaar
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rdoc
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: graphite_graph
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: sinatra
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: redcarpet
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -96,69 +85,30 @@ email: rip@devco.net
96
85
  executables: []
97
86
  extensions: []
98
87
  extra_rdoc_files: []
99
- files:
100
- - lib/gdash/dashboard.rb
101
- - lib/gdash/monkey_patches.rb
102
- - lib/gdash/sinatra_app.rb
103
- - lib/gdash.rb
104
- - public/js/bootstrap-alerts.js
105
- - public/js/bootstrap-dropdown.js
106
- - public/js/bootstrap-modal.js
107
- - public/js/bootstrap-popover.js
108
- - public/js/bootstrap-scrollspy.js
109
- - public/js/bootstrap-tabs.js
110
- - public/js/bootstrap-twipsy.js
111
- - public/js/jquery-1.5.2.min.js
112
- - public/js/jquery.tablesorter.min.js
113
- - public/js/less-1.1.3.min.js
114
- - public/lib/bootstrap.less
115
- - public/lib/forms.less
116
- - public/lib/mixins.less
117
- - public/lib/patterns.less
118
- - public/lib/reset.less
119
- - public/lib/scaffolding.less
120
- - public/lib/tables.less
121
- - public/lib/type.less
122
- - public/lib/variables.less
123
- - views/_interval_filter.erb
124
- - views/dashboard.erb
125
- - views/detailed_dashboard.erb
126
- - views/full_size_dashboard.erb
127
- - views/index.erb
128
- - views/layout.erb
129
- - views/README.md
130
- - sample/email/cpu.graph
131
- - sample/email/dash.yaml
132
- - sample/email/io.graph
133
- - sample/email/load.graph
134
- - sample/email/network.graph
135
- - sample/email-full-screen.png
136
- - sample/email.png
137
- - sample/README.md
88
+ files: []
138
89
  homepage: http://devco.net/
139
90
  licenses: []
91
+ metadata: {}
140
92
  post_install_message:
141
93
  rdoc_options: []
142
94
  require_paths:
143
95
  - lib
144
96
  - lib
145
97
  required_ruby_version: !ruby/object:Gem::Requirement
146
- none: false
147
98
  requirements:
148
99
  - - ! '>='
149
100
  - !ruby/object:Gem::Version
150
101
  version: '0'
151
102
  required_rubygems_version: !ruby/object:Gem::Requirement
152
- none: false
153
103
  requirements:
154
104
  - - ! '>='
155
105
  - !ruby/object:Gem::Version
156
106
  version: '0'
157
107
  requirements: []
158
108
  rubyforge_project:
159
- rubygems_version: 1.8.28
109
+ rubygems_version: 2.2.2
160
110
  signing_key:
161
- specification_version: 3
111
+ specification_version: 4
162
112
  summary: Graphite Dashboard
163
113
  test_files: []
164
114
  has_rdoc: false
@@ -1,56 +0,0 @@
1
- require 'rubygems'
2
- require 'sinatra/base'
3
- require 'yaml'
4
- require 'erb'
5
- require 'redcarpet'
6
-
7
- class GDash
8
- require 'gdash/dashboard'
9
- require 'gdash/monkey_patches'
10
- require 'gdash/sinatra_app'
11
- require 'graphite_graph'
12
-
13
- attr_reader :graphite_base, :graphite_render, :dash_templates, :height, :width, :from, :until
14
-
15
- def initialize(graphite_base, render_url, dash_templates, options={})
16
- @graphite_base = graphite_base
17
- @graphite_render = [@graphite_base, "/render/"].join
18
- @dash_templates = dash_templates
19
- @height = options.delete(:height)
20
- @width = options.delete(:width)
21
- @from = options.delete(:from)
22
- @until = options.delete(:until)
23
-
24
- raise "Dashboard templates directory #{@dash_templates} does not exist" unless File.directory?(@dash_templates)
25
- end
26
-
27
- def dashboard(name, options={})
28
- options[:width] ||= @width
29
- options[:height] ||= @height
30
- options[:from] ||= @from
31
- options[:until] ||= @until
32
-
33
- Dashboard.new(name, dash_templates, options)
34
- end
35
-
36
- def list
37
- dashboards.map {|dash| dash[:link]}
38
- end
39
-
40
- def dashboards
41
- dashboards = []
42
-
43
- Dir.entries(dash_templates).each do |dash|
44
- begin
45
- yaml_file = File.join(dash_templates, dash, "dash.yaml")
46
- if File.exist?(yaml_file)
47
- dashboards << YAML.load_file(yaml_file).merge({:link => dash})
48
- end
49
- rescue Exception => e
50
- p e
51
- end
52
- end
53
-
54
- dashboards.sort_by{|d| d[:name].to_s}
55
- end
56
- end
@@ -1,52 +0,0 @@
1
- class GDash
2
- class Dashboard
3
- attr_accessor :properties
4
-
5
- def initialize(short_name, dir, options={})
6
- raise "Cannot find dashboard directory #{dir}" unless File.directory?(dir)
7
-
8
- @properties = {:graph_width => nil,
9
- :graph_height => nil,
10
- :graph_from => nil,
11
- :graph_until => nil}
12
-
13
- @properties[:short_name] = short_name
14
- @properties[:directory] = File.join(dir, short_name)
15
- @properties[:yaml] = File.join(dir, short_name, "dash.yaml")
16
-
17
- raise "Cannot find YAML file #{yaml}" unless File.exist?(yaml)
18
-
19
- @properties.merge!(YAML.load_file(yaml))
20
-
21
- # Properties defined in dashboard config file are overridden when given on initialization
22
- @properties[:graph_width] = options.delete(:width) || graph_width
23
- @properties[:graph_height] = options.delete(:height) || graph_height
24
- @properties[:graph_from] = options.delete(:from) || graph_from
25
- @properties[:graph_until] = options.delete(:until) || graph_until
26
- @properties[:options] = options
27
- end
28
-
29
- def graphs(options={})
30
- options[:width] ||= graph_width
31
- options[:height] ||= graph_height
32
- options[:from] ||= graph_from
33
- options[:until] ||= graph_until
34
-
35
- graphs = Dir.entries(directory).select{|f| f.match(/\.graph$/)}
36
-
37
- overrides = options.reject { |k,v| v.nil? }
38
-
39
- graphs.sort.map do |graph|
40
- {:name => File.basename(graph, ".graph"), :graphite => GraphiteGraph.new(File.join(directory, graph), overrides)}
41
- end
42
- end
43
-
44
- def method_missing(method, *args)
45
- if properties.include?(method)
46
- properties[method]
47
- else
48
- super
49
- end
50
- end
51
- end
52
- end
@@ -1,37 +0,0 @@
1
- class Array
2
- def in_groups_of(chunk_size, padded_with=nil)
3
- if chunk_size <= 1
4
- if block_given?
5
- self.each{|a| yield([a])}
6
- else
7
- self
8
- end
9
- else
10
- arr = self.clone
11
-
12
- # how many to add
13
- padding = chunk_size - (arr.size % chunk_size)
14
- padding = 0 if padding == chunk_size
15
-
16
- # pad at the end
17
- arr.concat([padded_with] * padding)
18
-
19
- # how many chunks we'll make
20
- count = arr.size / chunk_size
21
-
22
- # make that many arrays
23
- result = []
24
- count.times {|s| result << arr[s * chunk_size, chunk_size]}
25
-
26
- if block_given?
27
- result.each{|a| yield(a)}
28
- else
29
- result
30
- end
31
- end
32
- end
33
- end
34
-
35
- class GraphiteGraph
36
- attr_accessor :properties, :file
37
- end
@@ -1,166 +0,0 @@
1
- class GDash
2
- class SinatraApp < ::Sinatra::Base
3
- def initialize(graphite_base, graph_templates, options = {})
4
- # where the whisper data is
5
- @whisper_dir = options.delete(:whisper_dir) || "/var/lib/carbon/whisper"
6
-
7
- # where graphite lives
8
- @graphite_base = graphite_base
9
-
10
- # where the graphite renderer is
11
- @graphite_render = [@graphite_base, "/render/"].join
12
-
13
- # where to find graph, dash etc templates
14
- @graph_templates = graph_templates
15
-
16
- # the dash site might have a prefix for its css etc
17
- @prefix = options.delete(:prefix) || ""
18
-
19
- # the page refresh rate
20
- @refresh_rate = options.delete(:refresh_rate) || 60
21
-
22
- # how many columns of graphs do you want on a page
23
- @graph_columns = options.delete(:graph_columns) || 2
24
-
25
- # how wide each graph should be
26
- @graph_width = options.delete(:graph_width)
27
-
28
- # how hight each graph sould be
29
- @graph_height = options.delete(:graph_height)
30
-
31
- # Dashboard title
32
- @dash_title = options.delete(:title) || "Graphite Dashboard"
33
-
34
- # Time filters in interface
35
- @interval_filters = options.delete(:interval_filters) || Array.new
36
-
37
- @intervals = options.delete(:intervals) || []
38
-
39
- @top_level = Hash.new
40
- Dir.entries(@graph_templates).each do |category|
41
- if File.directory?("#{@graph_templates}/#{category}")
42
- unless ("#{category}" =~ /^\./ )
43
- @top_level["#{category}"] = GDash.new(@graphite_base, "/render/", File.join(@graph_templates, "/#{category}"), {:width => @graph_width, :height => @graph_height})
44
- end
45
- end
46
- end
47
-
48
- super()
49
- end
50
-
51
- set :static, true
52
- set :views, File.join(File.expand_path(File.dirname(__FILE__)), "../..", "views")
53
- if Sinatra.const_defined?("VERSION") && Gem::Version.new(Sinatra::VERSION) >= Gem::Version.new("1.3.0")
54
- set :public_folder, File.join(File.expand_path(File.dirname(__FILE__)), "../..", "public")
55
- else
56
- set :public, File.join(File.expand_path(File.dirname(__FILE__)), "../..", "public")
57
- end
58
-
59
- get '/' do
60
- if @top_level.empty?
61
- @error = "No dashboards found in the templates directory"
62
- end
63
-
64
- erb :index
65
- end
66
-
67
- get '/:category/:dash/details/:name' do
68
- if @top_level["#{params[:category]}"].list.include?(params[:dash])
69
- @dashboard = @top_level[@params[:category]].dashboard(params[:dash])
70
- else
71
- @error = "No dashboard called #{params[:dash]} found in #{params[:category]}/#{@top_level[params[:category]].list.join ','}."
72
- end
73
-
74
- if @intervals.empty?
75
- @error = "No intervals defined in configuration"
76
- end
77
-
78
- if main_graph = @dashboard.graphs[params[:name].to_i][:graphite]
79
- @graphs = @intervals.map do |e|
80
- new_props = {:from => e[0], :title => "#{main_graph.properties[:title]} - #{e[1]}"}
81
- new_props = main_graph.properties.merge new_props
82
- GraphiteGraph.new(main_graph.file, new_props)
83
- end
84
- else
85
- @error = "No such graph available"
86
- end
87
-
88
- erb :detailed_dashboard
89
- end
90
-
91
- get '/:category/:dash/full/?*' do
92
- options = {}
93
- params["splat"] = params["splat"].first.split("/")
94
-
95
- params["columns"] = params["splat"][0].to_i || @graph_columns
96
-
97
- if params["splat"].size == 3
98
- options[:width] = params["splat"][1].to_i
99
- options[:height] = params["splat"][2].to_i
100
- else
101
- options[:width] = @graph_width
102
- options[:height] = @graph_height
103
- end
104
-
105
- options.merge!(query_params)
106
-
107
- if @top_level["#{params[:category]}"].list.include?(params[:dash])
108
- @dashboard = @top_level[@params[:category]].dashboard(params[:dash], options)
109
- else
110
- @error = "No dashboard called #{params[:dash]} found in #{params[:category]}/#{@top_level[params[:category]].list.join ','}"
111
- end
112
-
113
- erb :full_size_dashboard, :layout => false
114
- end
115
-
116
- get '/:category/:dash/?*' do
117
- options = {}
118
- params["splat"] = params["splat"].first.split("/")
119
-
120
- case params["splat"][0]
121
- when 'time'
122
- options[:from] = params["splat"][1] || "-1hour"
123
- options[:until] = params["splat"][2] || "now"
124
- end
125
-
126
- options.merge!(query_params)
127
-
128
- if @top_level["#{params[:category]}"].list.include?(params[:dash])
129
- @dashboard = @top_level[@params[:category]].dashboard(params[:dash], options)
130
- else
131
- @error = "No dashboard called #{params[:dash]} found in #{params[:category]}/#{@top_level[params[:category]].list.join ','}."
132
- end
133
-
134
- erb :dashboard
135
- end
136
-
137
- get '/docs/' do
138
- markdown :README, :layout_engine => :erb
139
- end
140
-
141
- helpers do
142
- include Rack::Utils
143
-
144
- alias_method :h, :escape_html
145
-
146
- def link_to_interval(options)
147
- "<a href=\"#{ [@prefix, params[:category], params[:dash], 'time', h(options[:from]), h(options[:to])].join('/') }\">#{ h(options[:label]) }</a>"
148
- end
149
-
150
- def query_params
151
- hash = {}
152
- protected_keys = [:category, :dash, :splat]
153
-
154
- params.each do |k, v|
155
- hash[k.to_sym] = v unless protected_keys.include?(k.to_sym)
156
- end
157
-
158
- hash
159
- end
160
- end
161
-
162
- before do
163
- content_type :html, 'charset' => 'utf-8'
164
- end
165
- end
166
- end