dashing 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ require 'rufus/scheduler'
5
5
  require 'coffee-script'
6
6
  require 'sass'
7
7
  require 'json'
8
+ require 'yaml'
8
9
 
9
10
  SCHEDULER = Rufus::Scheduler.start_new
10
11
 
@@ -17,7 +18,21 @@ set :digest_assets, false
17
18
  settings.sprockets.append_path path
18
19
  end
19
20
 
20
- set server: 'thin', connections: [], history: {}
21
+ set server: 'thin', connections: [], history_file: 'history.yml'
22
+
23
+ # Persist history in tmp file at exit
24
+ at_exit do
25
+ File.open(settings.history_file, 'w') do |f|
26
+ f.puts settings.history.to_yaml
27
+ end
28
+ end
29
+
30
+ if File.exists?(settings.history_file)
31
+ set history: YAML.load_file(settings.history_file)
32
+ else
33
+ set history: {}
34
+ end
35
+
21
36
  set :public_folder, File.join(settings.root, 'public')
22
37
  set :views, File.join(settings.root, 'dashboards')
23
38
  set :default_dashboard, nil
@@ -50,17 +65,20 @@ end
50
65
 
51
66
  get '/:dashboard' do
52
67
  protected!
53
- if File.exist? File.join(settings.views, "#{params[:dashboard]}.erb")
54
- erb params[:dashboard].to_sym
55
- else
56
- halt 404
68
+ tilt_html_engines.each do |suffix, _|
69
+ file = File.join(settings.views, "#{params[:dashboard]}.#{suffix}")
70
+ return render(suffix.to_sym, params[:dashboard].to_sym) if File.exist? file
57
71
  end
72
+
73
+ halt 404
58
74
  end
59
75
 
60
76
  get '/views/:widget?.html' do
61
77
  protected!
62
- widget = params[:widget]
63
- send_file File.join(settings.root, 'widgets', widget, "#{widget}.html")
78
+ tilt_html_engines.each do |suffix, engines|
79
+ file = File.join(settings.root, "widgets", params[:widget], "#{params[:widget]}.#{suffix}")
80
+ return engines.first.new(file).render if File.exist? file
81
+ end
64
82
  end
65
83
 
66
84
  post '/widgets/:id' do
@@ -107,11 +125,18 @@ def latest_events
107
125
  end
108
126
 
109
127
  def first_dashboard
110
- files = Dir[File.join(settings.views, '*.erb')].collect { |f| f.match(/(\w*).erb/)[1] }
128
+ files = Dir[File.join(settings.views, '*')].collect { |f| File.basename(f, '.*') }
111
129
  files -= ['layout']
112
130
  files.first
113
131
  end
114
132
 
133
+ def tilt_html_engines
134
+ Tilt.mappings.select do |_, engines|
135
+ default_mime_type = engines.first.default_mime_type
136
+ default_mime_type.nil? || default_mime_type == 'text/html'
137
+ end
138
+ end
139
+
115
140
  Dir[File.join(settings.root, 'lib', '**', '*.rb')].each {|file| require file }
116
141
  {}.to_json # Forces your json codec to initialize (in the event that it is lazily loaded). Does this before job threads start.
117
142
 
@@ -1,4 +1,4 @@
1
- <% content_for(:title) { "My super sweet dashboard" } %>
1
+ <% content_for :title do %>My super sweet dashboard<% end %>
2
2
  <div class="gridster">
3
3
  <ul>
4
4
  <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
