Sha256: 22093ae77b8d936d94ae6dfea1140d5232bdd01773c474b83a98ff689cae46f0

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

if defined?(Rails)
  if ::Rails::VERSION::STRING =~ /^2\.[1-9]/
    module Trackman
      class RackMiddleware
        def initialize(app)
          @app = app
          Trackman::Assets::Asset.autosync
        end
        
        def call(env)
          @app.call(env)
        end
      end
    end
    require './config/environment'
    Rails.configuration.middleware.use Trackman::RackMiddleware 
  elsif ::Rails::VERSION::STRING =~ /^[3-9]\.[1-9]/
    require 'generators/controller/controller_generator'
    module Trackman
      class Railtie < Rails::Railtie
        rake_tasks do
          path = File.expand_path('../../../../rails_generators/trackman_tasks/templates/trackman.rake', __FILE__)
          load path
        end

        initializer "trackman.hook" do |app|
          app.config.after_initialize do
            Trackman::Assets::Asset.autosync
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trackman-0.5.8 lib/trackman/utility/railtie.rb
trackman-0.5.7 lib/trackman/utility/railtie.rb
trackman-0.5.6 lib/trackman/utility/railtie.rb