localio 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7545745288cd1d2a90ab07b92aabeba59481e21b
4
- data.tar.gz: fa6c825a442d45737232b8095c6d952040456c3f
3
+ metadata.gz: 3b8fc369a41d6286ac26dd25501eddb5c9fee069
4
+ data.tar.gz: 216509cdfd60919003fa6bec6452cc7172192fb9
5
5
  SHA512:
6
- metadata.gz: 36f73ead59451a89bd13b31a677fb5ff92ce410f1379f8c315abb0be6aaa1d8754b98573f27a02aba0915bfb578f580eaa95e60574789a27e36778604b247d3a
7
- data.tar.gz: bb797d0d11972c9b269443b03bfee43d683e60ffbe78abb68218f2b8c816d73c7028962cc8cbdf9d243ab3affda172c6468cbd881c5af5f004faae4ce4a51e2a
6
+ metadata.gz: d7672908c03b188d1d5921f5355e9e5ac1cc7072856b01881014cd7612325ca6932f73bde32d8a743ce40abd115d290e366d38e883d0c7ad1c520a80a015bc56
7
+ data.tar.gz: ae4355156f57f966101e18b7367659134483dfa919633c8b2ddccf1c312e2fe376071df9ae049022d41679f5d4bb1bcb45a662e60198adbfd97345382bb5b19a
data/README.md CHANGED
@@ -76,6 +76,11 @@ Option | Description
76
76
 
77
77
  #### Extra platform parameters
78
78
 
79
+
80
+ ##### `avoid_lang_downcase`
81
+
82
+ By default, language codes are downcased. We can set `:avoid_lang_downcase => true` to avoid this behavior.
83
+
79
84
  ##### iOS - :ios, :swift
80
85
 
81
86
  We can opt-out from the constants/macros. We will simple need to add `:create_constants => false`. By default, if omitted, the constants will be always created. It's a good practice to have a compile-time check of the existence of your keys; but if you don't like it it's fine.
@@ -109,6 +114,7 @@ You will have to provide some required parameters too. Here is a list of all the
109
114
  Option | Description
110
115
  ----------------------------|-------------------------------------------------------------------------
111
116
  `:spreadsheet` | (Req.) Title of the spreadsheet you want to use. Can be a partial match.
117
+ `:sheet` | (Req.) Index number (starting with 0) or name of the sheet w/ the data
112
118
  `:login` | **DEPRECATED** This is deprecated starting version 0.1.0. Please remove it.
113
119
  `:password` | **DEPRECATED** This is deprecated starting version 0.1.0. Please remove it.
114
120
  `:client_id` | (Req.) Your Google CLIENT ID.
@@ -180,7 +186,7 @@ You may specify a `sheet` parameter, otherwise the first sheet will be used.
180
186
  Option | Description
181
187
  ----------------------------|-------------------------------------------------------------------------
182
188
  `:path` | (Req.) Path for your XLSX file.
183
- `:sheet` | (Optional) Index number (starting with 0) or name of the sheet w/ the data
189
+ `:sheet` | (Req.) Index number (starting with 0) or name of the sheet w/ the data
184
190
 
185
191
  ````ruby
186
192
  source :xlsx,
@@ -5,6 +5,7 @@ require 'localio/processors/csv_processor'
5
5
 
6
6
  module Processor
7
7
  def self.load_localizables(platform_options, service, options)
8
+ puts "Service: #{service}"
8
9
  case service
9
10
  when :google_drive
10
11
  GoogleDriveProcessor.load_localizables platform_options, options
@@ -18,4 +19,4 @@ module Processor
18
19
  raise ArgumentError, 'Unsupported service! Try with :google_drive, :csv, :xlsx or :xls in the source argument'
19
20
  end
20
21
  end
21
- end
22
+ end
@@ -36,8 +36,17 @@ class CsvProcessor
36
36
  for column in 1..csv_file[first_valid_row_index].count-1
37
37
  col_all = csv_file[first_valid_row_index][column].to_s
38
38
  col_all.each_line(' ') do |col_text|
39
- default_language = col_text.downcase.gsub('*', '') if col_text.include? '*'
40
- languages.store col_text.downcase.gsub('*', ''), column unless col_text.to_s == ''
39
+ default_language = col_text.gsub('*', '') if col_text.include? '*'
40
+ lang = col_text.gsub('*', '')
41
+
42
+ unless platform_options[:avoid_lang_downcase]
43
+ default_language = default_language.downcase
44
+ lang = lang.downcase
45
+ end
46
+
47
+ unless col_text.to_s == ''
48
+ languages.store lang, column
49
+ end
41
50
  end
