translation 1.29 → 1.30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0d2f9ee1b57320b568bf17c4587f74a652ffe61c521d3fb1693d43d8ddbc67d
4
- data.tar.gz: ce0293347ec5ade30b2faf5ee6d3698f7b1191895d4cdb6fb23f6c869d057ff0
3
+ metadata.gz: c549c4dffebafe002a5ee128ef1fdfd695f1d829db5f888878e002d50208d59b
4
+ data.tar.gz: c4f73bdff11f801c63fda611f00c9b1a1c122c323527e21f730bcd888dc8fe07
5
5
  SHA512:
6
- metadata.gz: a2e07deb5a081fd8a0d8892b1f1c866db455f7194f7e3047141fccc5e76691997cf475d2a60fe20ed9c43c467f0f950fa9692bf8614ecc7fa2a49a960ef5d8fd
7
- data.tar.gz: d53909fdc6398034776f0bb3e682b4d7b26c7edd32e6003098bda6c866249ac79e4af4be27bab7fdd507484d4d96006e6ca112a59ee4269e4d3d7fdd1f96c40c
6
+ metadata.gz: c2a10e981f76aaa817e1e88f7fa020f406cbd77e0bc79781d8b13d74310fe01e7eb5ac290b871d370729b228178e45f245a822194ed6007c2341ee99d90ec449
7
+ data.tar.gz: 2198c2eb0111f19194a9641564c037e172c895fc7c6877a05b0fc8b2514c43ee536732614fd2b98470565194f6854f913231833c74af33f866b414e5dc9f4639
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # [Translation.io](https://translation.io) client for Ruby on Rails
2
2
 
3
3
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
4
- [![Build Status](https://travis-ci.com/translation/rails.svg?branch=master)](https://app.travis-ci.com/github/translation/rails)
4
+ [![Build Status](https://github.com/translation/rails/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/translation/rails/actions/workflows/test.yml)
5
5
  [![Test Coverage](https://codeclimate.com/github/translation/rails/badges/coverage.svg)](https://codeclimate.com/github/translation/rails/test_coverage)
6
6
  [![Gem Version](https://badgen.net/rubygems/v/translation)](https://rubygems.org/gems/translation)
7
7
  [![Downloads](https://img.shields.io/gem/dt/translation.svg)](https://rubygems.org/gems/translation)
@@ -21,7 +21,7 @@ module TranslationIO
21
21
 
22
22
  reload_or_reuse_yaml_sources
23
23
 
24
- @yaml_sources.each do |yaml_source|
24
+ @yaml_sources.to_a.each do |yaml_source|
25
25
  yaml_file_path = yaml_source[:yaml_file_path]
26
26
  yaml_flat_hash = yaml_source[:yaml_flat_hash]
27
27
 
@@ -55,7 +55,7 @@ module TranslationIO
55
55
  }
56
56
  end
57
57
  else
58
- @yaml_sources
58
+ @yaml_source
59
59
  end
60
60
  end
61
61
 
@@ -133,9 +133,10 @@ module TranslationIO
133
133
  if File.exist?(TranslationIO.config.metadata_path)
134
134
  metadata_content = File.read(TranslationIO.config.metadata_path)
135
135
 
136
+ # If any conflicts in file, take the lowest timestamp and potentially reapply some source edits
136
137
  if metadata_content.include?('>>>>') || metadata_content.include?('<<<<')
137
- TranslationIO.info "[Error] #{TranslationIO.config.metadata_path} file is corrupted and seems to have unresolved versioning conflicts. Please resolve them and try again."
138
- exit(false)
138
+ timestamps = metadata_content.scan(/timestamp: (\d*)/).flatten.uniq.collect(&:to_i)
139
+ return timestamps.min || 0
139
140
  else
140
141
  return YAML::load(metadata_content)['timestamp'] rescue 0
141
142
  end
@@ -146,6 +147,13 @@ module TranslationIO
146
147
 
147
148
  def update_metadata_timestamp
148
149
  File.open(TranslationIO.config.metadata_path, 'w') do |f|
150
+ f.puts '# This file is used in the context of Translation.io source editions.'
151
+ f.puts '# Please see: https://translation.io/blog/new-feature-copywriting'
152
+ f.puts '#'
153
+ f.puts '# If you have any git conflicts, either keep the smaller timestamp or'
154
+ f.puts '# ignore the conflicts and "sync" again, it will fix this file for you.'
155
+ f.puts
156
+
149
157
  f.write({ 'timestamp' => Time.now.utc.to_i }.to_yaml)
150
158
  end
151
159
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translation
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.29'
4
+ version: '1.30'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hoste
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-01 00:00:00.000000000 Z
12
+ date: 2022-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gettext