Sha256: 80bd57eac2ed90c2f2417747baf388d0c6217f31a300326dac828f5b713024d8

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require_relative "../lib/pixab/version"
require_relative '../lib/MergeRequest.rb'
require_relative '../lib/ComponentSynchronizer.rb'
require_relative '../lib/Localization.rb'
require_relative '../lib/Package.rb'
require_relative '../lib/LocalizationSmartcat.rb'
require_relative '../lib/LocalizationSmartcatImport.rb'
require_relative '../lib/LocalizationSmartcatMerge.rb'
require_relative '../lib/mbox/Mbox.rb'

case ARGV[0]
when '--version'
  puts Pixab::VERSION
when 'merge'
  Pixab::MergeRequest.new(Pixab::RepoManager.new, ARGV[1..-1]).run
when 'sync'
  repo_manager = Pixab::RepoManager.new
  synchronizer = Pixab::ComponentSynchronizer.new(repo_manager, ARGV[1..-1])
  synchronizer.run

  is_need_commit = Pixab::Utilities.display_default_dialog("是否需要提交代码")
  if is_need_commit
    commands = ["-m"]
    if !synchronizer.updated_repo_names.empty?
      default_commit_msg = "[Feature]Update"
      synchronizer.updated_repo_names.each do |repo_name|
        default_commit_msg += " #{repo_name}"
      end
      commands.push("--commit-m")
      commands.push(default_commit_msg)
    end
    Pixab::MergeRequest.new(repo_manager, commands).run
  end
when 'localizePhrase'
  Pixab::Localization.new.run(ARGV[1..-1])
when 'package'
  Pixab::Package.new.run
when 'localize'
  if ARGV.count > 1
    sub_command = ARGV[1]
    case sub_command
    when 'import'
      Pixab::LocalizationSmartcatImport.new.run(ARGV[2..-1])
    when 'merge'
      Pixab::LocalizationSmartcatMerge.new.run(ARGV[2..-1])
    else
      Pixab::LocalizationSmartcat.new.run(ARGV[1..-1])
    end
  else
    Pixab::LocalizationSmartcat.new.run(ARGV[1..-1])
  end
when 'mbox'
  Pixab::Mbox.new.run(ARGV[1..-1])
else
  puts "Invalid command".red
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pixab-1.9.1 exe/pixab
pixab-1.9.0 exe/pixab