Sha256: f678f7220b8368a7675e46feb7f01246cb6325b8211fb8eb0f6b52d6091a9fa5

Contents?: true

Size: 626 Bytes

Versions: 4

Compression:

Stored size: 626 Bytes

Contents

require 'logger'
require 'pathname'
require 'active_support/string_inquirer'

module Snails
  def self.root
    @root ||= Pathname.new(Dir.pwd)
  end

  def self.env
    @env ||= ActiveSupport::StringInquirer.new(ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development')
  end

  def self.apps
    @apps ||= []
  end

  def self.app
    puts "Warning: There's more than one Snail app defined!" if @apps.count > 1
    @apps.first
  end

  def self.logger
    @logged ||= Logger.new(File.exist?(root.join('log')) ? root.join('log', "#{Snails.env}.log") : nil)
  end
end

require 'snails/app'
puts "Loaded #{Snails.env} environment."

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snails-0.1.9 lib/snails.rb
snails-0.1.8 lib/snails.rb
snails-0.1.7 lib/snails.rb
snails-0.1.6 lib/snails.rb