ibtoolTranslation 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90a99821ce95e383eef6c7ca8b68c3a7bf059b22
4
- data.tar.gz: a5a7293f843bd517113abc6e8bddb5469da483ab
3
+ metadata.gz: 6475c074c23eac2930e496e93eccba7c287b3380
4
+ data.tar.gz: d60a59caa547badc11d302e5e2761b42867e937f
5
5
  SHA512:
6
- metadata.gz: 700ca1e067c43fac5a6c72267e47a0ea9bab3d9bb0be0dc13fa60b5815c847f68c379baed754a27f7e1e83cc5b9370bb2a6048b1db96bb742b985fd70f45a8d0
7
- data.tar.gz: 4daf6e37e87a0747929a95cd107374a7d07fcd9670d904d116aae53f4197525810e3284ea3e888727294de0073458c65116f8af96588c72874b533fc7b69ef6e
6
+ metadata.gz: 0302cc571766a183df4d40a384be41d56d6781574f536c963057c1f77b9dcfbc06160994106eeffc066a53b1ffaab413d5b06fc7cd550df991f86ea533dbb274
7
+ data.tar.gz: 913122f358256dd9fccd51cc8dc8de7289d37ec8e63738e1184faabd46ceaa09d5db1a0ec24e6a73b0f602033ce166dd3ed4c4e8954b8daf55b060716781276a
@@ -7,25 +7,22 @@ require "thor"
7
7
  module IbtoolTranslation
8
8
  #= IbtoolTranslation CLI
9
9
  class CLI < Thor
10
- class_option :help, :type => :boolean, :aliases => '-h', :desc => 'help message.'
11
- class_option :version, :type => :boolean, :desc => 'version'
12
- default_task :execute
10
+ default_task :update
13
11
 
14
- option :dir, :type => :string, :aliases => '-d'
15
- option :from, :type => :string , :aliases => '-f'
16
- option :to, :type => :array, :aliases => '-t'
17
- desc "execute", "show dialog with title, message"
18
- def execute
19
- if options[:version]
20
- self.version
21
- else
22
- IbtoolTranslation::Core.new.func(options[:dir], options[:from], options[:to])
23
- end
12
+ option :dir, :type => :string, :aliases => '-d',:required => true, :desc => 'directory of the reference'
13
+ option :from, :type => :string , :aliases => '-f',:required => true, :desc => 'storyboard of the reference'
14
+ option :to, :type => :array, :aliases => '-t',:required => true, :desc => 'storyboards of the result'
15
+ desc "update", "update storyboard"
16
+ def update
17
+ IbtoolTranslation::Core.new.update(options[:dir], options[:from], options[:to])
24
18
  end
25
19
 
26
- desc "version", "version"
27
- def version
28
- p IbtoolTranslation::VERSION
20
+ option :dir, :type => :string, :aliases => '-d',:required => true, :desc => 'directory of the reference'
21
+ option :from, :type => :string , :aliases => '-f',:required => true, :desc => 'storyboard of the reference'
22
+ option :to, :type => :array, :aliases => '-t',:required => true, :desc => 'storyboards of the result'
23
+ desc "update", "create Translation.strings"
24
+ def create
25
+ IbtoolTranslation::Core.new.update(options[:dir], options[:from], options[:to])
29
26
  end
30
27
  end
31
28
  end
@@ -1,3 +1,3 @@
1
1
  module IbtoolTranslation
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -4,14 +4,12 @@ require 'fileutils'
4
4
 
5
5
  module IbtoolTranslation
6
6
  class Core
7
- def self.hi
8
- puts "Hello world!"
9
- end
10
-
11
- def function()
12
- dirName = ARGV[0]
13
- sourceDir = dirName + ARGV[1] + ".lproj"
14
- lps = ARGV[2..-1]
7
+ def create(dirName, sourceDir, lps)
8
+ self.func(dirName, dirName + sourceDir + ".lproj", lps)
9
+ end
10
+ def update(dirName, sourceDir, lps)
11
+ self.func(dirName, dirName + sourceDir + ".lproj", lps)
12
+ self.func2(dirName, dirName + sourceDir + ".lproj", lps)
15
13
  end
16
14
  def func(dirName, sourceDir, lps)
17
15
  storyboards = self.storyboards sourceDir
@@ -27,11 +25,21 @@ module IbtoolTranslation
27
25
  addtionData = self.addtionData("#{lproj}/#{fileName}.strings")
28
26
  aData = addtionData.select{|f| baseData.include?(f) == false}
29
27
  transText = transText + aData.map{|f| "\"#{f}\";\n"}.join("")
28
+ File::delete("#{lproj}/#{fileName}.strings")
30
29
  }
31
- self.writeTransText("#{lproj}/Translation.strings", transText)
30
+ self.writeTransText("#{lproj}/Translation.strings", transText)
31
+ }
32
+ end
33
+ def func2(dirName, sourceDir, lps)
34
+ storyboards = self.storyboards sourceDir
35
+
36
+ lps.each {|lp|
37
+ lproj = dirName + lp + ".lproj"
38
+ transText = self.transText("#{lproj}/Translation.strings")
32
39
  storyboards.each { |fileName|
33
40
  self.fun2(lproj, fileName, transText)
34
41
  `ibtool --write #{lproj}/#{fileName}.storyboard -d #{lproj}/#{fileName}.strings #{sourceDir}/#{fileName}.storyboard`
42
+ File::delete("#{lproj}/#{fileName}.strings")
35
43
  puts fileName
36
44
  }
37
45
  }
@@ -19,7 +19,7 @@ describe IbtoolTranslation::Core, "load" do
19
19
  before do
20
20
  @i = IbtoolTranslation::Core.new
21
21
  @i.deleteDir "./storyboards/ja.lproj/"
22
- @i.func("./storyboards/", "./storyboards/en.lproj/", ["ja"])
22
+ @i.update("./storyboards/", "en", ["ja"])
23
23
  end
24
24
  it "ja transText is " do
25
25
  IbtoolTranslation::Core.new.transText("./storyboards/ja.lproj/Translation.strings").should == baseDataText
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibtoolTranslation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - akuraru
@@ -78,7 +78,6 @@ files:
78
78
  - storyboards/fr.lproj/Main.strings
79
79
  - storyboards/fr.lproj/Translation.strings
80
80
  - storyboards/ja.lproj/Main.storyboard
81
- - storyboards/ja.lproj/Main.strings
82
81
  - storyboards/ja.lproj/Translation.strings
83
82
  homepage: ''
84
83
  licenses:
Binary file