Sha256: 416dabd09c3eef4036d80746f94b9230b0e97dabd2fbbf85230b5f954c1bcc7f

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

module Masheri
  class MissingConfig < Exception; end

  def self.load_rails_config!
    if File.exists? rails_config
      load_config! rails_config
    else
      raise MissingConfig.new("Couldn't find config/masheri.yml! Please run rails g masheri:install to create one and populate it with the necessary API credentials.")
    end
  end

  def self.rails_config
    Rails.root.join("config", "masheri.yml")
  end

  class Engine < ::Rails::Engine
    initializer "load_masheri_config" do
      Masheri.load_rails_config!
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masheri-0.3.1 lib/masheri/rails.rb
masheri-0.2.0 lib/masheri/rails.rb