inscriber 0.0.1 → 0.1.0
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/inscriber/exporter.rb +1 -1
- data/lib/inscriber/inserter.rb +1 -1
- data/lib/inscriber/version.rb +1 -1
- data/spec/exporter_spec.rb +1 -1
- data/spec/inserter_spec.rb +2 -2
- 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: 4ca7e4d4b7997de990d8f92a98bf1ff7ed1af38f
|
4
|
+
data.tar.gz: a617de87684a527f363f9d5655c1ff84d0456e92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d242d45cf04ff1c1b8fcf6c07b73882166a73d6b6112443be74012b02931ffa1c16b0c8e5f05747d11ce7a43a823d93e18cbf93fd6164e2a405899839577fd88
|
7
|
+
data.tar.gz: eb90965a4a8a968c973df23602e35664fbf15378dee99dfa2ffd5ed1326cb61c1c415cd4c0f05f420aea2ae2e57a0d5f9b161cb180e9720f85c3555c14381a46
|
data/lib/inscriber/exporter.rb
CHANGED
@@ -3,7 +3,7 @@ module Inscriber
|
|
3
3
|
class << self
|
4
4
|
def export(database)
|
5
5
|
data = { "#{database.source_lang}" => download_from_db(database) }
|
6
|
-
File.open("#{database.output_dir}/#{database.file_name}.yml", "w") { |f| f.write data.to_yaml }
|
6
|
+
File.open("#{database.output_dir}/#{database.file_name}.#{database.source_lang}.yml", "w") { |f| f.write data.to_yaml }
|
7
7
|
{ status: true }
|
8
8
|
end
|
9
9
|
|
data/lib/inscriber/inserter.rb
CHANGED
@@ -8,7 +8,7 @@ module Inscriber
|
|
8
8
|
file_path = "#{database.input_dir}/#{database.file_name}"
|
9
9
|
if File.exist? "#{file_path}.#{locale}.yml"
|
10
10
|
data = YAML.load_file("#{file_path}.#{locale}.yml")
|
11
|
-
source_data = YAML.load_file("#{file_path}.yml")
|
11
|
+
source_data = YAML.load_file("#{file_path}.#{database.source_lang}.yml")
|
12
12
|
records_array = []
|
13
13
|
|
14
14
|
data[locale].each do |table, records|
|
data/lib/inscriber/version.rb
CHANGED
data/spec/exporter_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Inscriber::Exporter do
|
|
15
15
|
let :file do
|
16
16
|
database.connection.from(:test_translations).insert(:body => 'test string', :test_id => 1, :locale => 'en')
|
17
17
|
Inscriber::Exporter.export(database)
|
18
|
-
"#{database.file_name}.yml"
|
18
|
+
"#{database.file_name}.#{database.source_lang}.yml"
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '.export' do
|
data/spec/inserter_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe Inscriber::Inserter do
|
|
28
28
|
let! :file do
|
29
29
|
database.connection.from(:test_translations).insert(:body => 'test string', :test_id => 1, :locale => 'en')
|
30
30
|
Inscriber::Exporter.export(database)
|
31
|
-
"#{database.file_name}.yml"
|
31
|
+
"#{database.file_name}.#{database.source_lang}.yml"
|
32
32
|
end
|
33
33
|
|
34
34
|
let!(:translated_file) do
|
@@ -48,7 +48,7 @@ describe Inscriber::Inserter do
|
|
48
48
|
}
|
49
49
|
expect(db.where(query).all.length).to be 1
|
50
50
|
File.unlink('test.fr.yml')
|
51
|
-
File.unlink('test.yml')
|
51
|
+
File.unlink('test.en.yml')
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|