tml 5.4.4 → 5.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tml/application.rb +17 -3
- data/lib/tml/session.rb +4 -4
- data/lib/tml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55a593dd10fe515d4bc86495de5df5bfc0174e74
|
4
|
+
data.tar.gz: 3630a827b871144f534d4eb0e3f96b511fc0ca44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 487911fa7073003f1e73f95e74c134a801f742795dc2e7783e2c26c975a6a035d718826cfa6614a6f397cb23e899508aa140a0ceffe8466c152471b856393b5e
|
7
|
+
data.tar.gz: 324205be9a2ae9d5d4a9ede6d178ffe0418333b39b1f60cad0de00d0d7f1d889579ec2a5ac8a77aaea2ad387ee553407bfe8545011cd23f9965176278fe0336b
|
data/lib/tml/application.rb
CHANGED
@@ -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
|
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
|
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 << {
|
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]
|
47
|
-
host = opts[:host]
|
48
|
-
cdn_host = opts[: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
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
|
+
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-
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|