Class: Xcrowdin::XcodeClient

Inherits:
Object
  • Object
show all
Defined in:
lib/xcrowdin/xcode_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(project_path) ⇒ XcodeClient

Returns a new instance of XcodeClient.



3
4
5
# File 'lib/xcrowdin/xcode_client.rb', line 3

def initialize(project_path)
  @project_path = project_path
end

Instance Method Details

#export_xliff(lang_code, path) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/xcrowdin/xcode_client.rb', line 7

def export_xliff(lang_code, path)
  command = "xcodebuild -exportLocalizations -exportLanguage #{lang_code} -localizationPath #{path} -project #{@project_path}"

  res = IO.popen(command, :err => [:child, :out])
  res.each_line do |text|
    raise(text) if text.include?("xcodebuild: error")
  end
  return "#{path}/#{lang_code}.xliff"
end

#import_xliff(path) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/xcrowdin/xcode_client.rb', line 17

def import_xliff(path)
  command = "xcodebuild -importLocalizations -localizationPath #{path}  -project #{@project_path}"

  res = IO.popen(command, :err => [:child, :out])
  res.each_line do |text|
    raise(text) if text.include?("xcodebuild: error")
  end
end