Sha256: 3b5f1ec9e01a20a8193a1d24b89ce3cd3f06fe5a9a66da743487cfb424afc6ab

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

require 'rails'
module LoopDance

  class Railtie < Rails::Railtie

    def self.load_dancers
      require 'dancers'
    rescue LoadError => err
      puts "LoopDance: can't load file 'lib/dancers.rb'."
    end

    initializer 'loop_dance.initialize' do
      self.class.load_dancers
      # Do not start dancers if rake or other tasks
      LoopDance.restart_all if server_startup?
    end


    # FIX: Is there more cute solution?
    def server_startup?
      caller.to_s=~/config\.ru/
    end

    rake_tasks do
      load_dancers
      load File.expand_path('../../../tasks/loop_dance.rake', __FILE__)
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loop_dance-0.5.3 lib/loop_dance/railtie.rb
loop_dance-0.4.6 lib/loop_dance/railtie.rb
loop_dance-0.4.5 lib/loop_dance/railtie.rb
loop_dance-0.4.4 lib/loop_dance/railtie.rb
loop_dance-0.4.3 lib/loop_dance/railtie.rb