dashing-rails 1.0.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +5 -0
  4. data/CHANGELOG.md +22 -0
  5. data/Gemfile +21 -0
  6. data/Gemfile.lock +150 -0
  7. data/README.md +34 -62
  8. data/app/assets/javascripts/dashing/application.js +1 -12
  9. data/app/assets/stylesheets/dashing/application.css +1 -5
  10. data/app/controllers/dashing/dashboards_controller.rb +3 -3
  11. data/app/controllers/dashing/widgets_controller.rb +2 -7
  12. data/app/views/dashing/{default_widgets/clock → widgets}/clock.html +0 -0
  13. data/app/views/dashing/{default_widgets/comments → widgets}/comments.html +0 -0
  14. data/app/views/dashing/{default_widgets/graph → widgets}/graph.html +0 -0
  15. data/app/views/dashing/{default_widgets/iframe → widgets}/iframe.html +0 -0
  16. data/app/views/dashing/{default_widgets/image → widgets}/image.html +0 -0
  17. data/app/views/dashing/{default_widgets/list → widgets}/list.html +0 -0
  18. data/app/views/dashing/{default_widgets/meter → widgets}/meter.html +0 -0
  19. data/app/views/dashing/{default_widgets/number → widgets}/number.html +0 -0
  20. data/app/views/dashing/{default_widgets/text → widgets}/text.html +0 -0
  21. data/bin/rails +8 -0
  22. data/dashing.gemspec +31 -0
  23. data/lib/dashing.rb +1 -1
  24. data/lib/dashing/configuration.rb +29 -12
  25. data/lib/dashing/engine.rb +7 -3
  26. data/lib/dashing/version.rb +1 -1
  27. data/lib/generators/dashing/install_generator.rb +2 -2
  28. data/lib/generators/dashing/widget_generator.rb +17 -0
  29. data/lib/generators/templates/dashboards/sample.html.erb +1 -1
  30. data/lib/generators/templates/initializer.rb +15 -15
  31. data/lib/generators/templates/widgets/new.coffee +9 -0
  32. data/lib/generators/templates/widgets/new.html +1 -0
  33. data/lib/generators/templates/widgets/new.scss +10 -0
  34. data/spec/dummy/app/{views/dashing/widgets/foo/foo.coffee → assets/images/.keep} +0 -0
  35. data/spec/dummy/app/{views/dashing/widgets/foo/foo.html → assets/javascripts/dashing/widgets/foo.coffee} +0 -0
  36. data/{app/views/dashing/default_widgets → spec/dummy/app/assets/javascripts/dashing/widgets}/index.js +0 -0
  37. data/spec/dummy/app/{views/dashing/widgets/foo → assets/stylesheets/dashing/widgets}/foo.scss +0 -0
  38. data/{app/views/dashing/default_widgets → spec/dummy/app/assets/stylesheets/dashing/widgets}/index.css +0 -0
  39. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  40. data/spec/dummy/app/jobs/sample.rb +9 -0
  41. data/spec/dummy/app/mailers/.keep +0 -0
  42. data/spec/dummy/app/models/.keep +0 -0
  43. data/spec/dummy/app/models/concerns/.keep +0 -0
  44. data/spec/dummy/app/views/dashing/dashboards/sample.html.erb +28 -0
  45. data/spec/dummy/app/views/dashing/widgets/foo.html +0 -0
  46. data/spec/dummy/config/initializers/dashing.rb +57 -0
  47. data/spec/dummy/config/routes.rb +1 -2
  48. data/spec/dummy/lib/assets/.keep +0 -0
  49. data/spec/dummy/log/.keep +0 -0
  50. data/spec/lib/dashing/configuration_spec.rb +19 -9
  51. data/spec/lib/dashing_spec.rb +2 -2
  52. data/{app → vendor}/assets/fonts/dashing/fontawesome-webfont.eot +0 -0
  53. data/{app → vendor}/assets/fonts/dashing/fontawesome-webfont.svg +0 -0
  54. data/{app → vendor}/assets/fonts/dashing/fontawesome-webfont.ttf +0 -0
  55. data/{app → vendor}/assets/fonts/dashing/fontawesome-webfont.woff +0 -0
  56. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/batman.jquery.js +0 -0
  57. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/batman.js +0 -0
  58. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/d3-3.2.8.min.js +0 -0
  59. data/{app → vendor}/assets/javascripts/dashing/dashing-src.coffee +0 -0
  60. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/es5-shim.js +0 -0
  61. data/vendor/assets/javascripts/dashing/index.js +24 -0
  62. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/jquery.gridster.js +0 -0
  63. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/jquery.js +0 -0
  64. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/jquery.knob.js +0 -0
  65. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/jquery.leanModal.min.js +0 -0
  66. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/jquery.timeago.js +0 -0
  67. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/moment.min.js +0 -0
  68. data/{lib/assets/javascripts → vendor/assets/javascripts/dashing}/rickshaw-1.4.3.min.js +0 -0
  69. data/{app/views/dashing/default_widgets/clock → vendor/assets/javascripts/dashing/widgets}/clock.coffee +0 -0
  70. data/{app/views/dashing/default_widgets/comments → vendor/assets/javascripts/dashing/widgets}/comments.coffee +0 -0
  71. data/{app/views/dashing/default_widgets/graph → vendor/assets/javascripts/dashing/widgets}/graph.coffee +0 -0
  72. data/{app/views/dashing/default_widgets/iframe → vendor/assets/javascripts/dashing/widgets}/iframe.coffee +0 -0
  73. data/{app/views/dashing/default_widgets/image → vendor/assets/javascripts/dashing/widgets}/image.coffee +0 -0
  74. data/vendor/assets/javascripts/dashing/widgets/index.js +13 -0
  75. data/{app/views/dashing/default_widgets/list → vendor/assets/javascripts/dashing/widgets}/list.coffee +0 -0
  76. data/{app/views/dashing/default_widgets/meter → vendor/assets/javascripts/dashing/widgets}/meter.coffee +0 -0
  77. data/{app/views/dashing/default_widgets/number → vendor/assets/javascripts/dashing/widgets}/number.coffee +0 -0
  78. data/{app/views/dashing/default_widgets/text → vendor/assets/javascripts/dashing/widgets}/text.coffee +0 -0
  79. data/{app/assets/stylesheets/dashing/dashing.scss → vendor/assets/stylesheets/dashing/dashing-src.scss} +0 -0
  80. data/{lib/assets/stylesheets → vendor/assets/stylesheets/dashing}/font-awesome.css +0 -0
  81. data/vendor/assets/stylesheets/dashing/index.css +15 -0
  82. data/{lib/assets/stylesheets → vendor/assets/stylesheets/dashing}/jquery.gridster.css +0 -0
  83. data/{app/views/dashing/default_widgets/clock → vendor/assets/stylesheets/dashing/widgets}/clock.scss +0 -0
  84. data/{app/views/dashing/default_widgets/comments → vendor/assets/stylesheets/dashing/widgets}/comments.scss +0 -0
  85. data/{app/views/dashing/default_widgets/graph → vendor/assets/stylesheets/dashing/widgets}/graph.scss +0 -0
  86. data/{app/views/dashing/default_widgets/iframe → vendor/assets/stylesheets/dashing/widgets}/iframe.scss +0 -0
  87. data/{app/views/dashing/default_widgets/image → vendor/assets/stylesheets/dashing/widgets}/image.scss +0 -0
  88. data/vendor/assets/stylesheets/dashing/widgets/index.css +12 -0
  89. data/{app/views/dashing/default_widgets/list → vendor/assets/stylesheets/dashing/widgets}/list.scss +0 -0
  90. data/{app/views/dashing/default_widgets/meter → vendor/assets/stylesheets/dashing/widgets}/meter.scss +0 -0
  91. data/{app/views/dashing/default_widgets/number → vendor/assets/stylesheets/dashing/widgets}/number.scss +0 -0
  92. data/{app/views/dashing/default_widgets/text → vendor/assets/stylesheets/dashing/widgets}/text.scss +0 -0
  93. metadata +111 -73
  94. data/spec/dummy/log/test.log +0 -421
