rubustrings 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/bin/rubustrings +9 -1
- data/lib/rubustrings.rb +2 -2
- data/lib/rubustrings/action.rb +9 -5
- metadata +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb3d94e4845f1d5509cf02a6ab3b191584e966a2
|
4
|
+
data.tar.gz: eeafa1bb54ec215cd54764739d1b3580b5cf3916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3b72c11ab2f12a26ef4fbb97051127cfecfa6f6ab63e53715c88714cc88923c04e29fc19715091e5d0fa65ced2810a4dd6e617da79db542e041379d5d416dd3
|
7
|
+
data.tar.gz: 10c77623de0a2413a875024321069f8a2dbb9db359524a64d9ba0bf217cbaa362f9114a3db1e3849b1755218f96168c8244df61c99dbbd0dd382944ee006b1ac
|
data/bin/rubustrings
CHANGED
data/lib/rubustrings.rb
CHANGED
@@ -4,8 +4,8 @@ require 'rubustrings/action'
|
|
4
4
|
# The main Rubustrings driver
|
5
5
|
module Rubustrings
|
6
6
|
class << self
|
7
|
-
def validate(filenames)
|
8
|
-
Action.new.validate(filenames)
|
7
|
+
def validate(filenames, only_format = false)
|
8
|
+
Action.new.validate(filenames, only_format)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/rubustrings/action.rb
CHANGED
@@ -4,16 +4,18 @@ require 'colored'
|
|
4
4
|
module Rubustrings
|
5
5
|
class Action
|
6
6
|
|
7
|
-
def validate(filenames)
|
7
|
+
def validate(filenames, only_format)
|
8
8
|
abort 'No strings file provided' unless filenames
|
9
9
|
filenames.each do |file_name|
|
10
10
|
log_output(:info, '', 0, "Processing file: \"#{file_name}\"\n")
|
11
|
-
result = validate_localizable_string_file file_name
|
11
|
+
result = validate_localizable_string_file file_name, only_format
|
12
12
|
|
13
13
|
if result
|
14
14
|
log_output(:result_success, file_name, 0, 'Strings file validated succesfully')
|
15
|
+
return true
|
15
16
|
else
|
16
17
|
log_output(:result_error, file_name, 0, 'Some errors detected')
|
18
|
+
return false
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -35,7 +37,7 @@ module Rubustrings
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
def validate_localizable_string_file(file_name)
|
40
|
+
def validate_localizable_string_file(file_name, only_format)
|
39
41
|
file_data = open_and_read_file file_name
|
40
42
|
cleaned_strings = remove_comments_and_empty_lines file_data
|
41
43
|
|
@@ -43,7 +45,7 @@ module Rubustrings
|
|
43
45
|
|
44
46
|
validation_result = true
|
45
47
|
cleaned_strings.each_line do |line|
|
46
|
-
validation_result &= validate_translation_line file_name, line
|
48
|
+
validation_result &= validate_translation_line file_name, line, only_format
|
47
49
|
end
|
48
50
|
validation_result
|
49
51
|
end
|
@@ -139,7 +141,7 @@ module Rubustrings
|
|
139
141
|
translation_value.length / translation_key.length < 3
|
140
142
|
end
|
141
143
|
|
142
|
-
def validate_translation_line(file_name, line)
|
144
|
+
def validate_translation_line(file_name, line, only_format)
|
143
145
|
line_number = 0
|
144
146
|
|
145
147
|
empty_regex = /^\d+\s*\n?$/
|
@@ -155,6 +157,8 @@ module Rubustrings
|
|
155
157
|
match = validate_format line
|
156
158
|
return log_output(:error, file_name, line_number, "invalid format: #{line}") unless match
|
157
159
|
|
160
|
+
return true if only_format
|
161
|
+
|
158
162
|
match_key = match[1]
|
159
163
|
match_value = match[2]
|
160
164
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubustrings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cordero
|
@@ -46,4 +46,3 @@ signing_key:
|
|
46
46
|
specification_version: 4
|
47
47
|
summary: Check Localizable.strings files of iOS Apps
|
48
48
|
test_files: []
|
49
|
-
has_rdoc:
|