zmeygo_sync 0.21 → 0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +0 -5
- data/lib/zmeygo_sync/base.rb +10 -1
- data/lib/zmeygo_sync/cache.rb +1 -1
- data/lib/zmeygo_sync/client.rb +1 -1
- data/lib/zmeygo_sync/command.rb +3 -1
- data/lib/zmeygo_sync/version.rb +1 -1
- metadata +1 -1
data/TODO
CHANGED
data/lib/zmeygo_sync/base.rb
CHANGED
@@ -8,7 +8,7 @@ require 'active_support/core_ext/hash'
|
|
8
8
|
require 'yaml'
|
9
9
|
require 'logger'
|
10
10
|
|
11
|
-
require File.join(File.dirname(__FILE__),'/version')
|
11
|
+
#require File.join(File.dirname(__FILE__),'/version')
|
12
12
|
require File.join(File.dirname(__FILE__),'/constant')
|
13
13
|
require File.join(File.dirname(__FILE__),'/configuration')
|
14
14
|
require File.join(File.dirname(__FILE__),'/client')
|
@@ -23,6 +23,9 @@ module ZmeygoSync
|
|
23
23
|
attr_accessor :logger
|
24
24
|
|
25
25
|
def method_missing(method, *args)
|
26
|
+
if self.cache.blank?
|
27
|
+
ZmeygoSync.configure
|
28
|
+
end
|
26
29
|
self.cache.respond_to?(method)? cache.send(method, *args) : super
|
27
30
|
end
|
28
31
|
|
@@ -33,6 +36,12 @@ module ZmeygoSync
|
|
33
36
|
end
|
34
37
|
self.cache = Cache.new
|
35
38
|
self.logger = Logger.new(File.join(Rails.root, 'log', 'zmeygo_sync.log'))
|
39
|
+
if self.config['api_token'].blank?
|
40
|
+
raise "API TOKEN missing in cofiguration of zmeygo_sync"
|
41
|
+
end
|
42
|
+
if self.config['project'].blank?
|
43
|
+
raise "project missing in cofiguration of zmeygo_sync"
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
data/lib/zmeygo_sync/cache.rb
CHANGED
data/lib/zmeygo_sync/client.rb
CHANGED
@@ -20,10 +20,10 @@ module ZmeygoSync
|
|
20
20
|
keys = []
|
21
21
|
hash = ZmeygoSync.load_cache
|
22
22
|
puts "cache=#{hash}" if options[:verbose]
|
23
|
-
ZmeygoSync.clear_cache
|
24
23
|
begin
|
25
24
|
puts "POST #{url}" if options[:verbose]
|
26
25
|
response = RestClient.post(url,:data => hash)
|
26
|
+
ZmeygoSync.clear_cache
|
27
27
|
rescue
|
28
28
|
puts "Direct http request #{url} failed!" if options[:verbose]
|
29
29
|
if RestClient.proxy.nil?
|
data/lib/zmeygo_sync/command.rb
CHANGED
@@ -49,9 +49,11 @@ module ZmeygoSync
|
|
49
49
|
end
|
50
50
|
step = 0
|
51
51
|
loop do
|
52
|
+
Rails.logger.info "[zmeygo_sync] pushing..."
|
52
53
|
self.client.push
|
53
54
|
# once in 5 minutes download locales from server
|
54
55
|
if step % 10 == 0
|
56
|
+
Rails.logger.info "[zmeygo_sync] pulling..."
|
55
57
|
self.client.pull
|
56
58
|
end
|
57
59
|
step += 1
|
@@ -61,7 +63,7 @@ module ZmeygoSync
|
|
61
63
|
sleep(@options[:sleep_delay])
|
62
64
|
end
|
63
65
|
rescue => e
|
64
|
-
|
66
|
+
Rails.logger.fatal e
|
65
67
|
STDERR.puts e.message
|
66
68
|
exit 1
|
67
69
|
end
|
data/lib/zmeygo_sync/version.rb
CHANGED