localio 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/README.md +2 -0
- data/lib/localio/processor.rb +2 -3
- data/lib/localio/processors/xlsx_processor.rb +11 -11
- data/lib/localio/version.rb +1 -1
- data/localio.gemspec +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61f4ea2bba9a06ef18ee6e890b1c16b26963cd52
|
4
|
+
data.tar.gz: a2ad832421307568af82725ffa7212343d92bd23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e0a0198dee04dd09566dab033f9f27d2a9feb10c49a12bee13c501b38646ead4ae298d3c56825323fec81e9383ebd4fe700fbc545f8f4e0f9747513f0ebd23
|
7
|
+
data.tar.gz: dd82c6e5f5df3d221f0e57827dc62b118462b08b805be7c3c07f668e2feb5a7c78d193c0bab0459e18ff110986e0d3ccd9e48ff8943513319ee9f5b51b7b8f7e
|
data/.DS_Store
ADDED
Binary file
|
data/README.md
CHANGED
@@ -65,6 +65,8 @@ Option | Description
|
|
65
65
|
`source` | (Req.) Information on where to find the spreadsheet w/ the info | `nil`
|
66
66
|
`output_path` | (Req.) Target directory for the localizables. | `out/`
|
67
67
|
`formatting` | The formatter that will be used for key processing. | `smart`
|
68
|
+
`except` | Filter applied to the keys, process all except the matches. | `nil`
|
69
|
+
`only` | Filter applied to the keys, only process the matches. | `nil`
|
68
70
|
|
69
71
|
#### Supported platforms
|
70
72
|
|
data/lib/localio/processor.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'localio/processors/google_drive_processor'
|
2
2
|
require 'localio/processors/xls_processor'
|
3
|
-
|
3
|
+
require 'localio/processors/xlsx_processor'
|
4
4
|
|
5
5
|
module Processor
|
6
6
|
def self.load_localizables(service, options)
|
@@ -10,8 +10,7 @@ module Processor
|
|
10
10
|
when :xls
|
11
11
|
XlsProcessor.load_localizables options
|
12
12
|
when :xlsx
|
13
|
-
|
14
|
-
# XlsxProcessor.load_localizables options
|
13
|
+
XlsxProcessor.load_localizables options
|
15
14
|
else
|
16
15
|
raise ArgumentError, 'Unsupported service! Try with :google_drive, :xlsx or :xls in the source argument'
|
17
16
|
end
|
@@ -18,27 +18,27 @@ class XlsxProcessor
|
|
18
18
|
# At this point we have the worksheet, so we want to store all the key / values
|
19
19
|
first_valid_row_index = nil
|
20
20
|
last_valid_row_index = nil
|
21
|
-
|
22
|
-
for row in
|
23
|
-
first_valid_row_index = row if worksheet[row
|
24
|
-
last_valid_row_index = row if worksheet[row
|
21
|
+
|
22
|
+
for row in 1..worksheet.rows.count-1
|
23
|
+
first_valid_row_index = row if worksheet.rows[row][0].to_s.downcase == '[key]'
|
24
|
+
last_valid_row_index = row if worksheet.rows[row][0].to_s.downcase == '[end]'
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
raise IndexError, 'Invalid format: Could not find any [key] keyword in the A column of the worksheet' if first_valid_row_index.nil?
|
28
28
|
raise IndexError, 'Invalid format: Could not find any [end] keyword in the A column of the worksheet' if last_valid_row_index.nil?
|
29
29
|
raise IndexError, 'Invalid format: [end] must not be before [key] in the A column' if first_valid_row_index > last_valid_row_index
|
30
30
|
|
31
31
|
languages = Hash.new('languages')
|
32
32
|
default_language = nil
|
33
|
-
|
34
|
-
for column in 1..worksheet.
|
35
|
-
col_all = worksheet[first_valid_row_index
|
33
|
+
|
34
|
+
for column in 1..worksheet.rows[first_valid_row_index].count-1
|
35
|
+
col_all = worksheet.rows[first_valid_row_index][column].to_s
|
36
36
|
col_all.each_line(' ') do |col_text|
|
37
37
|
default_language = col_text.downcase.gsub('*','') if col_text.include? '*'
|
38
38
|
languages.store col_text.downcase.gsub('*',''), column unless col_text.to_s == ''
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
raise 'There are no language columns in the worksheet' if languages.count == 0
|
43
43
|
|
44
44
|
default_language = languages[0] if default_language.to_s == ''
|
@@ -52,11 +52,11 @@ class XlsxProcessor
|
|
52
52
|
last_term_row = last_valid_row_index-1
|
53
53
|
|
54
54
|
for row in first_term_row..last_term_row
|
55
|
-
key = worksheet[row
|
55
|
+
key = worksheet.rows[row][0]
|
56
56
|
unless key.to_s == ''
|
57
57
|
term = Term.new(key)
|
58
58
|
languages.each do |lang, column_index|
|
59
|
-
term_text = worksheet[row
|
59
|
+
term_text = worksheet.rows[row][column_index]
|
60
60
|
term.values.store lang, term_text
|
61
61
|
end
|
62
62
|
terms << term
|
data/lib/localio/version.rb
CHANGED
data/localio.gemspec
CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "micro-optparse", "~> 1.1.5"
|
31
31
|
spec.add_dependency "google_drive", "~> 0.3.6"
|
32
32
|
spec.add_dependency "spreadsheet", "~> 0.8.9"
|
33
|
-
|
33
|
+
spec.add_dependency "simple_xlsx_reader", "~> 0.9.8"
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nacho Lopez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.8.9
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simple_xlsx_reader
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.9.8
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.9.8
|
97
111
|
description: Automatic Localizable file generation for multiple platforms (Rails,
|
98
112
|
Android, iOS, JSON)
|
99
113
|
email:
|
@@ -103,6 +117,7 @@ executables:
|
|
103
117
|
extensions: []
|
104
118
|
extra_rdoc_files: []
|
105
119
|
files:
|
120
|
+
- .DS_Store
|
106
121
|
- .gitignore
|
107
122
|
- CONTRIBUTING.md
|
108
123
|
- Gemfile
|
@@ -156,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
171
|
version: '0'
|
157
172
|
requirements: []
|
158
173
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
174
|
+
rubygems_version: 2.1.10
|
160
175
|
signing_key:
|
161
176
|
specification_version: 4
|
162
177
|
summary: Automatic Localizable file generation for multiple type of files, like Android
|