locraft 1.3.0 → 1.3.1
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/lib/locraft/config.rb +4 -0
- data/lib/locraft/constants_generator.rb +6 -3
- data/lib/locraft/google_drive_wrapper.rb +4 -4
- data/lib/locraft/initializer.rb +8 -1
- data/lib/locraft/runner.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49c54082e2fd1485e1bec98037de840be8de3eb2
|
4
|
+
data.tar.gz: 62d2f02ca95fddc96130a1b6a74d9c377c749ce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e7f7844b14497ce39f7132306a13e2248362ffea1beb8e314938524f8c3eec97f3f63947891784e6e75cfabfaa41f01f637b176412527245e7853822e48878e
|
7
|
+
data.tar.gz: 12b1a3b2c288748ef26dfe81ef94f6cf9f9177b1f1097ba6b58f9faf7e890ef88a9d8ec7807a31db4f915752f1f28dc75544fb1e4882417cd20a283dc816f4ca
|
data/lib/locraft/config.rb
CHANGED
@@ -57,14 +57,17 @@ module Locraft
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def constants_keys
|
60
|
-
@localizations.select
|
60
|
+
@localizations.select(&:valid?).map do |l|
|
61
61
|
{ key: l.key, const: constant_from(l.key) }
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def constant_from(key)
|
66
|
-
|
67
|
-
|
66
|
+
parts = key.split(/\W/).select { |p| !p.empty? }.map do |p|
|
67
|
+
p[0] = p[0].capitalize
|
68
|
+
p
|
69
|
+
end
|
70
|
+
"k#{@config.dev_prefix}#{parts.join}Localized"
|
68
71
|
end
|
69
72
|
end
|
70
73
|
end
|
@@ -14,8 +14,7 @@ module Locraft
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def authenticate
|
17
|
-
|
18
|
-
token_file = File.join(@config.relative_strings_destination, SESSION_TOKEN_FILE)
|
17
|
+
token_file = File.join(@config.from_folder, SESSION_TOKEN_FILE)
|
19
18
|
@session = GoogleDrive.saved_session(token_file)
|
20
19
|
end
|
21
20
|
|
@@ -26,11 +25,12 @@ module Locraft
|
|
26
25
|
|
27
26
|
# return worksheet
|
28
27
|
def export_worksheet
|
29
|
-
worksheets = doc_named(@config.gdoc_file)
|
28
|
+
worksheets = doc_named(@config.gdoc_file)&.worksheets
|
30
29
|
if worksheets.count > @config.gdoc_sheet
|
31
30
|
worksheets[@config.gdoc_sheet]
|
32
31
|
else
|
33
|
-
warn 'gdrive_wrapper worksheet export error:
|
32
|
+
warn 'gdrive_wrapper worksheet export error:
|
33
|
+
You have no access to google_doc or sheet number in config out of bounds!'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
data/lib/locraft/initializer.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Locraft
|
2
2
|
|
3
|
-
|
3
|
+
SAMPLE_CONFIG_DIR = 'locraft'
|
4
|
+
SAMPLE_CONFIG_FILE = 'locraft.config'
|
4
5
|
|
5
6
|
class Initializer
|
6
7
|
def self.init
|
@@ -8,8 +9,14 @@ module Locraft
|
|
8
9
|
if File.file? SAMPLE_CONFIG_FILE
|
9
10
|
warn 'ERROR: Initialization failed. There is already exists some locraft.config.'
|
10
11
|
else
|
12
|
+
Dir.mkdir(SAMPLE_CONFIG_DIR) unless Dir.exist?(SAMPLE_CONFIG_DIR)
|
11
13
|
File.write(SAMPLE_CONFIG_FILE, config)
|
12
14
|
end
|
13
15
|
end
|
16
|
+
|
17
|
+
def self.initialized_config
|
18
|
+
return SAMPLE_CONFIG_FILE if File.exist?(SAMPLE_CONFIG_FILE)
|
19
|
+
File.join(SAMPLE_CONFIG_DIR, SAMPLE_CONFIG_FILE)
|
20
|
+
end
|
14
21
|
end
|
15
22
|
end
|
data/lib/locraft/runner.rb
CHANGED
@@ -10,7 +10,7 @@ module Locraft
|
|
10
10
|
end
|
11
11
|
|
12
12
|
desc 'extract', 'extract strings from google drive and parse them into {.strings, .plist} files. Then create constants'
|
13
|
-
option :config, default:
|
13
|
+
option :config, default: Initializer.initialized_config, aliases: '-c', type: :string, desc: 'configuration file'
|
14
14
|
def extract
|
15
15
|
config_file = options[:config]
|
16
16
|
if File.file? config_file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sroik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google_drive
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.6.
|
125
|
+
rubygems_version: 2.6.10
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: locraft
|