Sha256: 797fa67521ef162a7e5fd6220ea321c49b62ca8349db1a526eba15fa13eb9f07

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require 'active_support/all'
require 'digest/md5'
require 'erb'
require 'logger'
require 'notifier'
require 'tempfile'
require 'pathname'
require 'thor'
require 'thor/group'
require 'yaml'
require 'os'
require 'i18n'
require 'pry'
require 'pry-nav'

Encoding.default_internal = "utf-8"
Encoding.default_external = "utf-8"

#Adds a way to retrieve Submodules of a Module, used for CustomContentParsers
class Module
  def submodules
    constants.collect {|const_name| const_get(const_name)}.select {|const| const.class == Module}
  end
end

module Tacape
  ROOT = Pathname.new(File.dirname(__FILE__) + "/..")

  autoload :Cli,      "tacape/cli"
  autoload :Version,  "tacape/version"
  load "tacape/belt.rb"

  def self.config(root_dir = nil)
    root_dir ||= Pathname.new(Dir.pwd)
    path = root_dir.join("config/tacape.yml")

    raise "Invalid Tacape directory; couldn't found config/tacape.yml file." unless File.file?(path)
    content = File.read(path)
    erb = ERB.new(content).result
    YAML.load(erb).with_indifferent_access
  end

  def self.locale
    I18n.load_path = Dir['config/locales/*.yml']
    I18n.backend.load_translations
    
    @locale ||= Belt.current_os.locale
    case @locale
    when 'pt_BR'
      I18n.locale = :"pt-BR"
    else
      I18n.locale = :en
    end
    return @locale
  end
  Tacape.locale

  def self.logger
    @logger ||= Logger.new(File.open("/tmp/tacape.log", "a"))
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tacape-0.0.4 lib/tacape.rb
tacape-0.0.3 lib/tacape.rb