ftotr 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ftotr.rb +44 -44
  3. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfb3b3bb8b565cacdfcb662a592411d8ff85ce64
4
- data.tar.gz: 346d701e9daca8583c1e5e49697a6f4e7aa91e0f
3
+ metadata.gz: 1286a6e80313faae76b147fe681c1e0062ef3b02
4
+ data.tar.gz: 4adb17654ce47dad1f9495d9f487b1ff16db46c8
5
5
  SHA512:
6
- metadata.gz: b17493550a1d4bc3b813947e4ca9b383249c69503a2edc490d3b7737d540e7eeecec728e404aa6d69193f05666a6ef72327ae8aea01fde8bcba9ec224d9e071b
7
- data.tar.gz: 3ea0c40c5bcdf8ca29ef412a9dc3848473678d64d78fd614154d791c9d807a7b733d3edf359b0668f39137498acf1e6a4e607c7e984c639f7f2fafc99f1be2e4
6
+ metadata.gz: 5d1e60409f10c7bbe275b01372201693df29ab9d98a7aa72598e5a42f71d02b29ab72b3ab28d8c171f8979c530a4f0a270eed9a2f8e6aba6dfa5a3714c9a8333
7
+ data.tar.gz: 842c0f8389aa646fd102360a85390ac6c596933bfb4e8b0bbbda5c4475558e203d674534d80d7c8aee4c7a67262d515af34c2c2f242df0afd7c38932edb9445c
data/lib/ftotr.rb CHANGED
@@ -4,51 +4,51 @@ require 'uri'
4
4
  require 'colorize'
5
5
 
6
6
  class Ftotr
7
- def self.start
7
+ def self.start
8
8
 
9
- # Output files path
10
- base_output_file_path = File.expand_path('~') + '/Desktop/'
9
+ # Output files path
10
+ base_output_file_path = File.expand_path('~') + '/Desktop/'
11
11
 
12
- # Search for .strings files
13
- strings_file_paths = []
14
- xcodeproj_file_paths = []
15
- Find.find(Pathname.pwd) do |path|
16
- strings_file_paths << path if path =~ /.*\.strings$/
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).)*$/] }
20
- end
12
+ # Search for .strings files
13
+ strings_file_paths = []
14
+ xcodeproj_file_paths = []
15
+ Find.find(Pathname.pwd.to_path) do |path|
16
+ strings_file_paths << path if path.match(/.*\.strings$/)
17
+ strings_file_paths = strings_file_paths.select{ |i| i[/^((?!Pods).)*$/] }
18
+ xcodeproj_file_paths << path if path.match(/.*\.xcodeproj$/)
19
+ xcodeproj_file_paths = xcodeproj_file_paths.select{ |i| i[/^((?!Pods).)*$/] }
20
+ end
21
21
 
22
- # Write found '\\TOTR' to corresponding files
23
- for strings_file_path in strings_file_paths do
24
- file_created = false
25
- file_path = ''
26
- File.open(strings_file_path).each_line.with_index do |line, i|
27
- if !line.valid_encoding?
28
- line = line.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
29
- end
30
- if line.match('\/\/\s*TOTR')
31
- if !file_created
32
- output = strings_file_path + " :("
33
- puts output.red
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"
40
- File.delete(file_path) if File.exist?(file_path)
41
- file_created = true
42
- end
43
- file = File.open(file_path, 'a+')
44
- file.puts(line)
45
- file.close
46
- end
47
- end
48
- if !file_created
49
- output = strings_file_path + " :)"
50
- puts output.green
51
- end
52
- end
53
- end
22
+ # Write found '\\TOTR' to corresponding files
23
+ for strings_file_path in strings_file_paths do
24
+ file_created = false
25
+ file_path = ''
26
+ File.open(strings_file_path).each_line.with_index do |line, i|
27
+ if !line.valid_encoding?
28
+ line = line.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
29
+ end
30
+ if line.match('\/\/\s*TOTR')
31
+ if !file_created
32
+ output = strings_file_path + " :("
33
+ puts output.red
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"
40
+ File.delete(file_path) if File.exist?(file_path)
41
+ file_created = true
42
+ end
43
+ file = File.open(file_path, 'a+')
44
+ file.puts(line)
45
+ file.close
46
+ end
47
+ end
48
+ if !file_created
49
+ output = strings_file_path + " :)"
50
+ puts output.green
51
+ end
52
+ end
53
+ end
54
54
  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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksander Grzyb
@@ -14,42 +14,42 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.10'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.7'
55
55
  description: Tool finds occurances of TOTR comments in .strings files. Next it saves
@@ -72,17 +72,17 @@ require_paths:
72
72
  - lib
73
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ">="
75
+ - - '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: 2.0.0
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.4.5.1
85
+ rubygems_version: 2.4.8
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Finds lines with TOTR comments in .strings files and saves them to disc.