@@ -26,20 +26,15 @@ module Dashing
26
26
  end
27
27
 
28
28
  def withdet_path
29
- "#{params[:name]}/#{params[:name]}"
29
+ params[:name]
30
30
  end
31
31
 
32
32
  def prepend_view_paths
33
- prepend_view_path engine_view_path
34
33
  prepend_view_path main_app_view_path
35
34
  end
36
35
 
37
- def engine_view_path
38
- Dashing::Engine.root.join('app', 'views', 'dashing', 'default_widgets')
39
- end
40
-
41
36
  def main_app_view_path
42
- Rails.root.join(Dashing.config.widgets_path)
37
+ Rails.root.join(Dashing.config.widgets_views_path)
43
38
  end
44
39
 
45
40
  def template_not_found
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/dashing/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dashing/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'dashing-rails'
8
+ spec.version = Dashing::VERSION
9
+ spec.authors = ['Pierre-Louis Gottfrois']
10
+ spec.email = ['pierrelouis.gottfrois@gmail.com']
11
+ spec.description = 'The exceptionally handsome dashboard framework for Rails.'
12
+ spec.summary = 'The exceptionally handsome dashboard framework for Rails.'
13
+ spec.homepage = 'https://github.com/gottfrois/dashing-rails'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'rails', '~> 4.0.0'
22
+ spec.add_dependency 'jquery-rails', '~> 3.0'
23
+ spec.add_dependency 'coffee-script', '~> 2.2'
24
+ spec.add_dependency 'rufus-scheduler', '~> 3.0'
25
+ spec.add_dependency 'redis', '~> 3.0'
26
+ spec.add_dependency 'connection_pool', '~> 1.1'
27
+
28
+ spec.add_development_dependency 'rspec-rails', '~> 2.14'
29
+ spec.add_development_dependency 'pry-rails', '~> 0.3'
30
+ spec.add_development_dependency 'better_errors', '~> 1.0'
31
+ end
@@ -14,7 +14,7 @@ module Dashing
14
14
  end
