Module: Transync

Defined in:
lib/transync.rb,
lib/transync/version.rb

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.run(mode) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/transync.rb', line 8

def self.run(mode)
  FileUtils.mkdir('.transync_log') unless Dir.exist?('.transync_log')
  path = GdocTrans::CONFIG['XLIFF_FILES_PATH']

  if mode == 'x2g'
    x2g = Xliff2GdocMain.new(path)
    x2g.run
  end

  if mode == 'g2x'
    g2x = Gdoc2XliffMain.new(path)
    g2x.run
  end

  if mode == 'init'
    init = Init.new(path)
    init.run
  end

  if mode == 'test'
    GdocTrans::CONFIG['FILES'].each do |file|
      SyncUtil::check_and_get_xliff_files(GdocTrans::CONFIG['LANGUAGES'], path, file)
    end
  end

  if mode == 'update'
    GdocTrans::CONFIG['FILES'].each do |file|
      SyncUtil::check_and_get_xliff_files(GdocTrans::CONFIG['LANGUAGES'], path, file, true)
    end
  end
end