@@ -8,7 +8,7 @@ $(function() {
8
8
  </script>
9
9
 
10
10
 
11
- <% content_for(:title) { "1080p dashboard" } %>
11
+ <% content_for :title do %>1080p dashboard<% end %>
12
12
 
13
13
  <div class="gridster">
14
14
  <ul>
metadata CHANGED
@@ -1,141 +1,160 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dashing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ prerelease:
5
+ version: 1.1.0
5
6
  platform: ruby
6
7
  authors:
7
8
  - Daniel Beauchamp
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-06-14 00:00:00.000000000 Z
12
+ date: 2013-06-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- prerelease: false
15
- name: sass
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ! '>='
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
15
  version_requirements: !ruby/object:Gem::Requirement
22
16
  requirements:
23
17
  - - ! '>='
24
18
  - !ruby/object:Gem::Version
25
19
  version: '0'
20
+ none: false
21
+ name: sass
26
22
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
23
  prerelease: false
29
- name: coffee-script
30
24
  requirement: !ruby/object:Gem::Requirement
31
25
  requirements:
32
26
  - - ! '>='
33
27
  - !ruby/object:Gem::Version
34
- version: 1.6.2
28
+ version: '0'
29
+ none: false
30
+ - !ruby/object:Gem::Dependency
35
31
  version_requirements: !ruby/object:Gem::Requirement
36
32
  requirements:
37
33
  - - ! '>='
38
34
  - !ruby/object:Gem::Version
39
35
  version: 1.6.2
36
+ none: false
37
+ name: coffee-script
40
38
  type: :runtime
41
- - !ruby/object:Gem::Dependency
42
39
  prerelease: false
43
- name: sinatra
44
40
  requirement: !ruby/object:Gem::Requirement
45
41
  requirements:
46
42
  - - ! '>='
47
43
  - !ruby/object:Gem::Version
48
- version: '0'
44
+ version: 1.6.2
45
+ none: false
46
+ - !ruby/object:Gem::Dependency
49
47
  version_requirements: !ruby/object:Gem::Requirement
50
48
  requirements:
51
49
  - - ! '>='
52
50
  - !ruby/object:Gem::Version
53
51
  version: '0'
52
+ none: false
53
+ name: sinatra
54
54
  type: :runtime
55
- - !ruby/object:Gem::Dependency
56
55
  prerelease: false
57
- name: sinatra-contrib
58
56
  requirement: !ruby/object:Gem::Requirement
59
57
  requirements:
60
58
  - - ! '>='
61
59
  - !ruby/object:Gem::Version
62
60
  version: '0'
61
+ none: false
62
+ - !ruby/object:Gem::Dependency
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ! '>='
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
+ none: false
69
+ name: sinatra-contrib
68
70
  type: :runtime
69
- - !ruby/object:Gem::Dependency
70
71
  prerelease: false
71
- name: thin
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
+ none: false
78
+ - !ruby/object:Gem::Dependency
77
79
  version_requirements: !ruby/object:Gem::Requirement
78
80
  requirements:
79
81
  - - ! '>='
80
82
  - !ruby/object:Gem::Version
81
83
  version: '0'
84
+ none: false
85
+ name: thin
82
86
  type: :runtime
83
- - !ruby/object:Gem::Dependency
84
87
  prerelease: false
85
- name: rufus-scheduler
86
88
  requirement: !ruby/object:Gem::Requirement
87
89
  requirements:
88
90
  - - ! '>='
89
91
  - !ruby/object:Gem::Version
90
92
  version: '0'
93
+ none: false
94
+ - !ruby/object:Gem::Dependency
91
95
  version_requirements: !ruby/object:Gem::Requirement
92
96
  requirements:
93
97
  - - ! '>='
94
98
  - !ruby/object:Gem::Version
95
99
  version: '0'
100
+ none: false
101
+ name: rufus-scheduler
96
102
  type: :runtime
97
- - !ruby/object:Gem::Dependency
98
103
  prerelease: false
99
- name: thor
100
104
  requirement: !ruby/object:Gem::Requirement
101
105
  requirements:
102
106
  - - ! '>='
103
107
  - !ruby/object:Gem::Version
104
108
  version: '0'
109
+ none: false
110
+ - !ruby/object:Gem::Dependency
105
111
  version_requirements: !ruby/object:Gem::Requirement
106
112
  requirements:
107
113
  - - ! '>='
108
114
  - !ruby/object:Gem::Version
109
115
  version: '0'
116
+ none: false
117
+ name: thor
110
118
  type: :runtime
111
- - !ruby/object:Gem::Dependency
112
119
  prerelease: false
113
- name: sprockets
114
120
  requirement: !ruby/object:Gem::Requirement
115
121
  requirements:
116
122
  - - ! '>='
117
123
  - !ruby/object:Gem::Version
118
124
  version: '0'
125
+ none: false
126
+ - !ruby/object:Gem::Dependency
119
127
  version_requirements: !ruby/object:Gem::Requirement
120
128
  requirements:
121
129
  - - ! '>='
122
130
  - !ruby/object:Gem::Version
123
131
  version: '0'
132
+ none: false
133
+ name: sprockets
124
134
  type: :runtime
125
- - !ruby/object:Gem::Dependency
126
135
  prerelease: false
127
- name: rack
128
136
  requirement: !ruby/object:Gem::Requirement
129
137
  requirements:
130
138
  - - ! '>='
131
139
  - !ruby/object:Gem::Version
132
140
  version: '0'
141
+ none: false
142
+ - !ruby/object:Gem::Dependency
133
143
  version_requirements: !ruby/object:Gem::Requirement
134
144
  requirements:
135
145
  - - ! '>='
136
146
  - !ruby/object:Gem::Version
137
147
  version: '0'
148
+ none: false
149
+ name: rack
138
150
  type: :runtime
151
+ prerelease: false
152
+ requirement: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ none: false
139
158
  description: This framework lets you build & easily layout dashboards with your own
140
159
  custom widgets. Use it to make a status boards for your ops team, or use it to track
141
160
  signups, conversion rates, or whatever else metrics you'd like to see in one spot.
@@ -219,7 +238,6 @@ files:
219
238
  - bin/dashing
220
239
  homepage: http://shopify.github.com/dashing
221
240
  licenses: []
222
- metadata: {}
223
241
  post_install_message:
224
242
  rdoc_options: []
225
243
  require_paths:
@@ -229,15 +247,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
247
  - - ! '>='
230
248
  - !ruby/object:Gem::Version
231
249
  version: '0'
250
+ none: false
232
251
  required_rubygems_version: !ruby/object:Gem::Requirement
233
252
  requirements:
234
253
  - - ! '>='
235
254
  - !ruby/object:Gem::Version
236
255
  version: '0'
256
+ none: false
237
257
  requirements: []
238
258
  rubyforge_project:
239
- rubygems_version: 2.0.0
259
+ rubygems_version: 1.8.23
240
260
  signing_key:
241
- specification_version: 4
261
+ specification_version: 3
242
262
  summary: The exceptionally handsome dashboard framework.
243
263
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- N2Q3MzM2YmQzYjQyOTQxYjk2OGNjMjRkMjBiMjM1Mzg1N2NhODkyMQ==
5
- data.tar.gz: !binary |-
6
- ZjkxYWEzZmIwNjliZDM1Yjg1OTljNmY4MDY0NDhkYTQzMTcyMDc2ZA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- OGYwZGVlZTFkMThkMzJkNjZhNGQ5ZTI0ODI0OTAzY2VkNTc2MmYxNzFhYTI2
10
- NjIyNjZlOTNhNmVmMTA1MzBlZGY4YmU5ZDRhYjBjZjM4YmZmODFjYWM3Mzg1
11
- NzhiOWM5Zjg2NDQ3MGUwMTRkZTM4ZGJmNmMxZWMxMmU1ZTUzOGY=
12
- data.tar.gz: !binary |-
13
- MGUxNDU0NzAwMmFmNGI1Zjg2ODNiNzU5Mjk2OGMzYWM4YTRlMTc4ZGUyNjBk
14
- ZjZhMTFlY2U1NTI4MWRmMzU0M2E3NGZiOTJmYTJjODExYmQxYTI4NzZjYTg5
15
- MzM0MzA5YzlmYTNiM2Y1OWI3N2ZiYzFmZGUyYTAwMDliY2ZmNzY=