Sha256: ecadad559132e109602c63bde2255a6502f92b5430bd13fa7010bce92be8a133

Contents?: true

Size: 1.21 KB

Versions: 18

Compression:

Stored size: 1.21 KB

Contents

# -*- encoding : utf-8 -*-

require 'fileutils'
require 'rubygems'
require 'phrase'

class Phrase::Tool
  autoload :Config, 'phrase/tool/config'
  autoload :Options, 'phrase/tool/options'
  autoload :Formats, 'phrase/formats'
  autoload :Commands, 'phrase/tool/commands'
  autoload :TagValidator, 'phrase/tool/tag_validator'
  autoload :EncodingDetector, 'phrase/tool/encoding_detector'
  autoload :Locale, 'phrase/tool/locale'

  def initialize(argv)
    @args = argv
  end

  def run
    command_name = @args.first
    @options = Phrase::Tool::Options.new(@args, command_name)

    command = case command_name
      when /init/
        Phrase::Tool::Commands::Init.new(@options, @args)
      when /push/
        Phrase::Tool::Commands::Push.new(@options, @args)
      when /pull/
        Phrase::Tool::Commands::Pull.new(@options, @args)
      when /tags/
        Phrase::Tool::Commands::Tags.new(@options, @args)
      else
        if @options.get(:version)
          Phrase::Tool::Commands::ShowVersion.new(@options, @args)
        else
          Phrase::Tool::Commands::ShowHelp.new(@options, @args)
        end
    end
    command.execute!
  end

  def self.config
    @@config_instance ||= Phrase::Tool::Config.new.load
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
phrase-0.4.33 lib/phrase/tool.rb
phrase-0.4.32 lib/phrase/tool.rb
phrase-0.4.31 lib/phrase/tool.rb
phrase-0.4.30 lib/phrase/tool.rb
phrase-0.4.29 lib/phrase/tool.rb
phrase-0.4.28 lib/phrase/tool.rb
phrase-0.4.27 lib/phrase/tool.rb
phrase-0.4.26 lib/phrase/tool.rb
phrase-0.4.25 lib/phrase/tool.rb
phrase-0.4.24 lib/phrase/tool.rb
phrase-0.4.23 lib/phrase/tool.rb
phrase-0.4.22 lib/phrase/tool.rb
phrase-0.4.21 lib/phrase/tool.rb
phrase-0.4.20 lib/phrase/tool.rb
phrase-0.4.19 lib/phrase/tool.rb
phrase-0.4.18 lib/phrase/tool.rb
phrase-0.4.17 lib/phrase/tool.rb
phrase-0.4.16 lib/phrase/tool.rb