Sha256: c62b538d4c89c83f80f44987aa6f514e8fed6cf79041c42318873deb16382339

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

# TODO: Only load when needed (enables asset pipeline)
require 'sass-rails'
require 'ice_cube'

require 'network_executive/time_calculations'

module NetworkExecutive

  class Engine < Rails::Engine
    engine_name :network_executive

    isolate_namespace NetworkExecutive

    initializer 'network_executive.extend_time' do |app|
      Time.send :include, TimeCalculations
    end

    initializer 'network_executive.eager_load_default_programs' do |app|
      eager_load_models_in 'programs', self
    end

    initializer 'network_executive.eager_load_user_programs' do |app|
      eager_load_models_in 'programs', app
    end

    initializer 'network_executive.eager_load_channels' do |app|
      eager_load_models_in 'channels', app
    end

    initializer :assets do |app|
      app.config.assets.paths << File.join( root, 'app', 'assets', 'fonts' )

      app.config.assets.precompile += [
        'network_executive.js',
        'network_executive/you_tube.js',
        'network_executive/twitter.js',

        'network_executive.css',
        'network_executive/off_air.css',
        'network_executive/you_tube.css',
        'network_executive/twitter.css',
      ]
    end

  private

    def eager_load_models_in( sub_path, app )
      Dir[ File.join(app.root, 'app', sub_path, '**', '*.rb') ].each do |c|
        require c
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
network_executive-0.0.8 lib/network_executive/engine.rb
network_executive-0.0.7 lib/network_executive/engine.rb