sinatra-geckoboard 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -4
- data/lib/sinatra/geckoboard.rb +10 -11
- metadata +40 -7
data/README.md
CHANGED
@@ -6,7 +6,13 @@ A little [Sinatra](http://www.sinatrarb.com/) extension to expose data nicely to
|
|
6
6
|
|
7
7
|
## Install
|
8
8
|
|
9
|
-
Install with
|
9
|
+
Install with Rubygems:
|
10
|
+
|
11
|
+
gem install sinatra-geckoboard
|
12
|
+
|
13
|
+
If you use bundler, add it to your Gemfile:
|
14
|
+
|
15
|
+
gem "sinatra-geckoboard", "~>0.1.0"
|
10
16
|
|
11
17
|
## Usage
|
12
18
|
|
@@ -17,7 +23,7 @@ require 'sinatra/geckoboard'
|
|
17
23
|
class App < Sinatra::Base
|
18
24
|
register Sinatra::Geckoboard
|
19
25
|
|
20
|
-
get 'pie_graph' do
|
26
|
+
get '/pie_graph' do
|
21
27
|
pie_chart [ { "label" => "Chuck Norris",
|
22
28
|
"value" => 3,
|
23
29
|
"colour" => "#ff9900" },
|
@@ -27,8 +33,8 @@ class App < Sinatra::Base
|
|
27
33
|
]
|
28
34
|
end
|
29
35
|
|
30
|
-
get 'line_chart' do
|
31
|
-
|
36
|
+
get '/line_chart' do
|
37
|
+
line_chart [1, 3], ["value1", "value2"], ["top1", "top2"], "#ff9900"
|
32
38
|
end
|
33
39
|
end
|
34
40
|
```
|
data/lib/sinatra/geckoboard.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Sinatra
|
2
4
|
module Geckoboard
|
3
5
|
|
@@ -12,14 +14,12 @@ module Sinatra
|
|
12
14
|
# @param [String] colour
|
13
15
|
# @return [String] the line chart as json string
|
14
16
|
def line_chart(values=[], axisx=[], axisy=[], colour="")
|
15
|
-
render_widget
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
})
|
17
|
+
render_widget "item" => values,
|
18
|
+
"settings" => {
|
19
|
+
"axisx" => axisx,
|
20
|
+
"axisy" => axisy,
|
21
|
+
"colour" => colour
|
22
|
+
}
|
23
23
|
end
|
24
24
|
|
25
25
|
# Render a pie chart widget
|
@@ -27,10 +27,9 @@ module Sinatra
|
|
27
27
|
# http://support.geckoboard.com/entries/274940-custom-chart-widget-type-definitions
|
28
28
|
#
|
29
29
|
# @param [Array] values array of hash with: value, label and colour keys
|
30
|
+
# @return [String] the pie chart as json string
|
30
31
|
def pie_chart(values=[])
|
31
|
-
render_widget
|
32
|
-
"item" => values
|
33
|
-
})
|
32
|
+
render_widget "item" => values
|
34
33
|
end
|
35
34
|
|
36
35
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-geckoboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-11 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &17976980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,21 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *17976980
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &17976500 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *17976500
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: bundler
|
27
|
-
requirement: &
|
38
|
+
requirement: &17976120 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,32 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :development
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *17976120
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: &17975580 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *17975580
|
36
58
|
- !ruby/object:Gem::Dependency
|
37
59
|
name: rake
|
38
|
-
requirement: &
|
60
|
+
requirement: &17975160 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *17975160
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: &17974700 !ruby/object:Gem::Requirement
|
39
72
|
none: false
|
40
73
|
requirements:
|
41
74
|
- - ! '>='
|
@@ -43,7 +76,7 @@ dependencies:
|
|
43
76
|
version: '0'
|
44
77
|
type: :development
|
45
78
|
prerelease: false
|
46
|
-
version_requirements: *
|
79
|
+
version_requirements: *17974700
|
47
80
|
description: A little Sinatra extension to expose data nicely to Geckoboard.
|
48
81
|
email: francois.de.metz@af83.com
|
49
82
|
executables: []
|