Sha256: 60b86aaa37cf99cf361a58c49c8ba465e3bc9815badc4983e378c2584d46590c

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'tr4n5l4te/version'

require 'midwire_common/yaml_setting'
require 'midwire_common/hash'

module Tr4n5l4te
  class << self
    attr_accessor :configuration

    def root
      Pathname.new(File.dirname(__FILE__)).parent
    end

    def string_id
      'tr4n5l4te'
    end

    def default_config_directory
      ".#{string_id}"
    end

    def default_cookie_filename
      'cookies.yml'
    end

    def home_directory
      ENV.fetch('HOME')
    end

    # If you don't have a HOME directory defined, you are on an OS that is
    # retarded, and this call will fail.
    def cookie_file
      dir = File.join(home_directory, default_config_directory)
      module_string = string_id.upcase
      file = ENV.fetch(
        "#{module_string}_COOKIES",
        File.join(dir, default_cookie_filename)
      )
      FileUtils.mkdir_p(dir)
      FileUtils.touch(file)
      file
    end

    def configure
      self.configuration ||= Configuration.new
      yield(configuration)
    end
  end

  autoload :Agent,          'tr4n5l4te/agent'
  autoload :Configuration,  'tr4n5l4te/configuration'
  autoload :Language,       'tr4n5l4te/language'
  autoload :Runner,         'tr4n5l4te/runner'
  autoload :Translator,     'tr4n5l4te/translator'
end

Tr4n5l4te.configure {}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tr4n5l4te-0.1.17 lib/tr4n5l4te.rb
tr4n5l4te-0.1.16 lib/tr4n5l4te.rb
tr4n5l4te-0.1.15 lib/tr4n5l4te.rb
tr4n5l4te-0.1.14 lib/tr4n5l4te.rb
tr4n5l4te-0.1.13 lib/tr4n5l4te.rb
tr4n5l4te-0.1.12 lib/tr4n5l4te.rb
tr4n5l4te-0.1.10 lib/tr4n5l4te.rb
tr4n5l4te-0.1.9 lib/tr4n5l4te.rb
tr4n5l4te-0.1.8 lib/tr4n5l4te.rb
tr4n5l4te-0.1.7 lib/tr4n5l4te.rb