15
15
 
16
16
  def first_dashboard
17
- files = Dir[Rails.root.join(config.dashboards_path, '*')].collect { |f| File.basename(f, '.*') }
17
+ files = Dir[Rails.root.join(config.dashboards_views_path, '*')].collect { |f| File.basename(f, '.*') }
18
18
  files.sort.first
19
19
  end
20
20
 
@@ -6,30 +6,47 @@ module Dashing
6
6
  class Configuration
7
7
 
8
8
  attr_reader :redis
9
- attr_accessor :scheduler, :view_path, :jobs_path, :redis_namespace,
10
- :engine_path, :dashboards_path, :dashboard_layout,
11
- :widgets_path, :default_dashboard, :auth_token, :devise_allowed_models,
12
- :redis_host, :redis_port, :redis_password
9
+ attr_accessor :redis_host, :redis_port, :redis_password, :redis_namespace
10
+ attr_accessor :auth_token, :devise_allowed_models
11
+ attr_accessor :jobs_path
12
+ attr_accessor :default_dashboard, :dashboards_views_path, :dashboard_layout_path
13
+ attr_accessor :widgets_views_path, :widgets_js_path, :widgets_css_path
14
+ attr_accessor :engine_path, :scheduler
13
15
 
14
16
  def initialize
17
+ @engine_path = '/dashing'
15
18
  @scheduler = ::Rufus::Scheduler.new
19
+
20
+ # Redis
16
21
  @redis_host = '127.0.0.1'
17
22
  @redis_port = '6379'
