Sha256: 68bca661ee3e9d941692412eab4a2606b50ec55633a84d72c8b96742ab7e58e3

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

$LOAD_PATH.unshift File.expand_path("./lib")

require 'active_support/core_ext'
require 'logger'
require 'digest/md5'
require 'restclient'

require 'masheri/exceptions'
require 'masheri/config'
require 'masheri/query_builder'
require 'masheri/query_methods'

require 'masheri/rpc_client'
require 'masheri/rest_client'
require 'masheri/rest_client/query'

require 'masheri/api_object_base'

require 'masheri/member'
require 'masheri/service'
require 'masheri/key'
require 'masheri/role'
require 'masheri/query'

module Masheri
  @@config = nil

  def self.config
    raise Masheri::ConfigMissing.new unless @@config.present?
    @@config
  end

  def self.config=(other)
    @@config = other
  end

  def self.load_config!(yaml_file)
    Masheri.config = Masheri::Config.new(yaml_file)
  end

  def self.local_config
    File.expand_path("~/.masheri.yml")
  end

  def self.rpc
    Masheri::RpcClient.new
  end

  def self.rest
    Masheri::RestClient.new
  end

  def self.developer_activity(service_id, options)
    Masheri.rest.developer_activity(service_id, options)
  end
end

# TODO: Let config be accepted as command line argument
# (masheri -C config.yml)
if defined?(Rails)
  require 'masheri/rails'
elsif File.exists?(Masheri.local_config)
  Masheri.load_config! Masheri.local_config
elsif defined?(RSpec)
  # Skip testing environment..
else
  raise Masheri::MissingConfig.new
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masheri-0.3.5 lib/masheri.rb
masheri-0.3.4 lib/masheri.rb