Sha256: e3c5254a2d0c150d037a5fd11b4afcd9ac35745b383bae8ad0aa1100e07208d6

Contents?: true

Size: 1.04 KB

Versions: 19

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + '/my_dashboard'
module MyDashboard
  class << self

    delegate :scheduler, :redis, to: :config

    attr_accessor :configuration

    def config
      self.configuration ||= Configuration.new
    end

    def configure
      yield config if block_given?
    end

    def first_dashboard
      files = Dir[config.dashboards_views_path.join('*')].collect { |f| File.basename(f, '.*') }
      files.sort.first
    end

    def send_event(id, data)
      event = data.merge(id: id, updatedAt: Time.now.utc.to_i).to_json
      redis.hset("#{MyDashboard.config.redis_namespace}.latest", id, event)
      redis.publish("#{MyDashboard.config.redis_namespace}.create", event)
    end

  end
end

begin
  require 'rails'
rescue LoadError
end

$stderr.puts <<-EOC if !defined?(Rails)
warning: no framework detected.

Your Gemfile might not be configured properly.
---- e.g. ----
Rails:
    gem 'my_dashboard'

EOC

require 'my_dashboard/configuration'

if defined? Rails
  require 'my_dashboard/engine'
  require 'my_dashboard/railtie'
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
my_dashboard-0.8.6 lib/my_dashboard.rb
my_dashboard-0.8.5 lib/my_dashboard.rb
my_dashboard-0.8.4 lib/my_dashboard.rb
my_dashboard-0.8.3 lib/my_dashboard.rb
my_dashboard-0.8.1 lib/my_dashboard.rb
my_dashboard-0.8.0 lib/my_dashboard.rb
my_dashboard-0.7.2 lib/my_dashboard.rb
my_dashboard-0.7.1 lib/my_dashboard.rb
my_dashboard-0.7.0 lib/my_dashboard.rb
my_dashboard-0.6.0 lib/my_dashboard.rb
my_dashboard-0.5.10 lib/my_dashboard.rb
my_dashboard-0.5.9 lib/my_dashboard.rb
my_dashboard-0.5.8 lib/my_dashboard.rb
my_dashboard-0.5.7 lib/my_dashboard.rb
my_dashboard-0.5.6 lib/my_dashboard.rb
my_dashboard-0.5.5 lib/my_dashboard.rb
my_dashboard-0.5.4 lib/my_dashboard.rb
my_dashboard-0.5.3 lib/my_dashboard.rb
my_dashboard-0.5.2 lib/my_dashboard.rb