localio 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/localio/locfile.rb +12 -2
- data/lib/localio/processor.rb +4 -4
- data/lib/localio/processors/google_drive_processor.rb +5 -1
- data/lib/localio/processors/xls_processor.rb +5 -1
- data/lib/localio/processors/xlsx_processor.rb +5 -1
- data/lib/localio/version.rb +1 -1
- data/lib/localio.rb +3 -2
- data/localio.gemspec +5 -5
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9c6a8a6a6554f0357ff10a569020a342110c9d7
|
4
|
+
data.tar.gz: e938f2f1e5d5b10bdcc932f88643560b2bef86f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 935f4099fac61d787a3f1aa04241067bc4c03647360ea100eb7cf9a8e64350e08c9cbf6b005b5f594ee9902d7374f254444022d73cf997add0a7f52c9f7b71ec
|
7
|
+
data.tar.gz: fae34afc53481e52fcaa9ebf1b3b44920c844a13346e9e889b1274706c866b6f443f7742a3bd78647f9925c24b1a4247ff11b1984f137626c9323bac22d5f721
|
data/lib/localio/locfile.rb
CHANGED
@@ -6,7 +6,7 @@ class Locfile
|
|
6
6
|
#
|
7
7
|
# possible values
|
8
8
|
# :android, :ios, :rails, :json
|
9
|
-
dsl_accessor :
|
9
|
+
dsl_accessor :platform_name, :platform_options
|
10
10
|
|
11
11
|
# Specifies the filesystem path where the generated files will be
|
12
12
|
dsl_accessor :output_path
|
@@ -29,7 +29,8 @@ class Locfile
|
|
29
29
|
dsl_accessor :source_service, :source_options
|
30
30
|
|
31
31
|
def initialize
|
32
|
-
@
|
32
|
+
@platform_name = nil
|
33
|
+
@platform_options = nil
|
33
34
|
@source_service = :google_drive
|
34
35
|
@source_path = nil
|
35
36
|
@source_options = nil
|
@@ -37,6 +38,15 @@ class Locfile
|
|
37
38
|
@formatting = :smart
|
38
39
|
end
|
39
40
|
|
41
|
+
# Defines the platform
|
42
|
+
#
|
43
|
+
# service : any of the supported ones (see above)
|
44
|
+
# options : hash with extra options, view documentation for the different services
|
45
|
+
def platform(name, options = {})
|
46
|
+
@platform_name = name
|
47
|
+
@platform_options = options
|
48
|
+
end
|
49
|
+
|
40
50
|
# Defines the service storing the translations
|
41
51
|
#
|
42
52
|
# service : can be :google_drive, :xls
|
data/lib/localio/processor.rb
CHANGED
@@ -3,14 +3,14 @@ require 'localio/processors/xls_processor'
|
|
3
3
|
require 'localio/processors/xlsx_processor'
|
4
4
|
|
5
5
|
module Processor
|
6
|
-
def self.load_localizables(service, options)
|
6
|
+
def self.load_localizables(platform_options, service, options)
|
7
7
|
case service
|
8
8
|
when :google_drive
|
9
|
-
GoogleDriveProcessor.load_localizables options
|
9
|
+
GoogleDriveProcessor.load_localizables platform_options, options
|
10
10
|
when :xls
|
11
|
-
XlsProcessor.load_localizables options
|
11
|
+
XlsProcessor.load_localizables platform_options, options
|
12
12
|
when :xlsx
|
13
|
-
XlsxProcessor.load_localizables options
|
13
|
+
XlsxProcessor.load_localizables platform_options, options
|
14
14
|
else
|
15
15
|
raise ArgumentError, 'Unsupported service! Try with :google_drive, :xlsx or :xls in the source argument'
|
16
16
|
end
|
@@ -3,7 +3,7 @@ require 'localio/term'
|
|
3
3
|
|
4
4
|
class GoogleDriveProcessor
|
5
5
|
|
6
|
-
def self.load_localizables(options)
|
6
|
+
def self.load_localizables(platform_options, options)
|
7
7
|
|
8
8
|
# Parameter validations
|
9
9
|
spreadsheet = options[:spreadsheet]
|
@@ -13,6 +13,9 @@ class GoogleDriveProcessor
|
|
13
13
|
password = options[:password]
|
14
14
|
raise ArgumentError, ':password required for Google Drive source!' if password.nil?
|
15
15
|
|
16
|
+
override_default = nil
|
17
|
+
override_default = platform_options[:override_default] unless platform_options.nil? or platform_options[:override_default].nil?
|
18
|
+
|
16
19
|
# Log in and get spreadsheet
|
17
20
|
puts 'Logging in to Google Drive...'
|
18
21
|
begin
|
@@ -68,6 +71,7 @@ class GoogleDriveProcessor
|
|
68
71
|
abort 'There are no language columns in the worksheet' if languages.count == 0
|
69
72
|
|
70
73
|
default_language = languages[0] if default_language.to_s == ''
|
74
|
+
default_language = override_default unless override_default.nil?
|
71
75
|
|
72
76
|
puts "Languages detected: #{languages.keys.join(', ')} -- using #{default_language} as default."
|
73
77
|
|
@@ -3,12 +3,15 @@ require 'localio/term'
|
|
3
3
|
|
4
4
|
class XlsProcessor
|
5
5
|
|
6
|
-
def self.load_localizables(options)
|
6
|
+
def self.load_localizables(platform_options, options)
|
7
7
|
|
8
8
|
# Parameter validations
|
9
9
|
path = options[:path]
|
10
10
|
raise ArgumentError, ':path attribute is missing from the source, and it is required for xls spreadsheets' if path.nil?
|
11
11
|
|
12
|
+
override_default = nil
|
13
|
+
override_default = platform_options[:override_default] unless platform_options.nil? or platform_options[:override_default].nil?
|
14
|
+
|
12
15
|
Spreadsheet.client_encoding = 'UTF-8'
|
13
16
|
|
14
17
|
book = Spreadsheet.open path
|
@@ -44,6 +47,7 @@ class XlsProcessor
|
|
44
47
|
raise 'There are no language columns in the worksheet' if languages.count == 0
|
45
48
|
|
46
49
|
default_language = languages[0] if default_language.to_s == ''
|
50
|
+
default_language = override_default unless override_default.nil?
|
47
51
|
|
48
52
|
puts "Languages detected: #{languages.keys.join(', ')} -- using #{default_language} as default."
|
49
53
|
|
@@ -3,12 +3,15 @@ require 'localio/term'
|
|
3
3
|
|
4
4
|
class XlsxProcessor
|
5
5
|
|
6
|
-
def self.load_localizables(options)
|
6
|
+
def self.load_localizables(platform_options, options)
|
7
7
|
|
8
8
|
# Parameter validations
|
9
9
|
path = options[:path]
|
10
10
|
raise ArgumentError, ':path attribute is missing from the source, and it is required for xlsx spreadsheets' if path.nil?
|
11
11
|
|
12
|
+
override_default = nil
|
13
|
+
override_default = platform_options[:override_default] unless platform_options.nil? or platform_options[:override_default].nil?
|
14
|
+
|
12
15
|
book = SimpleXlsxReader.open path
|
13
16
|
|
14
17
|
# TODO we could pass a :page_index in the options hash and get that worksheet instead, defaulting to zero?
|
@@ -42,6 +45,7 @@ class XlsxProcessor
|
|
42
45
|
raise 'There are no language columns in the worksheet' if languages.count == 0
|
43
46
|
|
44
47
|
default_language = languages[0] if default_language.to_s == ''
|
48
|
+
default_language = override_default unless override_default.nil?
|
45
49
|
|
46
50
|
puts "Languages detected: #{languages.keys.join(', ')} -- using #{default_language} as default."
|
47
51
|
|
data/lib/localio/version.rb
CHANGED
data/lib/localio.rb
CHANGED
@@ -37,7 +37,8 @@ module Localio
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.process_to_memory
|
40
|
-
@localizables = Processor.load_localizables @configuration.
|
40
|
+
@localizables = Processor.load_localizables @configuration.platform_options,
|
41
|
+
@configuration.source_service,
|
41
42
|
@configuration.source_options
|
42
43
|
end
|
43
44
|
|
@@ -48,7 +49,7 @@ module Localio
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def self.build_localizables
|
51
|
-
LocalizableWriter.write @configuration.
|
52
|
+
LocalizableWriter.write @configuration.platform_name,
|
52
53
|
@localizables[:languages],
|
53
54
|
@localizables[:segments],
|
54
55
|
@configuration.output_path,
|
data/localio.gemspec
CHANGED
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.3"
|
28
28
|
spec.add_development_dependency "rake"
|
29
29
|
|
30
|
-
spec.add_dependency "micro-optparse", "~> 1.1
|
31
|
-
spec.add_dependency "google_drive", "~> 0.3
|
32
|
-
spec.add_dependency "spreadsheet", "~> 0.8
|
33
|
-
spec.add_dependency "simple_xlsx_reader", "~> 0.9
|
34
|
-
spec.add_dependency "nokogiri", "~> 1.6
|
30
|
+
spec.add_dependency "micro-optparse", "~> 1.1"
|
31
|
+
spec.add_dependency "google_drive", "~> 0.3"
|
32
|
+
spec.add_dependency "spreadsheet", "~> 0.8"
|
33
|
+
spec.add_dependency "simple_xlsx_reader", "~> 0.9"
|
34
|
+
spec.add_dependency "nokogiri", "~> 1.6"
|
35
35
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nacho Lopez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -58,70 +58,70 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.1
|
61
|
+
version: '1.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.1
|
68
|
+
version: '1.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: google_drive
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3
|
75
|
+
version: '0.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.3
|
82
|
+
version: '0.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: spreadsheet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.8
|
89
|
+
version: '0.8'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.8
|
96
|
+
version: '0.8'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simple_xlsx_reader
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.9
|
103
|
+
version: '0.9'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.9
|
110
|
+
version: '0.9'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: nokogiri
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.6
|
117
|
+
version: '1.6'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.6
|
124
|
+
version: '1.6'
|
125
125
|
description: Automatic Localizable file generation for multiple platforms (Rails YAML,
|
126
126
|
Android, Java Properties, iOS, JSON)
|
127
127
|
email:
|