18
23
  @redis_password = nil
19
24
  @redis_namespace = 'dashing_events'
20
- @view_path = 'app/views/dashing/'
21
- @jobs_path = 'app/jobs/'
22
- @engine_path = '/dashing'
23
- @dashboards_path = 'app/views/dashing/dashboards/'
24
- @dashboard_layout = 'dashing/dashboard'
25
- @widgets_path = 'app/views/dashing/widgets/'
26
- @default_dashboard = nil
25
+
26
+ # Authorization
27
27
  @auth_token = nil
28
28
  @devise_allowed_models = []
29
+
30
+ # Jobs
31
+ @jobs_path = 'app/jobs/'
32
+
33
+ # Dashboards
34
+ @default_dashboard = nil
35
+ @dashboards_views_path = 'app/views/dashing/dashboards/'
36
+ @dashboard_layout_path = 'dashing/dashboard'
37
+
38
+ # Widgets
39
+ @widgets_views_path = 'app/views/dashing/widgets/'
40
+ @widgets_js_path = 'app/assets/javascripts/dashing'
41
+ @widgets_css_path = 'app/assets/stylesheets/dashing'
29
42
  end
30
43
 
31
44
  def redis
32
- @redis ||= ::ConnectionPool::Wrapper.new(size: request_thread_count, timeout: 3) { ::Redis.new(host: redis_host, port: redis_port, password: redis_password) }
45
+ @redis ||= ::ConnectionPool::Wrapper.new(size: request_thread_count, timeout: 3) { new_redis_connection }
46
+ end
47
+
48
+ def new_redis_connection
49
+ ::Redis.new(host: redis_host, port: redis_port, password: redis_password)
33
50
  end
34
51
 
35
52
  private
@@ -2,9 +2,13 @@ module Dashing
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Dashing
4
4
 
5
- config.assets.paths << Dashing::Engine.root.join('app', 'assets', 'fonts', 'dashing')
6
- config.assets.paths << Dashing::Engine.root.join('app', 'views', 'dashing')
7
- config.assets.paths << Dashing.config.view_path
5
+ config.assets.paths.unshift Dashing::Engine.root.join('vendor', 'assets', 'fonts', 'dashing')
6
+ config.assets.paths.unshift Dashing::Engine.root.join('vendor', 'assets', 'javascripts', 'dashing')
7
+ config.assets.paths.unshift Dashing::Engine.root.join('vendor', 'assets', 'stylesheets', 'dashing')
8
+ config.assets.paths.unshift Dashing.config.widgets_js_path
9
+ config.assets.paths.unshift Dashing.config.widgets_css_path
10
+
11
+ config.paths['app/views'].unshift Dashing::Engine.root.join('app', 'views', 'dashing', 'widgets')
8
12
 
9
13
  initializer 'require dashing jobs' do
10
14
  Dir[Rails.root.join(Dashing.config.jobs_path, '**', '*.rb')].each { |file| require file }
@@ -1,3 +1,3 @@
1
1
  module Dashing
2
- VERSION = "1.0.3"
2
+ VERSION = '2.0.0'
3
3
  end
@@ -19,8 +19,8 @@ module Dashing
19
19
  end
20
20
 
21
21
  def copy_widget_manifests
22
- template 'widgets/index.css', 'app/views/dashing/widgets/index.css'
23
- template 'widgets/index.js', 'app/views/dashing/widgets/index.js'
22
+ template 'widgets/index.css', 'app/assets/stylesheets/dashing/widgets/index.css'
23
+ template 'widgets/index.js', 'app/assets/javascripts/dashing/widgets/index.js'
24
24
  end
25
25
 
26
26
  def copy_job
