ftotr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/ftotr +4 -0
- data/lib/ftotr.rb +48 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7f38d6a12cf83319005a2afda061d43e84e7e986
|
4
|
+
data.tar.gz: 9f89f0ccf44fcfd55dc64be2193d3b7290bc8464
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5be06971844a3c17a863b657c6644e5e405036afe856ba6196fc2bc842069ed0652a6dc5059cf6c3faf19297f3bef21170194ef2a59d80bc3a3d34537a19b3bc
|
7
|
+
data.tar.gz: c741bc5341b74785e00089b92d5c8b2c1d24b872b45be8af0b4379be48b30e28769fb236ecdbd7be34aea6d44c92ef1f810852ffc24b9b0810c798c00bf77fdb
|
data/bin/ftotr
ADDED
data/lib/ftotr.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'find'
|
2
|
+
require 'pathname'
|
3
|
+
require 'uri'
|
4
|
+
require 'colorize'
|
5
|
+
|
6
|
+
class Ftotr
|
7
|
+
def self.start
|
8
|
+
|
9
|
+
# Output files path
|
10
|
+
base_output_file_path = File.expand_path('~') + '/Desktop/'
|
11
|
+
|
12
|
+
# Search for .strings files
|
13
|
+
strings_file_paths = []
|
14
|
+
Find.find(Pathname.pwd) do |path|
|
15
|
+
strings_file_paths << path if path =~ /.*\.strings$/
|
16
|
+
strings_file_paths = strings_file_paths.select{ |i| i[/^((?!Pods).)*$/] }
|
17
|
+
end
|
18
|
+
|
19
|
+
# Write found '\\TOTR' to corresponding files
|
20
|
+
for strings_file_path in strings_file_paths do
|
21
|
+
file_created = false
|
22
|
+
file_path = ''
|
23
|
+
File.open(strings_file_path).each_line do |line|
|
24
|
+
if !line.valid_encoding?
|
25
|
+
line = line.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
|
26
|
+
end
|
27
|
+
if line.match('\/\/\s*TOTR')
|
28
|
+
if !file_created
|
29
|
+
output = strings_file_path + " :("
|
30
|
+
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
|
+
File.delete(file_path) if File.exist?(file_path)
|
35
|
+
file_created = true
|
36
|
+
end
|
37
|
+
file = File.open(file_path, 'a+')
|
38
|
+
file.puts(line)
|
39
|
+
file.close
|
40
|
+
end
|
41
|
+
end
|
42
|
+
if !file_created
|
43
|
+
output = strings_file_path + " :)"
|
44
|
+
puts output.green
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ftotr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aleksander Grzyb
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
55
|
+
description: Tool finds occurances of TOTR comments in .strings files. Next it saves
|
56
|
+
the lines with TOTR comments to .txt files that you can send directly to translators.
|
57
|
+
email:
|
58
|
+
- aleksander.grzyb@allegrogroup.com
|
59
|
+
executables:
|
60
|
+
- ftotr
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- bin/ftotr
|
65
|
+
- lib/ftotr.rb
|
66
|
+
homepage:
|
67
|
+
licenses: []
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.4.5.1
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Finds lines with TOTR comments in .strings files and saves them to disc.
|
89
|
+
test_files: []
|