yaml-translator 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/README.md +1 -1
- data/lib/yaml-translator/translated_result.rb +12 -2
- data/lib/yaml-translator/version.rb +1 -1
- data/spec/yaml-translator/translated_result_spec.rb +15 -0
- data/yaml-translator.gemspec +15 -14
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f6225b723afffaf9bb37987dd1241e9f0fd394d
|
4
|
+
data.tar.gz: c038b73b182bcc0918a163aaebd8050f488f7e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a708f5c97c4fb4018ba50088004a706b65ea84c6d0cb3a5816ccc613dc7200a0d9b5b944788723217e71f8cd63e8f2fe09faa5b5402a10ec9945dd0c0602e2
|
7
|
+
data.tar.gz: e7a729fd0352030c21fba380c022551a43b360598307bc530901b951f5ed415e21757955305ccb7146ac1db8d0d33db6cb6d16fd0d0e493e23679f2bf9d25d6b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yaml-translator (0.1.
|
4
|
+
yaml-translator (0.1.1)
|
5
5
|
easy_translate
|
6
6
|
|
7
7
|
GEM
|
@@ -42,6 +42,8 @@ GEM
|
|
42
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
43
|
rspec-support (~> 3.5.0)
|
44
44
|
rspec-support (3.5.0)
|
45
|
+
rspec-temp_dir (1.0.0)
|
46
|
+
rspec (>= 3.0)
|
45
47
|
simplecov (0.13.0)
|
46
48
|
docile (~> 1.1.0)
|
47
49
|
json (>= 1.8, < 3)
|
@@ -66,6 +68,7 @@ DEPENDENCIES
|
|
66
68
|
coveralls
|
67
69
|
rake (~> 10.0)
|
68
70
|
rspec
|
71
|
+
rspec-temp_dir
|
69
72
|
simplecov
|
70
73
|
simplecov-console
|
71
74
|
yaml-translator!
|
data/README.md
CHANGED
@@ -20,10 +20,10 @@ translator = ::YamlTranslator::Translator.new(adapter)
|
|
20
20
|
|
21
21
|
result = translator.translate(yaml, to: :ja)
|
22
22
|
result.save_to('/path/to/directory') # Write a ja.yml
|
23
|
+
result.save # Write a ja.yml (current directory)
|
23
24
|
```
|
24
25
|
|
25
26
|
## Run the test
|
26
27
|
|
27
28
|
bundle install
|
28
29
|
rake spec
|
29
|
-
|
@@ -9,12 +9,22 @@ module YamlTranslator
|
|
9
9
|
@values = values
|
10
10
|
end
|
11
11
|
|
12
|
+
def save(dir=Dir.pwd)
|
13
|
+
write_file(File.join(dir, "#{lang}.yml"))
|
14
|
+
end
|
15
|
+
|
12
16
|
def save_to(dir)
|
13
|
-
|
17
|
+
save(dir)
|
14
18
|
end
|
15
19
|
|
16
20
|
def to_s
|
17
|
-
@values
|
21
|
+
YAML.dump(@values)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def write_file(file_path)
|
27
|
+
File.write(file_path, to_s)
|
18
28
|
end
|
19
29
|
end
|
20
30
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rspec/temp_dir'
|
2
|
+
|
3
|
+
describe YamlTranslator::TranslatedResult do
|
4
|
+
let(:result) { YamlTranslator::TranslatedResult.new({ foo: 'bar' }, 'ja') }
|
5
|
+
describe '#save_to' do
|
6
|
+
let(:tmp_dir) { temp_dir }
|
7
|
+
let(:output_file) { File.join(tmp_dir, 'ja.yml') }
|
8
|
+
let(:file_exist) { File.exist?(output_file) }
|
9
|
+
include_context 'uses temp dir'
|
10
|
+
it 'should be write a language file' do
|
11
|
+
result.save_to(tmp_dir)
|
12
|
+
expect(file_exist).to be true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/yaml-translator.gemspec
CHANGED
@@ -4,26 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'yaml-translator/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'yaml-translator'
|
8
8
|
spec.version = YamlTranslator::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['Noritaka Horio']
|
10
|
+
spec.email = ['holy.shared.design@gmail.com']
|
11
|
+
spec.summary = ''
|
12
|
+
spec.description = ''
|
13
|
+
spec.homepage = 'https://github.com/holyshared/yaml-translator'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'easy_translate'
|
22
22
|
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'simplecov'
|
27
|
+
spec.add_development_dependency 'simplecov-console'
|
28
|
+
spec.add_development_dependency 'coveralls'
|
29
|
+
spec.add_development_dependency 'rspec-temp_dir'
|
29
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml-translator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noritaka Horio
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-temp_dir
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: ''
|
112
126
|
email:
|
113
127
|
- holy.shared.design@gmail.com
|
@@ -140,6 +154,7 @@ files:
|
|
140
154
|
- spec/fixtures/with_root.yml
|
141
155
|
- spec/helpers/locale_helper.rb
|
142
156
|
- spec/spec_helper.rb
|
157
|
+
- spec/yaml-translator/translated_result_spec.rb
|
143
158
|
- spec/yaml-translator/translator_spec.rb
|
144
159
|
- yaml-translator.gemspec
|
145
160
|
homepage: https://github.com/holyshared/yaml-translator
|
@@ -171,4 +186,5 @@ test_files:
|
|
171
186
|
- spec/fixtures/with_root.yml
|
172
187
|
- spec/helpers/locale_helper.rb
|
173
188
|
- spec/spec_helper.rb
|
189
|
+
- spec/yaml-translator/translated_result_spec.rb
|
174
190
|
- spec/yaml-translator/translator_spec.rb
|