Sha256: eb6603c562799b6ae9773e7052155dea505abb11c3f1153abfde616ee7a03b96

Contents?: true

Size: 911 Bytes

Versions: 4

Compression:

Stored size: 911 Bytes

Contents

require 'i18n/tasks/version'
require 'active_support/core_ext/hash'
require 'active_support/core_ext/string'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/object/try'
require 'term/ansicolor'
require 'erubis'
require 'i18n/tasks/railtie' if defined?(Rails)

module I18n
  module Tasks
    CONFIG_FILES = %w(
      config/i18n-tasks.yml config/i18n-tasks.yml.erb
      i18n-tasks.yml i18n-tasks.yml.erb
    )
    class << self
      def config
        @config ||= begin
          file = File.read(CONFIG_FILES.detect { |f| File.exists?(f) })
          file = YAML.load(Erubis::Eruby.new(file).result) if file.present?
          HashWithIndifferentAccess.new.merge(file.presence || {})
        end
      end

      def warn_deprecated(message)
        STDERR.puts Term::ANSIColor.yellow Term::ANSIColor.bold "i18n-tasks: [DEPRECATED] #{message}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i18n-tasks-0.2.9 lib/i18n/tasks.rb
i18n-tasks-0.2.8 lib/i18n/tasks.rb
i18n-tasks-0.2.7 lib/i18n/tasks.rb
i18n-tasks-0.2.6 lib/i18n/tasks.rb