smashing 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of smashing might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c534242cb7bac124489f31c70f75cd75eff163a
4
- data.tar.gz: d25e17f9119cc4537e76877ff5e69386c57130e3
3
+ metadata.gz: 9aeb7121836db6b2b12d73f508a9aeb7f32896c0
4
+ data.tar.gz: 03c723a8612aadb44e17c5e42a7c589fafddd193
5
5
  SHA512:
6
- metadata.gz: ede468db168174eba4dd1a0dd82c28d068d5d0f94b5d06ee40ac5e739afde0432783b01024e7537b4b24ab1cd412f730e18e5ce372d73e2d525053b128472b9e
7
- data.tar.gz: 70f13a2dc3d8ea89c3ca12a02d7b44a6d0b0867cee479e0e41b450df02cd82b86ea1cac69e25e3d255d26bb6aba343f2bca40fa3bdab9434db5f3c5f9643497f
6
+ metadata.gz: 82b667fe353297d9a1167e0e0d5e582d4da2087fea4ba3122f2b7dd7be1210c5222f7bea4f89a1e67dbd6364be1af3744816aa16473e0ad504581a4b528594b0
7
+ data.tar.gz: d4137491e1bdaec6aeb234fc5a8de24bf3294bc618831ada85868a7a31d4a75947b9a13ba800db8b2c05c438d8567bf78e140dcf93a8df403aba79f2bfb98a05
data/README.md CHANGED
@@ -1,10 +1,33 @@
1
- # [Smashing](https://github.com/dashing-io/dashing/wiki)
1
+ [![Gitter chat](https://badges.gitter.im/smashing.svg)](https://gitter.im/Smashing)
2
2
 
3
- Smashing, the spiritual successor to Dashing, is a Sinatra based framework that lets you build excellent dashboards. It looks especially great on TVs.
3
+ # [Smashing](https://github.com/Smashing/smashing/wiki)
4
4
 
5
- [Check out our wiki](https://github.com/dashing-io/dashing/wiki).
5
+ Smashing, the spiritual successor to [Dashing](https://github.com/Shopify/dashing), is a Sinatra based framework that lets you build excellent dashboards. It looks especially great on TVs.
6
+
7
+ ## Community
8
+
9
+ Feel free to submit issues for bugs, new features, and enhancements in [GitHub](https://github.com/Smashing/smashing/issues). For more general questions, or help with widgets, please use the [gitter chatroom](https://gitter.im/Smashing).
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ # Install bundler
15
+ $ gem install bundler
16
+ # Install smashing
17
+ $ gem install smashing
18
+ # Create a new project
19
+ $ smashing new my-project
20
+ # Change Directory into the project
21
+ $ cd my-project
22
+ # Install the bundle of project specific gems
23
+ $ bundle
24
+ # Start the example dashboard!
25
+ $ smashing start
26
+ ```
27
+
28
+ [Check out our wiki](https://github.com/Smashing/smashing/wiki).
6
29
 
7
30
  Note: This is a fork of the Dashing project, which is no longer being maintained. Read about that [here](https://github.com/Shopify/dashing/issues/711).
8
31
 
9
- # License
32
+ ## License
10
33
  Distributed under the [MIT license](MIT-LICENSE).
@@ -46,7 +46,7 @@ class Dashing.Widget extends Batman.View
46
46
 
47
47
  @accessor 'updatedAtMessage', ->
48
48
  if updatedAt = @get('updatedAt')
49
- timestamp = new Date(updatedAt * 1000)
49
+ timestamp = new Date(updatedAt)
50
50
  hours = timestamp.getHours()
51
51
  minutes = ("0" + timestamp.getMinutes()).slice(-2)
52
52
  "Last updated at #{hours}:#{minutes}"
@@ -57,16 +57,22 @@ class Dashing.Widget extends Batman.View
57
57
  # In case the events from the server came before the widget was rendered
58
58
  lastData = Dashing.lastEvents[@id]
59
59
  if lastData
60
+ lastData = @select(lastData)
60
61
  @mixin(lastData)
61
62
  @onData(lastData)
62
63
 
63
64
  receiveData: (data) =>
65
+ data = @select(data)
64
66
  @mixin(data)
65
67
  @onData(data)
66
68
 
67
69
  onData: (data) =>
68
70
  # Widgets override this to handle incoming data
69
71
 
72
+ select: (data) =>
73
+ # Widgets override this to transform data before it is applied to the model
74
+ return data
75
+
70
76
  Dashing.AnimatedValue =
71
77
  get: Batman.Property.defaultAccessor.get
72
78
  set: (k, to) ->
@@ -34,16 +34,19 @@ set :root, Dir.pwd
34
34
  set :sprockets, Sprockets::Environment.new(settings.root)
35
35
  set :assets_prefix, '/assets'
36
36
  set :digest_assets, false
37
- set server: 'thin', connections: [], history_file: 'history.yml'
37
+ set :server, 'thin'
38
+ set :connections, []
39
+ set :history_file, 'history.yml'
38
40
  set :public_folder, File.join(settings.root, 'public')
39
41
  set :views, File.join(settings.root, 'dashboards')
40
42
  set :default_dashboard, nil
41
43
  set :auth_token, nil
44
+ set :template_languages, %i[html erb]
42
45
 
43
- if File.exists?(settings.history_file)
44
- set history: YAML.load_file(settings.history_file)
46
+ if File.exist?(settings.history_file)
47
+ set :history, YAML.load_file(settings.history_file)
45
48
  else
46
- set history: {}
49
+ set :history, {}
47
50
  end
48
51
 
49
52
  %w(javascripts stylesheets fonts images).each do |path|
@@ -55,7 +58,7 @@ end
55
58
  end
56
59
 
57
60
  not_found do
58
- send_file File.join(settings.public_folder, '404.html'), status: 404
61
+ send_file File.join(settings.public_folder, '404.html'), :status => 404
59
62
  end
60
63
 
61
64
  at_exit do
@@ -70,7 +73,7 @@ get '/' do
70
73
  redirect "/" + dashboard
71
74
  end
72
75
 
73
- get '/events', provides: 'text/event-stream' do
76
+ get '/events', :provides => 'text/event-stream' do
74
77
  protected!
75
78
  response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
76
79
  stream :keep_open do |out|
@@ -82,9 +85,9 @@ end
82
85
 
83
86
  get '/:dashboard' do
84
87
  protected!
85
- tilt_html_engines.each do |suffix, _|
86
- file = File.join(settings.views, "#{params[:dashboard]}.#{suffix}")
87
- return render(suffix.to_sym, params[:dashboard].to_sym) if File.exist? file
88
+ settings.template_languages.each do |language|
89
+ file = File.join(settings.views, "#{params[:dashboard]}.#{language}")
90
+ return render(language, params[:dashboard].to_sym) if File.exist?(file)
88
91
  end
89
92
 
90
93
  halt 404
@@ -117,10 +120,12 @@ end
117
120
 
118
121
  get '/views/:widget?.html' do
119
122
  protected!
120
- tilt_html_engines.each do |suffix, engines|
121
- file = File.join(settings.root, "widgets", params[:widget], "#{params[:widget]}.#{suffix}")
122
- return engines.first.new(file).render if File.exist? file
123
+ settings.template_languages.each do |language|
124
+ file = File.join(settings.root, "widgets", params[:widget], "#{params[:widget]}.#{language}")
125
+ return Tilt[language].new(file).render if File.exist?(file)
123
126
  end
127
+
128
+ "Drats! Unable to find a widget file named: #{params[:widget]} to render."
124
129
  end
125
130
 
126
131
  Thin::Server.class_eval do
@@ -135,7 +140,7 @@ end
135
140
 
136
141
  def send_event(id, body, target=nil)
137
142
  body[:id] = id
138
- body[:updatedAt] ||= Time.now.to_i
143
+ body[:updatedAt] ||= (Time.now.to_f * 1000.0).to_i
139
144
  event = format_event(body.to_json, target)
140
145
  Sinatra::Application.settings.history[id] = event unless target == 'dashboards'
141
146
  Sinatra::Application.settings.connections.each { |out| out << event }
@@ -159,13 +164,6 @@ def first_dashboard
159
164
  files.sort.first
160
165
  end
161
166
 
162
- def tilt_html_engines
163
- Tilt.mappings.select do |_, engines|
164
- default_mime_type = engines.first.default_mime_type
165
- default_mime_type.nil? || default_mime_type == 'text/html'
166
- end
167
- end
168
-
169
167
  def require_glob(relative_glob)
170
168
  Dir[File.join(settings.root, relative_glob)].each do |file|
171
169
  require file
@@ -173,7 +171,7 @@ def require_glob(relative_glob)
173
171
  end
174
172
 
175
173
  settings_file = File.join(settings.root, 'config/settings.rb')
176
- require settings_file if File.exists?(settings_file)
174
+ require settings_file if File.exist?(settings_file)
177
175
 
178
176
  {}.to_json # Forces your json codec to initialize (in the event that it is lazily loaded). Does this before job threads start.
179
177
  job_path = ENV["JOB_PATH"] || 'jobs'
@@ -86,7 +86,11 @@ module Dashing
86
86
  private
87
87
 
88
88
  def run_command(command)
89
- system(command)
89
+ begin
90
+ system(command)
91
+ rescue Interrupt => e
92
+ say "Exiting..."
93
+ end
90
94
  end
91
95
 
92
96
  def install_widget_from_gist(gist, skip_overwrite)
@@ -1 +1 @@
1
- Check out http://smashing.github.io/ for more information.
1
+ Check out http://smashing.github.io/smashing for more information.
@@ -8,14 +8,14 @@
8
8
  $background-color: #222;
9
9
  $text-color: #fff;
10
10
 
11
- $background-warning-color-1: #e82711;
12
- $background-warning-color-2: #9b2d23;
13
- $text-warning-color: #fff;
14
-
15
- $background-danger-color-1: #eeae32;
16
- $background-danger-color-2: #ff9618;
11
+ $background-danger-color-1: #e82711;
12
+ $background-danger-color-2: #9b2d23;
17
13
  $text-danger-color: #fff;
18
14
 
15
+ $background-warning-color-1: #eeae32;
16
+ $background-warning-color-2: #ff9618;
17
+ $text-warning-color: #fff;
18
+
19
19
  @-webkit-keyframes status-warning-background {
20
20
  0% { background-color: $background-warning-color-1; }
21
21
  50% { background-color: $background-warning-color-2; }
@@ -3,6 +3,10 @@ require 'dashing'
3
3
  configure do
4
4
  set :auth_token, 'YOUR_AUTH_TOKEN'
5
5
 
6
+ # See http://www.sinatrarb.com/intro.html > Available Template Languages on
7
+ # how to add additional template languages.
8
+ set :template_languages, %i[html erb]
9
+
6
10
  helpers do
7
11
  def protected!
8
12
  # Put any authentication code you want in here.
@@ -13,7 +13,7 @@
13
13
  <link rel="stylesheet" href="/assets/application.css">
14
14
 
15
15
  <link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
16
- <link rel="icon" href="/assets/favicon.ico">
16
+ <link rel="icon" href="/public/favicon.ico">
17
17
 
18
18
  </head>
19
19
  <body>
@@ -29,4 +29,4 @@
29
29
  <a href="#saving-instructions" id="save-gridster">Save this layout</a>
30
30
  <% end %>
31
31
  </body>
32
- </html>
32
+ </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smashing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Daniel Beauchamp
7
+ - 'Smashing Org (Inherited from: Daniel Beauchamp)'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-23 00:00:00.000000000 Z
11
+ date: 2017-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -16,196 +16,210 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.12
19
+ version: 3.4.24
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.12
26
+ version: 3.4.24
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coffee-script
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.0
33
+ version: 2.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.0
40
+ version: 2.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: execjs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.2
47
+ version: 2.7.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.2
54
+ version: 2.7.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sinatra
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.4.4
61
+ version: 2.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.4.4
68
+ version: 2.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sinatra-contrib
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.4.2
75
+ version: 2.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.4.2
82
+ version: 2.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: thin
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.6.1
89
+ version: 1.7.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.6.1
96
+ version: 1.7.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rufus-scheduler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.0.24
103
+ version: 3.4.2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.0.24
110
+ version: 3.4.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: thor
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.19'
117
+ version: 0.19.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.19'
124
+ version: 0.19.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sprockets
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.10.1
131
+ version: 3.7.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 2.10.1
138
+ version: 3.7.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rack
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.5.4
145
+ version: 2.0.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.5.4
152
+ version: 2.0.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 10.1.0
159
+ version: 12.0.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 10.1.0
166
+ version: 12.0.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: haml
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 4.0.4
173
+ version: 5.0.1
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 4.0.4
180
+ version: 5.0.1
181
+ - !ruby/object:Gem::Dependency
182
+ name: rack-test
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 0.6.3
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 0.6.3
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: minitest
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: 5.2.0
201
+ version: 5.10.2
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: 5.2.0
208
+ version: 5.10.2
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: mocha
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - "~>"
200
214
  - !ruby/object:Gem::Version
201
- version: 0.14.0
215
+ version: 1.2.1
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - "~>"
207
221
  - !ruby/object:Gem::Version
208
- version: 0.14.0
222
+ version: 1.2.1
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: fakeweb
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +240,14 @@ dependencies:
226
240
  requirements:
227
241
  - - "~>"
228
242
  - !ruby/object:Gem::Version
229
- version: 0.8.2
243
+ version: 0.14.1
230
244
  type: :development
231
245
  prerelease: false
232
246
  version_requirements: !ruby/object:Gem::Requirement
233
247
  requirements:
234
248
  - - "~>"
235
249
  - !ruby/object:Gem::Version
236
- version: 0.8.2
250
+ version: 0.14.1
237
251
  description: A framework for pulling together an overview of data that is important
238
252
  to your team and displaying it easily on TVs around the office. You write a bit
239
253
  of ruby code to gather data from some services and let Smashing handle the rest
@@ -320,7 +334,7 @@ files:
320
334
  - templates/widget/%name%/%name%.coffee.tt
321
335
  - templates/widget/%name%/%name%.html
322
336
  - templates/widget/%name%/%name%.scss.tt
323
- homepage: http://smashing.github.io
337
+ homepage: http://smashing.github.io/smashing
324
338
  licenses:
325
339
  - MIT
326
340
  metadata: {}