Sha256: 5e1d500829c194f73efff538bdac30aa7871e84720d820fd008c5cb877ae3690

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

module Superstore
  class Railtie < Rails::Railtie
    rake_tasks do
      load 'superstore/tasks/ks.rake'
    end

    initializer "superstore.config" do |app|
      ActiveSupport.on_load :superstore do
        pathnames = [Rails.root.join('config', 'cassandra.yml'), Rails.root.join('config', 'superstore.yml')]
        if pathname = pathnames.detect(&:exist?)
          if pathname.basename.to_s == 'cassandra.yml'
            warn "***********************"
            warn "config/cassandra.yml is deprecated. Use config/superstore.yml"
            warn "***********************"
          end

          config = ERB.new(pathname.read).result
          config = YAML.load(config)

          if config = config[Rails.env]
            self.config = config.symbolize_keys!
          else
            raise "Missing environment #{Rails.env} in superstore.yml"
          end
        end
      end
    end

    # Expose database runtime to controller for logging.
    initializer "superstore.log_runtime" do |app|
      require "superstore/railties/controller_runtime"
      ActiveSupport.on_load(:action_controller) do
        include Superstore::Railties::ControllerRuntime
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
superstore-1.2.0 lib/superstore/railtie.rb
superstore-1.1.4 lib/superstore/railtie.rb
superstore-1.1.3 lib/superstore/railtie.rb