ftotr 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ftotr.rb +10 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f38d6a12cf83319005a2afda061d43e84e7e986
4
- data.tar.gz: 9f89f0ccf44fcfd55dc64be2193d3b7290bc8464
3
+ metadata.gz: fd6c6cf667a6ec8ec9bec4f8560810832c5143c6
4
+ data.tar.gz: f29d4dd31bf61e66f1b88a9000c1a49034563a03
5
5
  SHA512:
6
- metadata.gz: 5be06971844a3c17a863b657c6644e5e405036afe856ba6196fc2bc842069ed0652a6dc5059cf6c3faf19297f3bef21170194ef2a59d80bc3a3d34537a19b3bc
7
- data.tar.gz: c741bc5341b74785e00089b92d5c8b2c1d24b872b45be8af0b4379be48b30e28769fb236ecdbd7be34aea6d44c92ef1f810852ffc24b9b0810c798c00bf77fdb
6
+ metadata.gz: 731210aefc1fc673bd369154298a68d90b5815d8b0eedc77c622fc0c0ac35e3a49c013bf4a54328a72f00f0f40507ad9cb93296ec7e6ee45aaf2cd4f88bc4223
7
+ data.tar.gz: 9118cff9698d350b07b6d282c0182f940837d302044e4d6286e8319081362f5dba7f9709490a58cb41ad7e91bf475cdcdaa2d5b7af9669e8cc1b59b46169a778
data/lib/ftotr.rb CHANGED
@@ -11,16 +11,19 @@ class Ftotr
11
11
 
12
12
  # Search for .strings files
13
13
  strings_file_paths = []
14
+ xcodeproj_file_paths = []
14
15
  Find.find(Pathname.pwd) do |path|
15
16
  strings_file_paths << path if path =~ /.*\.strings$/
16
17
  strings_file_paths = strings_file_paths.select{ |i| i[/^((?!Pods).)*$/] }
18
+ xcodeproj_file_paths << path if path =~ /.*\.xcodeproj$/
19
+ xcodeproj_file_paths = xcodeproj_file_paths.select{ |i| i[/^((?!Pods).)*$/] }
17
20
  end
18
21
 
19
22
  # Write found '\\TOTR' to corresponding files
20
23
  for strings_file_path in strings_file_paths do
21
24
  file_created = false
22
25
  file_path = ''
23
- File.open(strings_file_path).each_line do |line|
26
+ File.open(strings_file_path).each_line.with_index do |line, i|
24
27
  if !line.valid_encoding?
25
28
  line = line.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
26
29
  end
@@ -28,9 +31,12 @@ class Ftotr
28
31
  if !file_created
29
32
  output = strings_file_path + " :("
30
33
  puts output.red
31
- language_file_path = URI(strings_file_path).path.split('/').last(2)[0].sub('.lproj', '')
32
- language_file_path = language_file_path + "_" + URI(strings_file_path).path.split('/').last(2)[1].sub('.strings', '')
33
- file_path = base_output_file_path + language_file_path + ".txt"
34
+ language_name = URI(strings_file_path).path.split('/').last(2)[0].sub('.lproj', '')
35
+ project_file_name = URI(xcodeproj_file_paths.last).path.split('/').last.sub('.xcodeproj', '')
36
+ file_name = URI(strings_file_path).path.split('/').last.sub('.strings', '')
37
+ output_file_name = language_name + "_" + project_file_name + "_" + file_name
38
+ output_file_name = output_file_name.downcase
39
+ file_path = base_output_file_path + output_file_name + ".txt"
34
40
  File.delete(file_path) if File.exist?(file_path)
35
41
  file_created = true
36
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ftotr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksander Grzyb