Sha256: 5b096238585b95062d8060a81e7dfe37af1e2ca4037f860c683f9d15717df8cb

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require "yaml"

module Octopus
  def self.env()
    @env ||= defined?(Rails) ? Rails.env.to_s : 'octopus'
  end
  
  def self.config()
    @config ||= HashWithIndifferentAccess.new(YAML.load_file(Octopus.directory() + "/config/shards.yml"))
  end

  # Returns the Rails.root_to_s when you are using rails
  # Running the current directory in a generic Ruby process
  def self.directory()
    @directory ||= defined?(Rails) ?  Rails.root.to_s : Dir.pwd     
  end
  
  # This is the default way to do Octopus Setup
  # Available variables:
  # :excluded_enviroments => the enviroments that octopus will not run. default: :development, :cucumber and :test
  def self.setup
    yield self
  end
  
  def self.excluded_enviroments=(excluded_enviroments)
    @excluded_enviroments = excluded_enviroments.map { |element| element.to_s }
  end
  
  def self.excluded_enviroments
    @excluded_enviroments || ['development',"cucumber", "test"]
  end
end

require "octopus/proxy"
require "octopus/migration"
require "octopus/model"
require "octopus/persistence"
require "octopus/controller"
require "octopus/association"
require "octopus/association_collection"
require "octopus/scope_proxy"
require "octopus/has_and_belongs_to_many_association"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar-octopus-0.0.18 lib/octopus.rb
ar-octopus-0.0.16 lib/octopus.rb