txgh 6.2.1 → 6.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/txgh/config/tx_config.rb +23 -19
- data/lib/txgh/resource_deleter.rb +1 -1
- data/lib/txgh/tx_resource.rb +1 -12
- data/lib/txgh/version.rb +1 -1
- data/spec/merge_calculator_spec.rb +1 -1
- data/spec/resource_contents_spec.rb +1 -1
- data/spec/resource_downloader_spec.rb +1 -1
- data/spec/resource_updater_spec.rb +1 -1
- data/spec/tx_branch_resource_spec.rb +1 -1
- data/spec/tx_resource_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1053ba18e7cb566323eac1abe07004895dc151c2
|
4
|
+
data.tar.gz: 50059beacd2a364ee3913309497d11d1fd028d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22619cc53d74193888d7d57f1727e1525dc868d863f38834f6ec6ca8684cd293aaa48033a09ffb05c7676d2093606c5990bbaa7647bc35441a18147c61717ef
|
7
|
+
data.tar.gz: ce6aed9c3b358dc67c912052ae7195e364aacb4c3afdde73eddc6d2bfedbc470f2a6859d8d27fb1608cc28592338f3881f63ca18edb216edb5d9f684c323bebc
|
@@ -4,35 +4,39 @@ module Txgh
|
|
4
4
|
class << self
|
5
5
|
def load_file(path)
|
6
6
|
config = Txgh::ParseConfig.load_file(path)
|
7
|
-
|
7
|
+
load_config(config)
|
8
8
|
end
|
9
9
|
|
10
10
|
def load(contents)
|
11
11
|
config = Txgh::ParseConfig.load(contents)
|
12
|
-
|
12
|
+
load_config(config)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
if group == 'main'
|
23
|
-
main = config[group]
|
17
|
+
def load_config(config)
|
18
|
+
lang_map = load_lang_map(config)
|
19
|
+
resources = load_resources(config, lang_map)
|
20
|
+
new(resources, lang_map)
|
21
|
+
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
resources.push(
|
30
|
-
parse_resource(group, config[group])
|
31
|
-
)
|
23
|
+
def load_lang_map(config)
|
24
|
+
lang_map = if main = config['main']
|
25
|
+
if map = main['lang_map']
|
26
|
+
parse_lang_map(map)
|
32
27
|
end
|
33
28
|
end
|
34
29
|
|
35
|
-
|
30
|
+
lang_map || {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def load_resources(config, lang_map)
|
34
|
+
[].tap do |resources|
|
35
|
+
config.groups.each do |group|
|
36
|
+
next if group == 'main'
|
37
|
+
resources << load_resource(group, config[group], lang_map)
|
38
|
+
end
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
def parse_lang_map(lang_map)
|
@@ -42,12 +46,12 @@ module Txgh
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
|
-
def
|
49
|
+
def load_resource(name, resource, lang_map)
|
46
50
|
id = name.split('.', 2)
|
47
51
|
TxResource.new(
|
48
52
|
id[0].strip, id[1].strip, resource['type'],
|
49
53
|
resource['source_lang'], resource['source_file'],
|
50
|
-
|
54
|
+
lang_map, resource['file_filter']
|
51
55
|
)
|
52
56
|
end
|
53
57
|
end
|
data/lib/txgh/tx_resource.rb
CHANGED
@@ -12,18 +12,7 @@ module Txgh
|
|
12
12
|
@type = type
|
13
13
|
@source_lang = source_lang
|
14
14
|
@source_file = source_file
|
15
|
-
@lang_map =
|
16
|
-
|
17
|
-
if lang_map
|
18
|
-
result = {}
|
19
|
-
lang_map.split(',').each do |m|
|
20
|
-
key_value = m.split(':', 2)
|
21
|
-
result[key_value[0].strip] = key_value[1].strip
|
22
|
-
end
|
23
|
-
|
24
|
-
@lang_map = result
|
25
|
-
end
|
26
|
-
|
15
|
+
@lang_map = lang_map
|
27
16
|
@translation_file = translation_file
|
28
17
|
end
|
29
18
|
|
data/lib/txgh/version.rb
CHANGED
@@ -50,7 +50,7 @@ describe ResourceDownloader do
|
|
50
50
|
before(:each) do
|
51
51
|
tx_config.resources << Txgh::TxResource.new(
|
52
52
|
project_name, "#{resource_slug}_second", 'YML',
|
53
|
-
'en', 'en.yml',
|
53
|
+
'en', 'en.yml', {}, 'translations/<lang>/sample2.yml'
|
54
54
|
)
|
55
55
|
|
56
56
|
allow(Txgh::Config::TxManager).to(
|
data/spec/tx_resource_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe TxResource do
|
|
6
6
|
let(:resource) do
|
7
7
|
TxResource.new(
|
8
8
|
'project_slug', 'resource_slug', 'type',
|
9
|
-
'source_lang', 'source_file', 'ko-KR
|
9
|
+
'source_lang', 'source_file', { 'ko-KR' => 'ko' }, 'translation_file/<lang>.foo'
|
10
10
|
)
|
11
11
|
end
|
12
12
|
|