Sha256: 31227b3679b8245819ebc7984f2ba5883f6ea84a8dd943e6b92b09ccfad9db84

Contents?: true

Size: 1011 Bytes

Versions: 3

Compression:

Stored size: 1011 Bytes

Contents

#!/usr/bin/env ruby

require "thor"
require "irb"
require_relative "../lib/localer"

module Localer
  class CLI < Thor
    desc "version", "Print Localer version"
    def version
      say Localer::VERSION
    end

    desc "check [/path/to/rails/application]", "Check missing translations"
    def check(app_path = Localer::Config::APP_PATH)
      Localer.configure(options.dup.merge(app_path: app_path))

      connect_to_rails

      if Localer.data.complete?
        say "\xE2\x9C\x94 No missing translations found.", :green
      else
        missing_translations = Localer.data.missing_translations
        say "\xE2\x9C\x96 Missing translations found (#{missing_translations.count}):", :red
        missing_translations.each do |tr|
          say "* #{tr}"
        end

        exit 1
      end
    end

    default_task :check

    private

    def connect_to_rails
      return if Localer::Rails.connect!
      say "No Rails application found"
      exit 1
    end
  end
end


Localer::CLI.start(ARGV)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
localer-0.2.0 bin/localer
localer-0.1.1 bin/localer
localer-0.1.0 bin/localer