Sha256: b41c4f69368632445db045b4e25a413dcc120b841eb0f61217e4746945639c1b

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require_relative './LocalizationSmartcat.rb'
require_relative './LocalizationSmartcatImport.rb'

module Pixab 
  
  class LocalizationSmartcatMerge

    def run(commands=nil)
      download_params = []
      import_params = []
      commands.each_index do |index|
        command = commands[index]

        unless command.start_with?("--")
          next
        end

        if command == "--ab"
          download_params += ["--output", "{LANGUAGE}.json", "--tags", "ab"]
          import_params.push("--ab")
          next
        end

        if command == "--abtest"
          download_params += ["--output", "{LANGUAGE}.json", "--tags", "merge_test"]
          import_params.push("--abtest")
          next
        end

        if command.start_with?("--to-")
          import_params.push(command.sub("--to-", "--"))
          import_params.push(commands[index + 1])
        else
          download_params.push(command)
          download_params.push(commands[index + 1])
        end

      end

      LocalizationSmartcat.new.run(download_params)
      LocalizationSmartcatImport.new.run(import_params)
    end

  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pixab-1.8.0 lib/LocalizationSmartcatMerge.rb