42
51
  end
43
52
 
@@ -78,4 +87,4 @@ class CsvProcessor
78
87
 
79
88
  end
80
89
 
81
- end
90
+ end
@@ -90,9 +90,14 @@ class GoogleDriveProcessor
90
90
  abort "More than one match found (#{matching_spreadsheets.join ', '}). You have to be more specific!"
91
91
  end
92
92
 
93
+ sheet = options[:sheet]
94
+ worksheet = if sheet.is_a? Integer
95
+ matching_spreadsheets[0].worksheets[sheet]
96
+ elsif sheet.is_a? String
97
+ matching_spreadsheets[0].worksheets.detect { |s| s.title == sheet }
98
+ end
99
+
93
100
 
94
- # TODO we could pass a :page_index in the options hash and get that worksheet instead, defaulting to zero?
95
- worksheet = matching_spreadsheets[0].worksheets[0]
96
101
  raise 'Unable to retrieve the first worksheet from the spreadsheet. Are there any pages?' if worksheet.nil?
97
102
 
98
103
  # At this point we have the worksheet, so we want to store all the key / values
@@ -114,8 +119,17 @@ class GoogleDriveProcessor
114
119
  for column in 2..worksheet.max_cols
115
120
  col_all = worksheet[first_valid_row_index, column]
116
121
  col_all.each_line(' ') do |col_text|
117
- default_language = col_text.downcase.gsub('*', '') if col_text.include? '*'
118
- languages.store col_text.downcase.gsub('*', ''), column unless col_text.to_s == ''
122
+ default_language = col_text.gsub('*', '') if col_text.include? '*'
123
+ lang = col_text.gsub('*', '')
124
+
125
+ unless platform_options[:avoid_lang_downcase]
126
+ default_language = default_language.downcase
127
+ lang = lang.downcase
128
+ end
129
+
130
+ unless col_text.to_s == ''
131
+ languages.store lang, column
132
+ end
119
133
  end
120
134
  end
121
135
 
@@ -40,8 +40,17 @@ class XlsProcessor
40
40
  for column in 1..worksheet.column_count
41
41
  col_all = worksheet[first_valid_row_index, column].to_s
42
42
  col_all.each_line(' ') do |col_text|
43
- default_language = col_text.downcase.gsub('*','') if col_text.include? '*'
44
- languages.store col_text.downcase.gsub('*',''), column unless col_text.to_s == ''
43
+ default_language = col_text.gsub('*', '') if col_text.include? '*'
44
+ lang = col_text.gsub('*', '')
45
+
46
+ unless platform_options[:avoid_lang_downcase]
47
+ default_language = default_language.downcase
48
+ lang = lang.downcase
49
+ end
50
+
51
+ unless col_text.to_s == ''
52
+ languages.store lang, column
53
+ end
45
54
  end
46
55
  end
47
56
 
@@ -82,4 +91,4 @@ class XlsProcessor
82
91
 
83
92
  end
84
93
 
85
- end
94
+ end
@@ -43,8 +43,17 @@ class XlsxProcessor
43
43
  for column in 1..worksheet.rows[first_valid_row_index].count-1
44
44
  col_all = worksheet.rows[first_valid_row_index][column].to_s
45
45
  col_all.each_line(' ') do |col_text|
46
- default_language = col_text.downcase.gsub('*','') if col_text.include? '*'
47
- languages.store col_text.downcase.gsub('*',''), column unless col_text.to_s == ''
46
+ default_language = col_text.gsub('*', '') if col_text.include? '*'
47
+ lang = col_text.gsub('*', '')
48
+
49
+ unless platform_options[:avoid_lang_downcase]
50
+ default_language = default_language.downcase
51
+ lang = lang.downcase
52
+ end
53
+
54
+ unless col_text.to_s == ''
55
+ languages.store lang, column
56
+ end
48
57
  end
49
58
  end
50
59
 
@@ -85,4 +94,4 @@ class XlsxProcessor
85
94
 
86
95
  end
87
96
 
88
- end
97
+ end
@@ -1,3 +1,3 @@
1
1
  module Localio
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  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.1.6
4
+ version: 0.1.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: 2016-12-17 00:00:00.000000000 Z
11
+ date: 2019-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  requirements: []
194
194
  rubyforge_project:
195
- rubygems_version: 2.4.7
195
+ rubygems_version: 2.4.8
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Automatic Localizable file generation for multiple type of files, like Android