tml 5.4.4 → 5.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f04411b1f920d215ccde7774eb751fec293d587e
4
- data.tar.gz: 3ec933ac7376a594666e7fb3a26807c3dd8db471
3
+ metadata.gz: 55a593dd10fe515d4bc86495de5df5bfc0174e74
4
+ data.tar.gz: 3630a827b871144f534d4eb0e3f96b511fc0ca44
5
5
  SHA512:
6
- metadata.gz: 864bb0e051749747d75aa3db32ad1bd608b80b197819db9fe4ec578d239a4ce2f26b8eb340d361aeeb0b9e9a3349b5b2cb966e00d54b90aea6e995da047aa455
7
- data.tar.gz: 8779d294b89958bfa5d763eb629c9de44485ec6dbe97c95144fb6733f6a5577c7b6466f2a80ba53f3de8ddb6389b650af7915d036322e76e50d16b0afe36d90e
6
+ metadata.gz: 487911fa7073003f1e73f95e74c134a801f742795dc2e7783e2c26c975a6a035d718826cfa6614a6f397cb23e899508aa140a0ceffe8466c152471b856393b5e
7
+ data.tar.gz: 324205be9a2ae9d5d4a9ede6d178ffe0418333b39b1f60cad0de00d0d7f1d889579ec2a5ac8a77aaea2ad387ee553407bfe8545011cd23f9965176278fe0336b
@@ -188,9 +188,17 @@ class Tml::Application < Tml::Base
188
188
  ).fetch_translations(locale)
189
189
  end
190
190
 
191
+ # checks if key registration is allowed
192
+ # currently it is based on user's inline mode
193
+ def allow_key_registration?
194
+ return if token.nil?
195
+ Tml.session.inline_mode?
196
+ end
197
+
191
198
  # Verify current source path
192
199
  def verify_source_path(source_key, source_path)
193
- return if Tml.cache.enabled? and not Tml.session.inline_mode?
200
+ return unless allow_key_registration?
201
+
194
202
  return if extensions.nil? or extensions['sources'].nil?
195
203
  return unless extensions['sources'][source_key].nil?
196
204
  @missing_keys_by_sources ||= {}
@@ -199,7 +207,8 @@ class Tml::Application < Tml::Base
199
207
 
200
208
  # Register missing keys
201
209
  def register_missing_key(source_key, tkey)
202
- return if Tml.cache.enabled? and not Tml.session.inline_mode?
210
+ return unless allow_key_registration?
211
+
203
212
  source_key = source_key.to_s
204
213
  @missing_keys_by_sources ||= {}
205
214
  @missing_keys_by_sources[source_key] ||= {}
@@ -208,11 +217,16 @@ class Tml::Application < Tml::Base
208
217
  end
209
218
 
210
219
  # Register keys
220
+ # TODO: make this async using a separate thread, like in:
221
+ # https://github.com/airbrake/airbrake-ruby/blob/master/lib/airbrake-ruby/async_sender.rb
211
222
  def register_keys(keys)
212
223
  params = []
213
224
  keys.each do |source_key, keys|
214
225
  source = Tml::Source.new(:source => source_key, :application => self)
215
- params << {:source => source_key, :keys => keys.values.collect{|tkey| tkey.to_hash(:label, :description, :locale, :level)}}
226
+ params << {
227
+ :source => source_key,
228
+ :keys => keys.values.collect{|tkey| tkey.to_hash(:label, :description, :locale, :level)}
229
+ }
216
230
  source.reset_cache
217
231
  end
218
232
 
data/lib/tml/session.rb CHANGED
@@ -43,10 +43,10 @@ module Tml
43
43
  def init(opts = {})
44
44
  return if Tml.config.disabled?
45
45
 
46
- key = opts[:key] || Tml.config.application[:key]
47
- host = opts[:host] || Tml.config.application[:host]
48
- cdn_host = opts[:cdn_host] || Tml.config.application[:cdn_host]
49
- token = opts[:access_token]
46
+ key = opts[:key] || Tml.config.application[:key]
47
+ host = opts[:host] || Tml.config.application[:host]
48
+ cdn_host = opts[:cdn_host] || Tml.config.application[:cdn_host]
49
+ token = opts[:access_token] || Tml.config.application[:token]
50
50
 
51
51
  Tml.cache.reset_version
52
52
 
data/lib/tml/version.rb CHANGED
@@ -31,7 +31,7 @@
31
31
  #++
32
32
 
33
33
  module Tml
34
- VERSION = '5.4.4'
34
+ VERSION = '5.4.5'
35
35
 
36
36
  def self.full_version
37
37
  "tml-ruby v#{Tml::VERSION} (Faraday v#{Faraday::VERSION})"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tml
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.4
4
+ version: 5.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday