summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml2
-rw-r--r--MIT-LICENSE2
-rw-r--r--README.md4
-rw-r--r--Rakefile3
-rwxr-xr-xbin/dashing3
-rw-r--r--dashing.gemspec10
-rw-r--r--javascripts/dashing.coffee2
-rw-r--r--lib/dashing.rb2
-rw-r--r--lib/dashing/app.rb13
-rw-r--r--lib/dashing/cli.rb12
-rw-r--r--shipit.rubygems.yml1
-rw-r--r--templates/project/Gemfile2
-rw-r--r--templates/project/assets/stylesheets/application.scss1
-rw-r--r--templates/project/dashboards/sample.erb4
-rw-r--r--templates/project/jobs/twitter.rb4
-rw-r--r--templates/project/widgets/graph/graph.coffee1
-rw-r--r--templates/project/widgets/graph/graph.html2
-rw-r--r--templates/project/widgets/meter/meter.html2
-rw-r--r--test/app_test.rb1
-rw-r--r--test/cli_test.rb8
21 files changed, 51 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index 2d12c6d..65cbda8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,7 @@
/Gemfile.lock
*.gem
coverage/
+log/
+tmp/
.ruby-version
+history.yml
diff --git a/.travis.yml b/.travis.yml
index 0a28e78..66b5ca9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: ruby
rvm:
- - 2.1.0
+ - 2.1.2
- 2.0.0
- 1.9.3
diff --git a/MIT-LICENSE b/MIT-LICENSE
index 1cb4835..f85bef7 100644
--- a/MIT-LICENSE
+++ b/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014 Shopify
+Copyright (c) 2015 Shopify
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index 01010e0..4aee91f 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
# [Dashing](http://shopify.github.com/dashing)
-![](https://api.travis-ci.org/Shopify/dashing.png)
+[![Build Status](https://secure.travis-ci.org/Shopify/dashing.png?branch=master)](http://travis-ci.org/Shopify/dashing)
Dashing is a Sinatra based framework that lets you build beautiful dashboards. It looks especially great on TVs.
[Check out the homepage](http://shopify.github.com/dashing).
# License
-Distributed under the [MIT license](https://github.com/Shopify/dashing/blob/master/MIT-LICENSE)
+Distributed under the [MIT license](MIT-LICENSE)
diff --git a/Rakefile b/Rakefile
index 765e5bd..fc91969 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,6 @@
require 'rubygems'
require 'rake'
+require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
@@ -7,4 +8,4 @@ Rake::TestTask.new(:test) do |test|
test.pattern = 'test/**/*_test.rb'
end
-task :default => [:test] \ No newline at end of file
+task :default => [:test]
diff --git a/bin/dashing b/bin/dashing
index 97a7af5..cce9340 100755
--- a/bin/dashing
+++ b/bin/dashing
@@ -3,6 +3,7 @@ require "pathname"
bin_file = Pathname.new(__FILE__).realpath
$:.unshift File.expand_path("../../lib", bin_file)
-require 'dashing'
+require 'dashing/cli'
+require 'dashing/downloader'
Dashing::CLI.source_root(File.expand_path('../../templates', bin_file))
Dashing::CLI.start(ARGV)
diff --git a/dashing.gemspec b/dashing.gemspec
index 8ef27f8..2f9df4a 100644
--- a/dashing.gemspec
+++ b/dashing.gemspec
@@ -2,9 +2,9 @@
Gem::Specification.new do |s|
s.name = 'dashing'
- s.version = '1.3.2'
- s.date = '2013-11-21'
- s.executables << 'dashing'
+ s.version = '1.3.4'
+ s.date = '2014-05-30'
+ s.executables = %w(dashing)
s.summary = "The exceptionally handsome dashboard framework."
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_dependency('sinatra', '~> 1.4.4')
s.add_dependency('sinatra-contrib', '~> 1.4.2')
s.add_dependency('thin', '~> 1.6.1')
- s.add_dependency('rufus-scheduler', '~> 3.0.3')
+ s.add_dependency('rufus-scheduler', '~> 2.0.24')
s.add_dependency('thor', '~> 0.18.1')
s.add_dependency('sprockets', '~> 2.10.1')
s.add_dependency('rack', '~> 1.5.2')
@@ -32,4 +32,4 @@ Gem::Specification.new do |s|
s.add_development_dependency('mocha', '~> 0.14.0')
s.add_development_dependency('fakeweb', '~> 1.3.0')
s.add_development_dependency('simplecov', '~> 0.8.2')
-end
+end \ No newline at end of file
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index fa677e8..e5875d8 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -109,8 +109,8 @@ source.addEventListener 'message', (e) ->
if lastEvents[data.id]?.updatedAt != data.updatedAt
if Dashing.debugMode
console.log("Received data for #{data.id}", data)
- lastEvents[data.id] = data
if widgets[data.id]?.length > 0
+ lastEvents[data.id] = data
for widget in widgets[data.id]
widget.receiveData(data)
diff --git a/lib/dashing.rb b/lib/dashing.rb
index 855aa36..3527034 100644
--- a/lib/dashing.rb
+++ b/lib/dashing.rb
@@ -3,4 +3,4 @@ require 'dashing/downloader'
require 'dashing/app'
module Dashing
-end
+end \ No newline at end of file
diff --git a/lib/dashing/app.rb b/lib/dashing/app.rb
index 033849c..0e7f7bb 100644
--- a/lib/dashing/app.rb
+++ b/lib/dashing/app.rb
@@ -6,6 +6,7 @@ require 'coffee-script'
require 'sass'
require 'json'
require 'yaml'
+require 'thin'
SCHEDULER = Rufus::Scheduler.new
@@ -49,7 +50,7 @@ end
end
not_found do
- send_file File.join(settings.public_folder, '404.html')
+ send_file File.join(settings.public_folder, '404.html'), status: 404
end
at_exit do
@@ -119,6 +120,16 @@ get '/views/:widget?.html' do
end
end
+Thin::Server.class_eval do
+ def stop_with_connection_closing
+ Sinatra::Application.settings.connections.dup.each(&:close)
+ stop_without_connection_closing
+ end
+
+ alias_method :stop_without_connection_closing, :stop
+ alias_method :stop, :stop_with_connection_closing
+end
+
def send_event(id, body, target=nil)
body[:id] = id
body[:updatedAt] ||= Time.now.to_i
diff --git a/lib/dashing/cli.rb b/lib/dashing/cli.rb
index 27d8f6b..4b93f89 100644
--- a/lib/dashing/cli.rb
+++ b/lib/dashing/cli.rb
@@ -38,12 +38,12 @@ module Dashing
puts "Invalid generator. Either use widget, dashboard, or job"
end
- desc "install GIST_ID", "Installs a new widget from a gist."
- def install(gist_id)
+ desc "install GIST_ID [--skip]", "Installs a new widget from a gist (skip overwrite)."
+ def install(gist_id, *args)
gist = Downloader.get_gist(gist_id)
public_url = "https://gist.github.com/#{gist_id}"
- install_widget_from_gist(gist)
+ install_widget_from_gist(gist, args.include?('--skip'))
print set_color("Don't forget to edit the ", :yellow)
print set_color("Gemfile ", :yellow, :bold)
@@ -89,15 +89,15 @@ module Dashing
system(command)
end
- def install_widget_from_gist(gist)
+ def install_widget_from_gist(gist, skip_overwrite)
gist['files'].each do |file, details|
if file =~ /\.(html|coffee|scss)\z/
widget_name = File.basename(file, '.*')
new_path = File.join(Dir.pwd, 'widgets', widget_name, file)
- create_file(new_path, details['content'])
+ create_file(new_path, details['content'], :skip => skip_overwrite)
elsif file.end_with?('.rb')
new_path = File.join(Dir.pwd, 'jobs', file)
- create_file(new_path, details['content'])
+ create_file(new_path, details['content'], :skip => skip_overwrite)
end
end
end
diff --git a/shipit.rubygems.yml b/shipit.rubygems.yml
new file mode 100644
index 0000000..c3f42d3
--- /dev/null
+++ b/shipit.rubygems.yml
@@ -0,0 +1 @@
+# using the default shipit config
diff --git a/templates/project/Gemfile b/templates/project/Gemfile
index 3c7e7a9..1235b37 100644
--- a/templates/project/Gemfile
+++ b/templates/project/Gemfile
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
gem 'dashing'
## Remove this if you don't need a twitter widget.
-gem 'twitter', '>= 5.0.0' \ No newline at end of file
+gem 'twitter', '>= 5.9.0' \ No newline at end of file
diff --git a/templates/project/assets/stylesheets/application.scss b/templates/project/assets/stylesheets/application.scss
index fb1ba5d..451f03e 100644
--- a/templates/project/assets/stylesheets/application.scss
+++ b/templates/project/assets/stylesheets/application.scss
@@ -117,6 +117,7 @@ h3 {
}
.icon-background {
+ pointer-events: none;
width: 100%!important;
height: 100%;
position: absolute;
diff --git a/templates/project/dashboards/sample.erb b/templates/project/dashboards/sample.erb
index d41d538..08c3b51 100644
--- a/templates/project/dashboards/sample.erb
+++ b/templates/project/dashboards/sample.erb
@@ -6,7 +6,7 @@
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
- <div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
+ <div data-id="synergy" data-view="Meter" data-title="Synergy" data-height="200" data-width="200" data-min="0" data-max="100" data-suffix="%"></div>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
@@ -22,4 +22,4 @@
</li>
</ul>
<center><div style="font-size: 12px">Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>
-</div> \ No newline at end of file
+</div>
diff --git a/templates/project/jobs/twitter.rb b/templates/project/jobs/twitter.rb
index 26228bc..7b2bd6f 100644
--- a/templates/project/jobs/twitter.rb
+++ b/templates/project/jobs/twitter.rb
@@ -6,8 +6,8 @@ require 'twitter'
twitter = Twitter::REST::Client.new do |config|
config.consumer_key = 'YOUR_CONSUMER_KEY'
config.consumer_secret = 'YOUR_CONSUMER_SECRET'
- config.oauth_token = 'YOUR_OAUTH_TOKEN'
- config.oauth_token_secret = 'YOUR_OAUTH_SECRET'
+ config.access_token = 'YOUR_OAUTH_TOKEN'
+ config.access_token_secret = 'YOUR_OAUTH_SECRET'
end
search_term = URI::encode('#todayilearned')
diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee
index 28ce88e..5d6b9ab 100644
--- a/templates/project/widgets/graph/graph.coffee
+++ b/templates/project/widgets/graph/graph.coffee
@@ -22,6 +22,7 @@ class Dashing.Graph extends Dashing.Widget
data: [{x:0, y:0}]
}
]
+ padding: {top: 0.02, left: 0.02, right: 0.02, bottom: 0.02}
)
@graph.series[0].data = @get('points') if @get('points')
diff --git a/templates/project/widgets/graph/graph.html b/templates/project/widgets/graph/graph.html
index 456dd0f..786bbb7 100644
--- a/templates/project/widgets/graph/graph.html
+++ b/templates/project/widgets/graph/graph.html
@@ -1,5 +1,5 @@
<h1 class="title" data-bind="title"></h1>
-<h2 class="value" data-bind="current | prettyNumber | prepend prefix"></h2>
+<h2 class="value" data-bind="current | prettyNumber | prepend prefix | append suffix"></h2>
<p class="more-info" data-bind="moreinfo"></p>
diff --git a/templates/project/widgets/meter/meter.html b/templates/project/widgets/meter/meter.html
index 16f1f06..72592fb 100644
--- a/templates/project/widgets/meter/meter.html
+++ b/templates/project/widgets/meter/meter.html
@@ -1,6 +1,6 @@
<h1 class="title" data-bind="title"></h1>
-<input class="meter" data-angleOffset=-125 data-angleArc=250 data-width=200 data-readOnly=true data-bind-value="value | shortenedNumber" data-bind-data-min="min" data-bind-data-max="max">
+<input class="meter" data-angleOffset=-125 data-angleArc=250 data-bind-data-height="height | default 200" data-bind-data-width="width | default 200" data-readOnly=true data-bind-value="value | shortenedNumber | prepend prefix | append suffix" data-bind-data-min="min" data-bind-data-max="max">
<p class="more-info" data-bind="moreinfo"></p>
diff --git a/test/app_test.rb b/test/app_test.rb
index 4101e91..36cd310 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -145,6 +145,7 @@ class AppTest < Dashing::Test
cli.stubs(:source_paths).returns([source_path])
silent { cli.new 'new_project' }
+ app.settings.public_folder = File.join(dir, 'new_project/public')
app.settings.views = File.join(dir, 'new_project/dashboards')
app.settings.root = File.join(dir, 'new_project')
yield app.settings.root
diff --git a/test/cli_test.rb b/test/cli_test.rb
index 567827e..4d82296 100644
--- a/test/cli_test.rb
+++ b/test/cli_test.rb
@@ -68,10 +68,10 @@ class CLITest < Dashing::Test
Dir.stubs(:pwd).returns('')
Dashing::Downloader.stubs(:get_gist).returns(JSON.parse(json_response))
- @cli.stubs(:create_file).with('/jobs/ruby_job.rb', 'some job content').once
- @cli.stubs(:create_file).with('/widgets/num/num.html', 'some html content').once
- @cli.stubs(:create_file).with('/widgets/num/num.scss', 'some sass content').once
- @cli.stubs(:create_file).with('/widgets/num/num.coffee', 'some coffee content').once
+ @cli.stubs(:create_file).with('/jobs/ruby_job.rb', 'some job content', {:skip => false}).once
+ @cli.stubs(:create_file).with('/widgets/num/num.html', 'some html content', {:skip => false}).once
+ @cli.stubs(:create_file).with('/widgets/num/num.scss', 'some sass content', {:skip => false}).once
+ @cli.stubs(:create_file).with('/widgets/num/num.coffee', 'some coffee content', {:skip => false}).once
capture_io { @cli.install(123) }
end