@@ -0,0 +1,17 @@
1
+ module Dashing
2
+ module Generators
3
+ class WidgetGenerator < ::Rails::Generators::NamedBase
4
+
5
+ source_root File.expand_path('../../templates', __FILE__)
6
+
7
+ desc 'Creates a new Dashing widget.'
8
+
9
+ def widget
10
+ template 'widgets/new.html', "#{Dashing.config.widgets_views_path}#{file_name}.html"
11
+ template 'widgets/new.scss', "#{Dashing.config.widgets_css_path}/widgets/#{file_name}.scss"
12
+ template 'widgets/new.coffee', "#{Dashing.config.widgets_js_path}/widgets/#{file_name}.coffee"
13
+ end
14
+
15
+ end
16
+ end
17
+ 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 -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%%= request.host %>:<%%= request.port %>/widgets/welcome</div></center>
27
+ <center><div style="font-size: 12px">Try this: curl -X PUT 'http://<%%= request.host %>:<%%= request.port %>/dashing/widgets/welcome' --data "widget%5Btext%5D=Dashing+is+awesomecurl"</div></center>
28
28
  </div>
@@ -13,18 +13,22 @@ Dashing.configure do |config|
13
13
  # config.redis_namespace = 'dashing_events'
14
14
 
15
15
  # Dashing come with default widgets using css and coffeescript.
16
- # You can create your own widgets by creating a new folder at the following
17
- # path by default: `/app/views/dashing/`
16
+ # You can create your own widgets by adding the following files:
18
17
  #
19
- # A widget folder is composed of:
20
- # - an HTML file used for layout and bindings
21
- # - a SCSS file for styles
22
- # - a coffeescript file which allows you to handle incoming data & functionality
18
+ # A widget is composed of:
19
+ # - an HTML file used for layout and bindings - app/views/dashing/widgets/foo.html
20
+ # - a SCSS file for styles - app/assets/stylesheets/dashing/widgets/foo.scss
21
+ # - a coffeescript file which allows you to handle incoming data & functionality - app/assets/javascripts/dashing/widgets/foo.coffee
23
22
  #
24
23
  # CSS and JS file will be added to the asset path and the asset pipeline automatically.
25
24
  #
26
25
  # More information at http://shopify.github.io/dashing/
27
- # config.view_path = 'app/views/dashing/'
26
+ #
27
+ # You can change default views and assets paths with the following config:
28
+ #
29
+ # config.widgets_views_path = 'app/views/dashing/widgets/'
30
+ # config.widgets_js_path = 'app/assets/javascripts/dashing'
31
+ # config.widgets_css_path = 'app/assets/stylesheets/dashing'
28
32
 
29
33
  # rufus-scheduler worker path
30
34
  # config.jobs_path = 'app/jobs/'
@@ -33,15 +37,11 @@ Dashing.configure do |config|
33
37
  # Ex: http://your_app/dashing/dashboard/my_dashboard_name
34
38
  # config.engine_path = '/dashing'
35
39
 
36
- # The dashboards path used to find dashboards.
37
- # config.dashboards_path = 'app/views/dashing/dashboards/'
40
+ # The dashboards views path used to find dashboards.
41
+ # config.dashboards_views_path = 'app/views/dashing/dashboards/'
38
42
 
39
43
  # The Dashing layout used to display metrics.
40
- # config.dashboard_layout = 'dashing/dashboard'
41
-
42
- # The widgets path used to find your custom widgets.
43
- # Dashing provide default widgets.
44
- # config.widgets_path = 'app/views/dashing/widgets/'
44
+ # config.dashboard_layout_path = 'dashing/dashboard'
45
45
 
46
46
  # Default dashboard name to load when going to /dashing/dashboards
47
47
  # config.default_dashboard = nil
@@ -52,6 +52,6 @@ Dashing.configure do |config|
52
52
  # config.auth_token = nil
53
53
 
54
54
  # List of Devise models that should access the whole dashboard.
55
- # List the models. E.g: '[ :user, :admin ]'
55
+ # List the models. E.g: '[:user, :admin]'
56
56
  # config.devise_allowed_models = []
57
57
  end
