Class: Applyrics::IBTool

Inherits:
Object
  • Object
show all
Defined in:
lib/applyrics/tools/ibtool.rb

Class Method Summary collapse

Class Method Details

.files(folder) ⇒ Object



26
27
28
# File 'lib/applyrics/tools/ibtool.rb', line 26

def files(folder)
  return Dir.glob(File.join(folder, "**", "*.{xib,nib,storyboard}"))
end

.run(folder, output_folder = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/applyrics/tools/ibtool.rb', line 6

def run(folder, output_folder=nil)

  output_folder = folder if output_folder.nil?

  folder = File.expand_path(folder)
  output_folder = File.expand_path(output_folder)

  files = files(folder)

  files.each do |file|
    filename = File.basename(file, ".*")
    output_file = File.join(output_folder, filename) + ".strings"
    cmd = ["set -o pipefail &&"]
    cmd << Command.which("ibtool")
    cmd << "--export-strings-file " + Shellwords.escape("#{output_file}")
    cmd << Shellwords.escape("#{file}")
    puts Command.execute(cmd)
  end
end