woz 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +14 -0
- data/bin/woz +2 -2
- data/lib/woz/builder.rb +17 -11
- data/lib/woz/version.rb +1 -1
- data/spec/example_xcode_project/.wozniak +1 -1
- data/spec/example_xcode_project/Localizable.xls +0 -0
- data/spec/example_xcode_project/de.lproj/Localizable.strings +10 -1
- data/spec/example_xcode_project/en.lproj/Localizable.strings +10 -1
- data/spec/example_xcode_project/fr.lproj/Localizable.strings +10 -1
- data/spec/example_xcode_project/nl.lproj/Localizable.strings +10 -1
- metadata +8 -8
data/README.md
CHANGED
@@ -47,6 +47,20 @@ To make it even more clear, here is a simple representation of the xls file:
|
|
47
47
|
|
48
48
|
This will genereate different '.lproj' directories with the localized files inside of them.
|
49
49
|
|
50
|
+
There is also a possibility to generate strings files from a xls file located on a different location on your disk. Just pass the relative or absolute filepath to the 'woz strings' command:
|
51
|
+
|
52
|
+
woz strings a_relative_directory/the_file.xls
|
53
|
+
woz strings /an_absolute_directory/the_file.xls
|
54
|
+
woz strings ~/an_absolute_directory_inside_your_home_folder/the_file.xls
|
55
|
+
|
56
|
+
## Changelog
|
57
|
+
|
58
|
+
### 0.2.0
|
59
|
+
|
60
|
+
- Add filename/filepath behind the 'woz strings' command in order to use that xls file for strings generation.
|
61
|
+
- Better .strings content formatting.
|
62
|
+
- Better overwrite confirmation messages.
|
63
|
+
|
50
64
|
## License
|
51
65
|
|
52
66
|
Check out the LICENSE.txt file. Really awesome reading material...
|
data/bin/woz
CHANGED
@@ -10,8 +10,8 @@ class WozCommand < Thor
|
|
10
10
|
end
|
11
11
|
|
12
12
|
desc "strings", "creates the strings files from the available xls file."
|
13
|
-
def strings
|
14
|
-
Woz::Builder.generate_strings
|
13
|
+
def strings(filepath=nil)
|
14
|
+
Woz::Builder.generate_strings(filepath)
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "setup", "creates the woz configuration file."
|
data/lib/woz/builder.rb
CHANGED
@@ -26,8 +26,8 @@ module Woz
|
|
26
26
|
generate_translation_xls
|
27
27
|
end
|
28
28
|
|
29
|
-
def generate_strings
|
30
|
-
generate_translation_strings
|
29
|
+
def generate_strings(xls_filepath=nil)
|
30
|
+
generate_translation_strings(xls_filepath)
|
31
31
|
end
|
32
32
|
|
33
33
|
protected
|
@@ -111,7 +111,7 @@ TEXT
|
|
111
111
|
|
112
112
|
xls = generate_spreadsheet list
|
113
113
|
|
114
|
-
if !Woz.config.ask_confirmation || ask("!
|
114
|
+
if !Woz.config.ask_confirmation || ask("! the project's xls file will be overwritten, type 'y' and enter to continue: ") == "y"
|
115
115
|
xls.write(File.join(output_dir, Woz.config.xls_filename))
|
116
116
|
puts "# xls generated at #{File.join(output_dir, Woz.config.xls_filename)}"
|
117
117
|
else
|
@@ -140,9 +140,11 @@ TEXT
|
|
140
140
|
list
|
141
141
|
end
|
142
142
|
|
143
|
-
def generate_translation_strings
|
144
|
-
|
145
|
-
|
143
|
+
def generate_translation_strings(xls_filepath=nil)
|
144
|
+
filepath = File.expand_path(xls_filepath || Woz.config.xls_filename)
|
145
|
+
puts filepath.inspect
|
146
|
+
file = File.join(filepath)
|
147
|
+
output_dir = get_output_dir(File.join(File.expand_path(Woz.config.xls_filename)))
|
146
148
|
|
147
149
|
fail "! xls file not found, specify the filename in the .wozniak file" unless File.exists?(file)
|
148
150
|
|
@@ -158,17 +160,21 @@ TEXT
|
|
158
160
|
cocoa_languages_array << "@\"#{language}\""
|
159
161
|
|
160
162
|
new_file = !File.exists?(file_path)
|
161
|
-
if new_file || !Woz.config.ask_confirmation || ask("!
|
163
|
+
if new_file || !Woz.config.ask_confirmation || ask("! the project's #{language} strings file will be overwritten, type 'y' and enter to continue: ") == "y"
|
162
164
|
if new_file
|
163
165
|
file = File.new(file_path, "w")
|
164
166
|
else
|
165
167
|
file = File.open(file_path, "w")
|
166
168
|
end
|
167
169
|
list[language].each do |key, value|
|
168
|
-
|
169
|
-
file.puts "
|
170
|
-
|
171
|
-
|
170
|
+
unless key.nil?
|
171
|
+
file.puts "\/\* #{key} \*\/"
|
172
|
+
if value.nil?
|
173
|
+
file.puts "\"#{key}\" = \"MISSING VALUE\";"
|
174
|
+
else
|
175
|
+
file.puts "\"#{key}\" = \"#{value}\";"
|
176
|
+
end
|
177
|
+
file.puts ""
|
172
178
|
end
|
173
179
|
end
|
174
180
|
puts "# #{language} strings generated at #{file_path}"
|
data/lib/woz/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|
16
|
-
requirement: &
|
16
|
+
requirement: &70346431276860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.6.15
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70346431276860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70346431276180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.16.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70346431276180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: spreadsheet
|
38
|
-
requirement: &
|
38
|
+
requirement: &70346431275620 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 0.7.3
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70346431275620
|
47
47
|
description: Generate strings files from an xls and vice versa.
|
48
48
|
email:
|
49
49
|
- jelle@fousa.be
|