@@ -0,0 +1,9 @@
1
+ class Dashing.<%= class_name.capitalize %> extends Dashing.Widget
2
+
3
+ ready: ->
4
+ # This is fired when the widget is done being rendered
5
+
6
+ onData: (data) ->
7
+ # Handle incoming data
8
+ # You can access the html node of this widget with `@node`
9
+ # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.
@@ -0,0 +1 @@
1
+ <!-- Your new widget html -->
@@ -0,0 +1,10 @@
1
+ // ----------------------------------------------------------------------------
2
+ // Sass declarations
3
+ // ----------------------------------------------------------------------------
4
+
5
+ // ----------------------------------------------------------------------------
6
+ // Widget-<%= class_name.downcase %> styles
7
+ // ----------------------------------------------------------------------------
8
+ .widget-<%= class_name.downcase %> {
9
+
10
+ }
@@ -0,0 +1,9 @@
1
+ current_valuation = 0
2
+
3
+ Dashing.scheduler.every '2s' do
4
+ last_valuation = current_valuation
5
+ current_valuation = rand(100)
6
+
7
+ Dashing.send_event('valuation', { current: current_valuation, last: last_valuation })
8
+ Dashing.send_event('synergy', { value: rand(100) })
9
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,28 @@
1
+ <% content_for :title do %>
2
+ My super sweet dashboard
3
+ <% end %>
4
+
5
+ <div class="gridster">
6
+ <ul>
7
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
8
+ <div data-id="welcome" data-view="Text" data-title="Hello" data-text="This is your shiny new dashboard." data-moreinfo="Protip: You can drag the widgets around!"></div>
9
+ </li>
10
+
11
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
12
+ <div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
13
+ </li>
14
+
15
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
16
+ <div data-id="buzzwords" data-view="List" data-unordered="true" data-title="Buzzwords" data-moreinfo="# of times said around the office"></div>
17
+ </li>
18
+
19
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
20
+ <div data-id="valuation" data-view="Number" data-title="Current Valuation" data-moreinfo="In billions" data-prefix="$"></div>
21
+ </li>
22
+
23
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
24
+ <div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
25
+ </li>
26
+ </ul>
27
+ <center><div style="font-size: 12px">Try this: curl -X PUT 'http://<%= request.host %>:<%= request.port %>/dashing/widgets/welcome' --data "widget%5Btext%5D=Dashing+is+awesomecurl"</div></center>
28
+ </div>
@@ -0,0 +1,57 @@
1
+ # Use this hook to configure Dashing bahaviors.
2
+ Dashing.configure do |config|
3
+ # Scheduler instance.
4
+ # config.scheduler = ::Rufus::Scheduler.new
5
+
6
+ # Redis credentials.
7
+ # See https://devcenter.heroku.com/articles/redistogo to configure redis for heroku.
8
+ # config.redis_host = '127.0.0.1'
9
+ # config.redis_port = '6379'
10
+ # config.redis_password = nil
11
+
12
+ # Redis namespace when pushing new data.
13
+ # config.redis_namespace = 'dashing_events'
14
+
15
+ # Dashing come with default widgets using css and coffeescript.
16
+ # You can create your own widgets by adding the following files:
17
+ #
18
+ # A widget is composed of:
19
+ # - an HTML file used for layout and bindings - app/views/dashing/widgets/foo.html
20
+ # - a SCSS file for styles - app/assets/stylesheets/dashing/widgets/foo.scss
21
+ # - a coffeescript file which allows you to handle incoming data & functionality - app/assets/javascripts/dashing/widgets/foo.coffee
22
+ #
23
+ # CSS and JS file will be added to the asset path and the asset pipeline automatically.
24
+ #
25
+ # More information at http://shopify.github.io/dashing/
26
+ #
27
+ # You can change default views and assets paths with the following config:
28
+ #
29
+ # config.widgets_views_path = 'app/views/dashing/widgets/'
30
+ # config.widgets_js_path = 'app/assets/javascripts/dashing'
31
+ # config.widgets_css_path = 'app/assets/stylesheets/dashing'
32
+
33
+ # rufus-scheduler worker path
34
+ # config.jobs_path = 'app/jobs/'
35
+
36
+ # Engine path to use for accessing engine's routes.
37
+ # Ex: http://your_app/dashing/dashboard/my_dashboard_name
38
+ # config.engine_path = '/dashing'
39
+
40
+ # The dashboards views path used to find dashboards.
41
+ # config.dashboards_views_path = 'app/views/dashing/dashboards/'
42
+
43
+ # The Dashing layout used to display metrics.
44
+ # config.dashboard_layout_path = 'dashing/dashboard'
45
+
46
+ # Default dashboard name to load when going to /dashing/dashboards
47
+ # config.default_dashboard = nil
48
+
49
+ # A secure random string to authenticate with for curl requests.
50
+ # Put nil if you don't want to use authentication.
51
+ # You can use SecureRandom.hex to generate a hex.
52
+ # config.auth_token = nil
53
+
54
+ # List of Devise models that should access the whole dashboard.
55
+ # List the models. E.g: '[:user, :admin]'
56
+ # config.devise_allowed_models = []
57
+ end
@@ -1,4 +1,3 @@
1
1
  Rails.application.routes.draw do
