dashing-rails 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +25 -25
- data/README.md +76 -27
- data/app/controllers/dashing/dashboards_controller.rb +1 -1
- data/app/controllers/dashing/widgets_controller.rb +1 -1
- data/app/views/layouts/dashing/dashboard.html.erb +1 -1
- data/lib/dashing.rb +1 -1
- data/lib/dashing/configuration.rb +3 -3
- data/lib/dashing/railtie.rb +1 -1
- data/lib/dashing/version.rb +1 -1
- data/lib/generators/dashing/widget_generator.rb +3 -3
- data/lib/generators/templates/dashboards/sample.html.erb +1 -1
- data/lib/generators/templates/initializer.rb +3 -3
- data/spec/controllers/dashing/widgets_controller_spec.rb +10 -0
- data/spec/lib/dashing/configuration_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/support/controller_spec_helpers.rb +9 -0
- data/vendor/assets/stylesheets/dashing/dashing-src.scss +1 -0
- metadata +7 -31
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Yjk3NWM4NDFmMTZhYWViMWJlM2ZhYWIzYzk0ZmVkM2YxMmU2ZDY5NQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2UwM2U0NzVjN2ZkM2UyYmViMzY4MDkzZmJmYWNkZjg5MDU0MTIwZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTQzNjdhN2Q2OTQ3NjFkZDJhOGE0YzFiMzM0MGM5MTgwNjQwNTVkZjE0YjRk
|
10
|
+
YWEwMzMyMmRmNDM3ZWQwZTAzMzBlMTAwOTc1ZWNmNTBhNDkzOTFiOTk5NDY5
|
11
|
+
MGJiZjM0ZjdhZjkxZTI4OGYzNTZkMWI3MTk4OTExZmUyYTI0OTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTllMDNjYTI5ZjMwYzhlZWNmOGVlMDY5NzA4NmNjY2Y0ZjMwYTFhNzI3YmU5
|
14
|
+
Yjg2YWE0NmJmOTI4ZTI3NmVhYzVjOTUzOWY3NGU2NjFkYzdkYzE4YWJmZGEy
|
15
|
+
ZTA4YzhlN2FlYjUzNTViMDZiMTE5MDE2MDQwZjE4ZGJiZGY5NTE=
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 2.3.0
|
2
|
+
|
3
|
+
* Remove all `Rails.root` occurance and move them to configuration file. Please use a proc or a lambda in the configuration since `Rails` module might not be defined when configuration file is required.
|
4
|
+
|
1
5
|
## 2.2.0
|
2
6
|
|
3
7
|
* Add dashing layout to the installer (re run `rails g dashing:install` if you want to have the dashing default layout file)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dashing-rails (2.
|
4
|
+
dashing-rails (2.3.0)
|
5
5
|
coffee-script (~> 2.2)
|
6
6
|
connection_pool (~> 1.1)
|
7
7
|
jquery-rails (~> 3.0)
|
@@ -12,25 +12,25 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
actionmailer (4.0.
|
16
|
-
actionpack (= 4.0.
|
15
|
+
actionmailer (4.0.2)
|
16
|
+
actionpack (= 4.0.2)
|
17
17
|
mail (~> 2.5.4)
|
18
|
-
actionpack (4.0.
|
19
|
-
activesupport (= 4.0.
|
18
|
+
actionpack (4.0.2)
|
19
|
+
activesupport (= 4.0.2)
|
20
20
|
builder (~> 3.1.0)
|
21
21
|
erubis (~> 2.7.0)
|
22
22
|
rack (~> 1.5.2)
|
23
23
|
rack-test (~> 0.6.2)
|
24
|
-
activemodel (4.0.
|
25
|
-
activesupport (= 4.0.
|
24
|
+
activemodel (4.0.2)
|
25
|
+
activesupport (= 4.0.2)
|
26
26
|
builder (~> 3.1.0)
|
27
|
-
activerecord (4.0.
|
28
|
-
activemodel (= 4.0.
|
27
|
+
activerecord (4.0.2)
|
28
|
+
activemodel (= 4.0.2)
|
29
29
|
activerecord-deprecated_finders (~> 1.0.2)
|
30
|
-
activesupport (= 4.0.
|
30
|
+
activesupport (= 4.0.2)
|
31
31
|
arel (~> 4.0.0)
|
32
32
|
activerecord-deprecated_finders (1.0.3)
|
33
|
-
activesupport (4.0.
|
33
|
+
activesupport (4.0.2)
|
34
34
|
i18n (~> 0.6, >= 0.6.4)
|
35
35
|
minitest (~> 4.2)
|
36
36
|
multi_json (~> 1.3)
|
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
erubis (2.7.0)
|
59
59
|
execjs (2.0.2)
|
60
60
|
hike (1.2.3)
|
61
|
-
i18n (0.6.
|
61
|
+
i18n (0.6.9)
|
62
62
|
jquery-rails (3.0.4)
|
63
63
|
railties (>= 3.0, < 5.0)
|
64
64
|
thor (>= 0.14, < 2.0)
|
@@ -66,10 +66,10 @@ GEM
|
|
66
66
|
mime-types (~> 1.16)
|
67
67
|
treetop (~> 1.4.8)
|
68
68
|
method_source (0.8.2)
|
69
|
-
mime-types (1.25)
|
69
|
+
mime-types (1.25.1)
|
70
70
|
minitest (4.7.5)
|
71
71
|
multi_json (1.8.2)
|
72
|
-
polyglot (0.3.
|
72
|
+
polyglot (0.3.4)
|
73
73
|
pry (0.9.12.2)
|
74
74
|
coderay (~> 1.0.5)
|
75
75
|
method_source (~> 0.8)
|
@@ -79,21 +79,21 @@ GEM
|
|
79
79
|
rack (1.5.2)
|
80
80
|
rack-test (0.6.2)
|
81
81
|
rack (>= 1.0)
|
82
|
-
rails (4.0.
|
83
|
-
actionmailer (= 4.0.
|
84
|
-
actionpack (= 4.0.
|
85
|
-
activerecord (= 4.0.
|
86
|
-
activesupport (= 4.0.
|
82
|
+
rails (4.0.2)
|
83
|
+
actionmailer (= 4.0.2)
|
84
|
+
actionpack (= 4.0.2)
|
85
|
+
activerecord (= 4.0.2)
|
86
|
+
activesupport (= 4.0.2)
|
87
87
|
bundler (>= 1.3.0, < 2.0)
|
88
|
-
railties (= 4.0.
|
88
|
+
railties (= 4.0.2)
|
89
89
|
sprockets-rails (~> 2.0.0)
|
90
|
-
railties (4.0.
|
91
|
-
actionpack (= 4.0.
|
92
|
-
activesupport (= 4.0.
|
90
|
+
railties (4.0.2)
|
91
|
+
actionpack (= 4.0.2)
|
92
|
+
activesupport (= 4.0.2)
|
93
93
|
rake (>= 0.8.7)
|
94
94
|
thor (>= 0.18.1, < 2.0)
|
95
95
|
rake (10.1.0)
|
96
|
-
redis (3.0.
|
96
|
+
redis (3.0.7)
|
97
97
|
rest-client (1.6.7)
|
98
98
|
mime-types (>= 1.16)
|
99
99
|
rspec-core (2.14.7)
|
@@ -107,7 +107,7 @@ GEM
|
|
107
107
|
rspec-core (~> 2.14.0)
|
108
108
|
rspec-expectations (~> 2.14.0)
|
109
109
|
rspec-mocks (~> 2.14.0)
|
110
|
-
rufus-scheduler (3.0.
|
110
|
+
rufus-scheduler (3.0.7)
|
111
111
|
tzinfo
|
112
112
|
simplecov (0.7.1)
|
113
113
|
multi_json (~> 1.0)
|
data/README.md
CHANGED
@@ -3,11 +3,13 @@
|
|
3
3
|
[![Code Climate](https://codeclimate.com/github/gottfrois/dashing-rails.png)](https://codeclimate.com/github/gottfrois/dashing-rails)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/gottfrois/dashing-rails/badge.png?branch=master)](https://coveralls.io/r/gottfrois/dashing-rails?branch=master)
|
5
5
|
[![Build Status](https://travis-ci.org/gottfrois/dashing-rails.png?branch=master)](https://travis-ci.org/gottfrois/dashing-rails)
|
6
|
+
[![Flattr Button](http://api.flattr.com/button/button-compact-static-100x17.png "Flattr This!")](https://flattr.com/thing/2339949/gottfroisdashing-rails-on-GitHub)
|
7
|
+
[![codementor-button](https://www.codementor.io/d/images/badge-dark.png "Codementor")](https://www.codementor.io/gottfrois?utm_campaign=profile&utm_source=button-gottfrois&utm_medium=dark)
|
6
8
|
|
7
9
|
Dashing-rails is the Rails Engine version of [Dashing by Shopify](http://shopify.github.io/dashing/).
|
8
10
|
A huge thanks to Shopify for their great work with the Sinatra version.
|
9
11
|
|
10
|
-
**Warning**: To upgrade from `
|
12
|
+
**Warning**: To upgrade from `2.2.x` to `2.3.x` please read `CHANGELOG.md`.
|
11
13
|
|
12
14
|
<img src="https://dl.dropboxusercontent.com/u/29838807/dashing-rails.png" width="600" />
|
13
15
|
|
@@ -15,6 +17,10 @@ A huge thanks to Shopify for their great work with the Sinatra version.
|
|
15
17
|
|
16
18
|
Dashing is a Rails engine that lets you build beautiful dashboards.
|
17
19
|
|
20
|
+
[Click here for a video tutorial on how to use this gem:](http://devcasts.co/dashing-rails-making-dashingly-handsome-dashboards/)
|
21
|
+
|
22
|
+
[![dashing-rails-devcast](http://devcasts.co/wp-content/uploads/2014/03/dashing-rails.png)](http://devcasts.co/dashing-rails-making-dashingly-handsome-dashboards/)
|
23
|
+
|
18
24
|
Check out a demo over [here](http://dashingdemo.herokuapp.com/sample). [Here's another one](http://dashingdemo.herokuapp.com/sampletv), optimized for 1080p screens.
|
19
25
|
|
20
26
|
Key features:
|
@@ -37,36 +43,50 @@ Key features:
|
|
37
43
|
|
38
44
|
1. Install the gem by adding the following in your `Gemfile`:
|
39
45
|
|
40
|
-
|
46
|
+
```ruby
|
47
|
+
gem 'dashing-rails'
|
48
|
+
```
|
41
49
|
|
42
50
|
2. Install puma server by adding the following in your `Gemfile`:
|
43
51
|
|
44
|
-
|
52
|
+
```ruby
|
53
|
+
gem 'puma'
|
54
|
+
```
|
45
55
|
|
46
56
|
3. Bundle install
|
47
57
|
|
48
|
-
|
58
|
+
```
|
59
|
+
$ bundle
|
60
|
+
```
|
49
61
|
|
50
|
-
4. Install the
|
62
|
+
4. Install the dependencies using the following command:
|
51
63
|
|
52
|
-
|
64
|
+
```
|
65
|
+
$ rails g dashing:install
|
66
|
+
```
|
53
67
|
|
54
68
|
5. Start redis server:
|
55
69
|
|
56
|
-
|
70
|
+
```
|
71
|
+
$ redis-server
|
72
|
+
```
|
57
73
|
|
58
|
-
6. Open `config/development.rb` and add:
|
74
|
+
6. Open `config/environments/development.rb` and add:
|
59
75
|
|
60
|
-
|
76
|
+
```ruby
|
77
|
+
config.allow_concurrency = true
|
78
|
+
```
|
61
79
|
|
62
80
|
7. Start your server (must be a multi threaded server - See [Requirements](https://github.com/gottfrois/dashing-rails#requirements))
|
63
81
|
|
64
|
-
|
82
|
+
```
|
83
|
+
$ rails s
|
84
|
+
```
|
65
85
|
|
66
86
|
8. Point your browser at [http://localhost:3000/dashing/dashboards](http://localhost:3000/dashing/dashboards) and have fun!
|
67
87
|
|
68
88
|
|
69
|
-
**Important Note:** *We need to update the configuration in development to handle multiple requests at the same time. One request for the page we’re working on, and another request for the
|
89
|
+
**Important Note:** *We need to update the configuration in development to handle multiple requests at the same time. One request for the page we’re working on, and another request for the Server Sent Event controller.*
|
70
90
|
|
71
91
|
- - -
|
72
92
|
|
@@ -74,8 +94,9 @@ Every new Dashing project comes with sample widgets & sample dashboards for you
|
|
74
94
|
|
75
95
|
* `app/views/dashing/dashboards` — One .erb file for each dashboard that contains the layout for the widgets.
|
76
96
|
* `app/jobs` — Your ruby jobs for fetching data (e.g for calling third party APIs like twitter).
|
77
|
-
* `app/assets/javascripts/dashing/widgets/` —
|
78
|
-
* `app/assets/stylesheets/dashing/widgets/` —
|
97
|
+
* `app/assets/javascripts/dashing/widgets/` — A widget's name `.coffee` file containing your widget's js.
|
98
|
+
* `app/assets/stylesheets/dashing/widgets/` — A widget's name `.scss` file containing your widget's css.
|
99
|
+
* `app/views/dashing/widgets/` — A widget's name `.html` file containing your widget's html.
|
79
100
|
* `app/views/layouts/dashing/` — All your custom layouts where your dashboards and widgets will be included.
|
80
101
|
|
81
102
|
## Getting Data Into Your Widgets
|
@@ -88,16 +109,20 @@ Dashing uses [rufus-scheduler](http://rufus.rubyforge.org/rufus-scheduler/) to s
|
|
88
109
|
|
89
110
|
Example:
|
90
111
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
112
|
+
```ruby
|
113
|
+
# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
|
114
|
+
Dashing.scheduler.every '1m', first_in: 1.second.since do |job|
|
115
|
+
Dashing.send_event('karma', { current: rand(1000) })
|
116
|
+
end
|
117
|
+
```
|
95
118
|
|
96
119
|
This job will run every minute, and will send a random number to ALL widgets that have `data-id` set to `"karma"`.
|
97
120
|
|
98
121
|
You send data using the following method:
|
99
122
|
|
100
|
-
|
123
|
+
```ruby
|
124
|
+
Dashing.send_event(widget_id, json_formatted_data)
|
125
|
+
```
|
101
126
|
|
102
127
|
Jobs are where you put stuff such as fetching metrics from a database, or calling a third party API like Twitter. Since the data fetch is happening in only one place, it means that all instances of widgets are in sync.
|
103
128
|
|
@@ -111,21 +136,29 @@ This way you can have a seperate Rails 4 application (with puma) running your da
|
|
111
136
|
|
112
137
|
You can specify Dashing redis credentials in `config/initializers/dashing.rb`:
|
113
138
|
|
114
|
-
|
115
|
-
|
116
|
-
|
139
|
+
```ruby
|
140
|
+
config.redis_host = '127.0.0.1'
|
141
|
+
config.redis_port = '6379'
|
142
|
+
config.redis_password = '123456'
|
143
|
+
```
|
117
144
|
|
118
145
|
By default Dashing subscribed to the following namespace in redis:
|
119
146
|
|
120
|
-
|
147
|
+
```
|
148
|
+
dashing_events.*
|
149
|
+
```
|
121
150
|
|
122
151
|
where `*` can be anything. This give you all the flexibility you need to push to redis. For example the `send_event` method provided by Dashing uses the following namespace:
|
123
152
|
|
124
|
-
|
153
|
+
```ruby
|
154
|
+
redis.publish("dashing_events.create", {})
|
155
|
+
```
|
125
156
|
|
126
157
|
You can configure the redis namespace in `config/initializers/dashing.rb`:
|
127
158
|
|
128
|
-
|
159
|
+
```ruby
|
160
|
+
config.redis_namespace = 'your_redis_namespace'
|
161
|
+
```
|
129
162
|
|
130
163
|
### API
|
131
164
|
|
@@ -135,12 +168,22 @@ Your widgets can be updated directly over HTTP. Post the data you want in json t
|
|
135
168
|
|
136
169
|
Example:
|
137
170
|
|
138
|
-
|
171
|
+
```
|
172
|
+
curl -X PUT http://localhost:3000/dashing/widgets/welcome -d "widget[text]=Dashing is awesome"
|
173
|
+
```
|
174
|
+
|
175
|
+
or
|
176
|
+
|
177
|
+
```
|
178
|
+
curl -X PUT http://localhost:3000/dashing/widgets/karma -d "widget[current]=100" -d "auth_token=YOUR_AUTH_TOKEN"
|
179
|
+
```
|
139
180
|
|
140
181
|
or
|
141
182
|
|
142
|
-
|
143
|
-
|
183
|
+
```ruby
|
184
|
+
HTTParty.post('http://localhost:3000/dashing/widgets/karma',
|
185
|
+
body: { auth_token: "YOUR_AUTH_TOKEN", current: 1000 }.to_json)
|
186
|
+
```
|
144
187
|
|
145
188
|
#### Dasboards
|
146
189
|
|
@@ -180,6 +223,8 @@ Does not work in Internet Explorer because it relies on [Server Sent Events](htt
|
|
180
223
|
* [Dashing-rails contributors](https://github.com/gottfrois/dashing-rails/contributors)
|
181
224
|
* [Shopify Dashing contributors](https://github.com/Shopify/dashing/graphs/contributors)
|
182
225
|
|
226
|
+
Special thanks to [Benjamin Roth](https://github.com/apneadiving) for his ideas and support.
|
227
|
+
|
183
228
|
All contributions are more than welcome; especially new widgets!
|
184
229
|
|
185
230
|
Please add spec to your Pull Requests and run them using:
|
@@ -189,3 +234,7 @@ Please add spec to your Pull Requests and run them using:
|
|
189
234
|
## License
|
190
235
|
|
191
236
|
Dashing is released under the [MIT license](https://github.com/gottfrois/dashing-rails/blob/master/MIT-LICENSE)
|
237
|
+
|
238
|
+
|
239
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gottfrois/dashing-rails/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
240
|
+
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<%= javascript_include_tag 'dashing/application' %>
|
12
12
|
<%= stylesheet_link_tag 'dashing/application' %>
|
13
13
|
|
14
|
-
<link href='
|
14
|
+
<link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
|
15
15
|
<link rel="icon" href="/favicon.ico">
|
16
16
|
</head>
|
17
17
|
<body>
|
data/lib/dashing.rb
CHANGED
@@ -14,7 +14,7 @@ module Dashing
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def first_dashboard
|
17
|
-
files = Dir[
|
17
|
+
files = Dir[config.dashboards_views_path.call.join('*')].collect { |f| File.basename(f, '.*') }
|
18
18
|
files.sort.first
|
19
19
|
end
|
20
20
|
|
@@ -28,15 +28,15 @@ module Dashing
|
|
28
28
|
@devise_allowed_models = []
|
29
29
|
|
30
30
|
# Jobs
|
31
|
-
@jobs_path = 'app
|
31
|
+
@jobs_path = -> { Rails.root.join('app', 'jobs') }
|
32
32
|
|
33
33
|
# Dashboards
|
34
34
|
@default_dashboard = nil
|
35
|
-
@dashboards_views_path = 'app
|
35
|
+
@dashboards_views_path = -> { Rails.root.join('app', 'views', 'dashing', 'dashboards') }
|
36
36
|
@dashboard_layout_path = 'dashing/dashboard'
|
37
37
|
|
38
38
|
# Widgets
|
39
|
-
@widgets_views_path = 'app
|
39
|
+
@widgets_views_path = -> { Rails.root.join('app', 'views', 'dashing', 'widgets') }
|
40
40
|
@widgets_js_path = 'app/assets/javascripts/dashing'
|
41
41
|
@widgets_css_path = 'app/assets/stylesheets/dashing'
|
42
42
|
end
|
data/lib/dashing/railtie.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dashing
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
initializer 'require dashing jobs' do
|
4
|
-
Dir[
|
4
|
+
Dir[Dashing.config.jobs_path.call.join('**', '*.rb')].each { |file| require file }
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
data/lib/dashing/version.rb
CHANGED
@@ -7,9 +7,9 @@ module Dashing
|
|
7
7
|
desc 'Creates a new Dashing widget.'
|
8
8
|
|
9
9
|
def widget
|
10
|
-
template 'widgets/new.html',
|
11
|
-
template 'widgets/new.scss',
|
12
|
-
template 'widgets/new.coffee',
|
10
|
+
template 'widgets/new.html', Dashing.config.widgets_views_path.call.join(file_name, '.html')
|
11
|
+
template 'widgets/new.scss', Dashing.config.widgets_css_path.join('widgets', file_name, '.scss')
|
12
|
+
template 'widgets/new.coffee', Dashing.config.widgets_js_path.join('widgets', file_name, '.coffee')
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
@@ -24,5 +24,5 @@
|
|
24
24
|
<div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
|
25
25
|
</li>
|
26
26
|
</ul>
|
27
|
-
<center><div style="font-size: 12px">Try this: curl -X PUT 'http://<%%= request.host %>:<%%= request.port %>/dashing/widgets/welcome'
|
27
|
+
<center><div style="font-size: 12px">Try this: curl -X PUT 'http://<%%= request.host %>:<%%= request.port %>/dashing/widgets/welcome' -d "widget[text]=Dashing is awesome"</div></center>
|
28
28
|
</div>
|
@@ -26,19 +26,19 @@ Dashing.configure do |config|
|
|
26
26
|
#
|
27
27
|
# You can change default views and assets paths with the following config:
|
28
28
|
#
|
29
|
-
# config.widgets_views_path = 'app
|
29
|
+
# config.widgets_views_path = -> { Rails.root.join('app', 'views', 'dashing', 'widgets') }
|
30
30
|
# config.widgets_js_path = 'app/assets/javascripts/dashing'
|
31
31
|
# config.widgets_css_path = 'app/assets/stylesheets/dashing'
|
32
32
|
|
33
33
|
# rufus-scheduler worker path
|
34
|
-
# config.jobs_path = 'app
|
34
|
+
# config.jobs_path = -> { Rails.root.join('app', 'jobs') }
|
35
35
|
|
36
36
|
# Engine path to use for accessing engine's routes.
|
37
37
|
# Ex: http://your_app/dashing/dashboard/my_dashboard_name
|
38
38
|
# config.engine_path = '/dashing'
|
39
39
|
|
40
40
|
# The dashboards views path used to find dashboards.
|
41
|
-
# config.dashboards_views_path = 'app
|
41
|
+
# config.dashboards_views_path = -> { Rails.root.join('app', 'views', 'dashing', 'dashboards') }
|
42
42
|
|
43
43
|
# The Dashing layout used to display metrics.
|
44
44
|
# config.dashboard_layout_path = 'dashing/dashboard'
|
@@ -2,6 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Dashing::WidgetsController do
|
4
4
|
|
5
|
+
let(:redis) { double }
|
6
|
+
|
7
|
+
before do
|
8
|
+
stub_redis(redis)
|
9
|
+
end
|
10
|
+
|
5
11
|
describe 'GET "show"' do
|
6
12
|
|
7
13
|
def action(params = {})
|
@@ -43,6 +49,10 @@ describe Dashing::WidgetsController do
|
|
43
49
|
|
44
50
|
context 'when valid' do
|
45
51
|
|
52
|
+
before do
|
53
|
+
expect(redis).to receive(:publish)
|
54
|
+
end
|
55
|
+
|
46
56
|
it 'responds success' do
|
47
57
|
action(name: 'foo')
|
48
58
|
expect(response).to be_success
|
@@ -19,15 +19,15 @@ describe Dashing::Configuration do
|
|
19
19
|
it { expect(instance.devise_allowed_models).to be_empty }
|
20
20
|
|
21
21
|
# Jobs
|
22
|
-
it { expect(instance.jobs_path).to
|
22
|
+
it { expect(instance.jobs_path.call.to_s).to include('app/jobs') }
|
23
23
|
|
24
24
|
# Dashboards
|
25
25
|
it { expect(instance.default_dashboard).to be_nil }
|
26
|
-
it { expect(instance.dashboards_views_path).to
|
26
|
+
it { expect(instance.dashboards_views_path.call.to_s).to include('app/views/dashing/dashboards') }
|
27
27
|
it { expect(instance.dashboard_layout_path).to eq('dashing/dashboard') }
|
28
28
|
|
29
29
|
# Widgets
|
30
|
-
it { expect(instance.widgets_views_path).to
|
30
|
+
it { expect(instance.widgets_views_path.call.to_s).to include('app/views/dashing/widgets') }
|
31
31
|
it { expect(instance.widgets_js_path).to eq('app/assets/javascripts/dashing') }
|
32
32
|
it { expect(instance.widgets_css_path).to eq('app/assets/stylesheets/dashing') }
|
33
33
|
|
data/spec/spec_helper.rb
CHANGED
@@ -12,13 +12,15 @@ require 'rspec/autorun'
|
|
12
12
|
|
13
13
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
14
14
|
# in spec/support/ and its subdirectories.
|
15
|
-
Dir[
|
15
|
+
Dir[File.join(File.dirname(__FILE__), '../', 'spec/support/**/*.rb')].each { |f| require f }
|
16
16
|
|
17
17
|
# Checks for pending migrations before tests are run.
|
18
18
|
# If you are not using ActiveRecord, you can remove this line.
|
19
19
|
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
20
20
|
|
21
21
|
RSpec.configure do |config|
|
22
|
+
config.include ControllerSpecHelpers, type: :controller
|
23
|
+
|
22
24
|
# ## Mock Framework
|
23
25
|
#
|
24
26
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dashing-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Pierre-Louis Gottfrois
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
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: :runtime
|
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: jquery-rails
|
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: :runtime
|
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: coffee-script
|
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: rufus-scheduler
|
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: redis
|
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
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: connection_pool
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rspec-rails
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ~>
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: pry-rails
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ~>
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,7 +118,6 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ~>
|
140
123
|
- !ruby/object:Gem::Version
|
@@ -142,7 +125,6 @@ dependencies:
|
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: better_errors
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
129
|
- - ~>
|
148
130
|
- !ruby/object:Gem::Version
|
@@ -150,7 +132,6 @@ dependencies:
|
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
136
|
- - ~>
|
156
137
|
- !ruby/object:Gem::Version
|
@@ -269,6 +250,7 @@ files:
|
|
269
250
|
- spec/lib/dashing/configuration_spec.rb
|
270
251
|
- spec/lib/dashing_spec.rb
|
271
252
|
- spec/spec_helper.rb
|
253
|
+
- spec/support/controller_spec_helpers.rb
|
272
254
|
- vendor/assets/fonts/dashing/fontawesome-webfont.eot
|
273
255
|
- vendor/assets/fonts/dashing/fontawesome-webfont.svg
|
274
256
|
- vendor/assets/fonts/dashing/fontawesome-webfont.ttf
|
@@ -313,33 +295,26 @@ files:
|
|
313
295
|
homepage: https://github.com/gottfrois/dashing-rails
|
314
296
|
licenses:
|
315
297
|
- MIT
|
298
|
+
metadata: {}
|
316
299
|
post_install_message:
|
317
300
|
rdoc_options: []
|
318
301
|
require_paths:
|
319
302
|
- lib
|
320
303
|
required_ruby_version: !ruby/object:Gem::Requirement
|
321
|
-
none: false
|
322
304
|
requirements:
|
323
305
|
- - ! '>='
|
324
306
|
- !ruby/object:Gem::Version
|
325
307
|
version: '0'
|
326
|
-
segments:
|
327
|
-
- 0
|
328
|
-
hash: -2264989463200480633
|
329
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
330
|
-
none: false
|
331
309
|
requirements:
|
332
310
|
- - ! '>='
|
333
311
|
- !ruby/object:Gem::Version
|
334
312
|
version: '0'
|
335
|
-
segments:
|
336
|
-
- 0
|
337
|
-
hash: -2264989463200480633
|
338
313
|
requirements: []
|
339
314
|
rubyforge_project:
|
340
|
-
rubygems_version:
|
315
|
+
rubygems_version: 2.2.2
|
341
316
|
signing_key:
|
342
|
-
specification_version:
|
317
|
+
specification_version: 4
|
343
318
|
summary: The exceptionally handsome dashboard framework for Rails.
|
344
319
|
test_files:
|
345
320
|
- spec/controllers/dashing/application_controller_spec.rb
|
@@ -398,3 +373,4 @@ test_files:
|
|
398
373
|
- spec/lib/dashing/configuration_spec.rb
|
399
374
|
- spec/lib/dashing_spec.rb
|
400
375
|
- spec/spec_helper.rb
|
376
|
+
- spec/support/controller_spec_helpers.rb
|