woz 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
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("! this xls file will be overwrite type 'y' to confirm: ") == "y"
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
- file = File.join(Dir.pwd, Woz.config.xls_filename)
145
- output_dir = get_output_dir(file)
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("! this #{language} strings file will be overwrite type 'y' to confirm: ") == "y"
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
- if value.nil?
169
- file.puts "\"#{key}\" = \"MISSING VALUE\";" unless key.nil?
170
- else
171
- file.puts "\"#{key}\" = \"#{value}\";"
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
@@ -1,3 +1,3 @@
1
1
  module Woz
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -5,7 +5,7 @@
5
5
  Woz.configure do |config|
6
6
  config.xls_filename = "Localizable.xls"
7
7
  config.strings_filename = "Localizable.strings"
8
- config.ask_confirmation = false
8
+ config.ask_confirmation = true
9
9
  end
10
10
  #
11
11
  # You can now run `woz xls` to create a translation
@@ -1,3 +1,12 @@
1
+ /* name */
2
+ "name" = "MISSING VALUE";
3
+
4
+ /* beer */
1
5
  "beer" = "biere";
6
+
7
+ /* title */
2
8
  "title" = "MISSING VALUE";
3
- "name" = "MISSING VALUE";
9
+
10
+ /* fun */
11
+ "fun" = "Spaß";
12
+
@@ -1,3 +1,12 @@
1
+ /* name */
2
+ "name" = "name";
3
+
4
+ /* beer */
1
5
  "beer" = "MISSING VALUE";
6
+
7
+ /* title */
2
8
  "title" = "title";
3
- "name" = "name";
9
+
10
+ /* fun */
11
+ "fun" = "pleasure";
12
+
@@ -1,3 +1,12 @@
1
+ /* name */
2
+ "name" = "nom";
3
+
4
+ /* beer */
1
5
  "beer" = "bière";
6
+
7
+ /* title */
2
8
  "title" = "titre";
3
- "name" = "nom";
9
+
10
+ /* fun */
11
+ "fun" = "plaisire";
12
+
@@ -1,3 +1,12 @@
1
+ /* name */
2
+ "name" = "naam";
3
+
4
+ /* beer */
1
5
  "beer" = "bier";
6
+
7
+ /* title */
2
8
  "title" = "titel";
3
- "name" = "naam";
9
+
10
+ /* fun */
11
+ "fun" = "plezier";
12
+
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.1.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-01-31 00:00:00.000000000 Z
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: &70249543876360 !ruby/object:Gem::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: *70249543876360
24
+ version_requirements: *70346431276860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70249543875740 !ruby/object:Gem::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: *70249543875740
35
+ version_requirements: *70346431276180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: spreadsheet
38
- requirement: &70249543875160 !ruby/object:Gem::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: *70249543875160
46
+ version_requirements: *70346431275620
47
47
  description: Generate strings files from an xls and vice versa.
48
48
  email:
49
49
  - jelle@fousa.be