2
-
3
- mount Dashing::Engine => "/dashing"
2
+ mount Dashing::Engine, at: Dashing.config.engine_path
4
3
  end
File without changes
File without changes
@@ -4,22 +4,32 @@ describe Dashing::Configuration do
4
4
 
5
5
  let(:instance) { Dashing::Configuration.new }
6
6
 
7
- it { expect(instance.scheduler).to be_a(::Rufus::Scheduler) }
7
+ it { expect(instance.engine_path).to eq('/dashing') }
8
+ # it { expect(instance.scheduler).to be_a(::Rufus::Scheduler.new) }
9
+ it { expect(instance.redis).to be_a(::Redis) }
10
+
11
+ # Redis
8
12
  it { expect(instance.redis_host).to eq('127.0.0.1') }
9
13
  it { expect(instance.redis_port).to eq('6379') }
10
14
  it { expect(instance.redis_password).to be_nil }
11
15
  it { expect(instance.redis_namespace).to eq('dashing_events') }
12
- it { expect(instance.view_path).to eq('app/views/dashing/') }
13
- it { expect(instance.jobs_path).to eq('app/jobs/') }
14
- it { expect(instance.engine_path).to eq('/dashing') }
15
- it { expect(instance.dashboards_path).to eq('app/views/dashing/dashboards/') }
16
- it { expect(instance.dashboard_layout).to eq('dashing/dashboard') }
17
- it { expect(instance.widgets_path).to eq('app/views/dashing/widgets/') }
18
- it { expect(instance.default_dashboard).to be_nil }
16
+
17
+ # Authorization
19
18
  it { expect(instance.auth_token).to be_nil }
20
19
  it { expect(instance.devise_allowed_models).to be_empty }
21
20
 
22
- it { expect(instance.redis).to be_a(::Redis) }
21
+ # Jobs
22
+ it { expect(instance.jobs_path).to eq('app/jobs/') }
23
+
24
+ # Dashboards
25
+ it { expect(instance.default_dashboard).to be_nil }
26
+ it { expect(instance.dashboards_views_path).to eq('app/views/dashing/dashboards/') }
27
+ it { expect(instance.dashboard_layout_path).to eq('dashing/dashboard') }
28
+
29
+ # Widgets
30
+ it { expect(instance.widgets_views_path).to eq('app/views/dashing/widgets/') }
31
+ it { expect(instance.widgets_js_path).to eq('app/assets/javascripts/dashing') }
32
+ it { expect(instance.widgets_css_path).to eq('app/assets/stylesheets/dashing') }
23
33
 
24
34
  describe '#request_thread_count' do
25
35