copy_tuner_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +9 -0
- data/Appraisals +15 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +161 -0
- data/README.md +4 -0
- data/Rakefile +28 -0
- data/copy_tuner_client.gemspec +33 -0
- data/features/rails.feature +270 -0
- data/features/step_definitions/copycopter_server_steps.rb +64 -0
- data/features/step_definitions/rails_steps.rb +172 -0
- data/features/support/env.rb +11 -0
- data/features/support/rails_server.rb +124 -0
- data/gemfiles/2.3.gemfile +7 -0
- data/gemfiles/2.3.gemfile.lock +105 -0
- data/gemfiles/3.0.gemfile +7 -0
- data/gemfiles/3.0.gemfile.lock +147 -0
- data/gemfiles/3.1.gemfile +11 -0
- data/gemfiles/3.1.gemfile.lock +191 -0
- data/init.rb +1 -0
- data/lib/copy_tuner_client/cache.rb +144 -0
- data/lib/copy_tuner_client/client.rb +136 -0
- data/lib/copy_tuner_client/configuration.rb +224 -0
- data/lib/copy_tuner_client/errors.rb +12 -0
- data/lib/copy_tuner_client/i18n_backend.rb +92 -0
- data/lib/copy_tuner_client/poller.rb +44 -0
- data/lib/copy_tuner_client/prefixed_logger.rb +45 -0
- data/lib/copy_tuner_client/process_guard.rb +92 -0
- data/lib/copy_tuner_client/rails.rb +21 -0
- data/lib/copy_tuner_client/railtie.rb +12 -0
- data/lib/copy_tuner_client/request_sync.rb +39 -0
- data/lib/copy_tuner_client/version.rb +7 -0
- data/lib/copy_tuner_client.rb +75 -0
- data/lib/tasks/copy_tuner_client_tasks.rake +20 -0
- data/spec/copy_tuner_client/cache_spec.rb +273 -0
- data/spec/copy_tuner_client/client_spec.rb +236 -0
- data/spec/copy_tuner_client/configuration_spec.rb +305 -0
- data/spec/copy_tuner_client/i18n_backend_spec.rb +157 -0
- data/spec/copy_tuner_client/poller_spec.rb +108 -0
- data/spec/copy_tuner_client/prefixed_logger_spec.rb +37 -0
- data/spec/copy_tuner_client/process_guard_spec.rb +118 -0
- data/spec/copy_tuner_client/request_sync_spec.rb +47 -0
- data/spec/copy_tuner_client_spec.rb +19 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/client_spec_helpers.rb +8 -0
- data/spec/support/defines_constants.rb +44 -0
- data/spec/support/fake_client.rb +53 -0
- data/spec/support/fake_copy_tuner_app.rb +175 -0
- data/spec/support/fake_html_safe_string.rb +20 -0
- data/spec/support/fake_logger.rb +68 -0
- data/spec/support/fake_passenger.rb +27 -0
- data/spec/support/fake_resque_job.rb +18 -0
- data/spec/support/fake_unicorn.rb +13 -0
- data/spec/support/middleware_stack.rb +13 -0
- data/spec/support/writing_cache.rb +17 -0
- data/tmp/projects.json +1 -0
- metadata +389 -0
@@ -0,0 +1,147 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mat_aki/gem/copy-tuner-ruby-client
|
3
|
+
specs:
|
4
|
+
copy_tuner_client (0.0.1)
|
5
|
+
i18n (>= 0.5.0)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
abstract (1.0.0)
|
12
|
+
actionmailer (3.0.3)
|
13
|
+
actionpack (= 3.0.3)
|
14
|
+
mail (~> 2.2.9)
|
15
|
+
actionpack (3.0.3)
|
16
|
+
activemodel (= 3.0.3)
|
17
|
+
activesupport (= 3.0.3)
|
18
|
+
builder (~> 2.1.2)
|
19
|
+
erubis (~> 2.6.6)
|
20
|
+
i18n (~> 0.4)
|
21
|
+
rack (~> 1.2.1)
|
22
|
+
rack-mount (~> 0.6.13)
|
23
|
+
rack-test (~> 0.5.6)
|
24
|
+
tzinfo (~> 0.3.23)
|
25
|
+
activemodel (3.0.3)
|
26
|
+
activesupport (= 3.0.3)
|
27
|
+
builder (~> 2.1.2)
|
28
|
+
i18n (~> 0.4)
|
29
|
+
activerecord (3.0.3)
|
30
|
+
activemodel (= 3.0.3)
|
31
|
+
activesupport (= 3.0.3)
|
32
|
+
arel (~> 2.0.2)
|
33
|
+
tzinfo (~> 0.3.23)
|
34
|
+
activeresource (3.0.3)
|
35
|
+
activemodel (= 3.0.3)
|
36
|
+
activesupport (= 3.0.3)
|
37
|
+
activesupport (3.0.3)
|
38
|
+
addressable (2.2.6)
|
39
|
+
appraisal (0.4.0)
|
40
|
+
bundler
|
41
|
+
rake
|
42
|
+
arel (2.0.10)
|
43
|
+
aruba (0.3.7)
|
44
|
+
childprocess (>= 0.1.9)
|
45
|
+
cucumber (>= 0.10.5)
|
46
|
+
rspec (>= 2.6.0)
|
47
|
+
bourne (1.0)
|
48
|
+
mocha (= 0.9.8)
|
49
|
+
builder (2.1.2)
|
50
|
+
childprocess (0.2.2)
|
51
|
+
ffi (~> 1.0.6)
|
52
|
+
crack (0.3.1)
|
53
|
+
cucumber (0.10.7)
|
54
|
+
builder (>= 2.1.2)
|
55
|
+
diff-lcs (>= 1.1.2)
|
56
|
+
gherkin (~> 2.4.0)
|
57
|
+
json (>= 1.4.6)
|
58
|
+
term-ansicolor (>= 1.0.5)
|
59
|
+
daemons (1.1.4)
|
60
|
+
diff-lcs (1.1.3)
|
61
|
+
erubis (2.6.6)
|
62
|
+
abstract (>= 1.0.0)
|
63
|
+
eventmachine (0.12.10)
|
64
|
+
ffi (1.0.11)
|
65
|
+
gherkin (2.4.21)
|
66
|
+
json (>= 1.4.6)
|
67
|
+
i18n (0.6.0)
|
68
|
+
json (1.6.1)
|
69
|
+
mail (2.2.19)
|
70
|
+
activesupport (>= 2.3.6)
|
71
|
+
i18n (>= 0.4.0)
|
72
|
+
mime-types (~> 1.16)
|
73
|
+
treetop (~> 1.4.8)
|
74
|
+
mime-types (1.17.2)
|
75
|
+
mocha (0.9.8)
|
76
|
+
rake
|
77
|
+
polyglot (0.3.3)
|
78
|
+
rack (1.2.4)
|
79
|
+
rack-mount (0.6.14)
|
80
|
+
rack (>= 1.0.0)
|
81
|
+
rack-test (0.5.7)
|
82
|
+
rack (>= 1.0)
|
83
|
+
rails (3.0.3)
|
84
|
+
actionmailer (= 3.0.3)
|
85
|
+
actionpack (= 3.0.3)
|
86
|
+
activerecord (= 3.0.3)
|
87
|
+
activeresource (= 3.0.3)
|
88
|
+
activesupport (= 3.0.3)
|
89
|
+
bundler (~> 1.0)
|
90
|
+
railties (= 3.0.3)
|
91
|
+
railties (3.0.3)
|
92
|
+
actionpack (= 3.0.3)
|
93
|
+
activesupport (= 3.0.3)
|
94
|
+
rake (>= 0.8.7)
|
95
|
+
thor (~> 0.14.4)
|
96
|
+
rake (0.9.2)
|
97
|
+
rspec (2.7.0)
|
98
|
+
rspec-core (~> 2.7.0)
|
99
|
+
rspec-expectations (~> 2.7.0)
|
100
|
+
rspec-mocks (~> 2.7.0)
|
101
|
+
rspec-core (2.7.1)
|
102
|
+
rspec-expectations (2.7.0)
|
103
|
+
diff-lcs (~> 1.1.2)
|
104
|
+
rspec-mocks (2.7.0)
|
105
|
+
sham_rack (1.3.3)
|
106
|
+
rack
|
107
|
+
sinatra (1.2.7)
|
108
|
+
rack (~> 1.1)
|
109
|
+
tilt (>= 1.2.2, < 2.0)
|
110
|
+
sqlite3 (1.3.4)
|
111
|
+
sqlite3-ruby (1.3.3)
|
112
|
+
sqlite3 (>= 1.3.3)
|
113
|
+
term-ansicolor (1.0.7)
|
114
|
+
thin (1.3.1)
|
115
|
+
daemons (>= 1.0.9)
|
116
|
+
eventmachine (>= 0.12.6)
|
117
|
+
rack (>= 1.0.0)
|
118
|
+
thor (0.14.6)
|
119
|
+
tilt (1.3.3)
|
120
|
+
treetop (1.4.10)
|
121
|
+
polyglot
|
122
|
+
polyglot (>= 0.3.1)
|
123
|
+
tzinfo (0.3.32)
|
124
|
+
webmock (1.7.7)
|
125
|
+
addressable (~> 2.2, > 2.2.5)
|
126
|
+
crack (>= 0.1.7)
|
127
|
+
yard (0.7.3)
|
128
|
+
|
129
|
+
PLATFORMS
|
130
|
+
ruby
|
131
|
+
|
132
|
+
DEPENDENCIES
|
133
|
+
appraisal (~> 0.4)
|
134
|
+
aruba (~> 0.3.2)
|
135
|
+
bourne
|
136
|
+
copy_tuner_client!
|
137
|
+
cucumber (~> 0.10.0)
|
138
|
+
i18n
|
139
|
+
rails (= 3.0.3)
|
140
|
+
rake (= 0.9.2)
|
141
|
+
rspec (~> 2.3)
|
142
|
+
sham_rack
|
143
|
+
sinatra
|
144
|
+
sqlite3-ruby
|
145
|
+
thin
|
146
|
+
webmock
|
147
|
+
yard
|
@@ -0,0 +1,191 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mat_aki/gem/copy-tuner-ruby-client
|
3
|
+
specs:
|
4
|
+
copy_tuner_client (0.0.1)
|
5
|
+
i18n (>= 0.5.0)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.1.0)
|
12
|
+
actionpack (= 3.1.0)
|
13
|
+
mail (~> 2.3.0)
|
14
|
+
actionpack (3.1.0)
|
15
|
+
activemodel (= 3.1.0)
|
16
|
+
activesupport (= 3.1.0)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
rack (~> 1.3.2)
|
21
|
+
rack-cache (~> 1.0.3)
|
22
|
+
rack-mount (~> 0.8.2)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.0.0)
|
25
|
+
activemodel (3.1.0)
|
26
|
+
activesupport (= 3.1.0)
|
27
|
+
bcrypt-ruby (~> 3.0.0)
|
28
|
+
builder (~> 3.0.0)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
activerecord (3.1.0)
|
31
|
+
activemodel (= 3.1.0)
|
32
|
+
activesupport (= 3.1.0)
|
33
|
+
arel (~> 2.2.1)
|
34
|
+
tzinfo (~> 0.3.29)
|
35
|
+
activeresource (3.1.0)
|
36
|
+
activemodel (= 3.1.0)
|
37
|
+
activesupport (= 3.1.0)
|
38
|
+
activesupport (3.1.0)
|
39
|
+
multi_json (~> 1.0)
|
40
|
+
addressable (2.2.7)
|
41
|
+
appraisal (0.4.1)
|
42
|
+
bundler
|
43
|
+
rake
|
44
|
+
arel (2.2.3)
|
45
|
+
aruba (0.3.7)
|
46
|
+
childprocess (>= 0.1.9)
|
47
|
+
cucumber (>= 0.10.5)
|
48
|
+
rspec (>= 2.6.0)
|
49
|
+
bcrypt-ruby (3.0.1)
|
50
|
+
bourne (1.1.1)
|
51
|
+
mocha (= 0.10.4)
|
52
|
+
builder (3.0.0)
|
53
|
+
childprocess (0.3.1)
|
54
|
+
ffi (~> 1.0.6)
|
55
|
+
coffee-rails (3.1.1)
|
56
|
+
coffee-script (>= 2.2.0)
|
57
|
+
railties (~> 3.1.0)
|
58
|
+
coffee-script (2.2.0)
|
59
|
+
coffee-script-source
|
60
|
+
execjs
|
61
|
+
coffee-script-source (1.2.0)
|
62
|
+
crack (0.3.1)
|
63
|
+
cucumber (0.10.7)
|
64
|
+
builder (>= 2.1.2)
|
65
|
+
diff-lcs (>= 1.1.2)
|
66
|
+
gherkin (~> 2.4.0)
|
67
|
+
json (>= 1.4.6)
|
68
|
+
term-ansicolor (>= 1.0.5)
|
69
|
+
daemons (1.1.8)
|
70
|
+
diff-lcs (1.1.3)
|
71
|
+
erubis (2.7.0)
|
72
|
+
eventmachine (0.12.10)
|
73
|
+
execjs (1.3.0)
|
74
|
+
multi_json (~> 1.0)
|
75
|
+
ffi (1.0.11)
|
76
|
+
gherkin (2.4.21)
|
77
|
+
json (>= 1.4.6)
|
78
|
+
hike (1.2.1)
|
79
|
+
i18n (0.6.0)
|
80
|
+
jquery-rails (1.0.19)
|
81
|
+
railties (~> 3.0)
|
82
|
+
thor (~> 0.14)
|
83
|
+
json (1.6.5)
|
84
|
+
mail (2.3.3)
|
85
|
+
i18n (>= 0.4.0)
|
86
|
+
mime-types (~> 1.16)
|
87
|
+
treetop (~> 1.4.8)
|
88
|
+
metaclass (0.0.1)
|
89
|
+
mime-types (1.17.2)
|
90
|
+
mocha (0.10.4)
|
91
|
+
metaclass (~> 0.0.1)
|
92
|
+
multi_json (1.1.0)
|
93
|
+
polyglot (0.3.3)
|
94
|
+
rack (1.3.6)
|
95
|
+
rack-cache (1.0.3)
|
96
|
+
rack (>= 0.4)
|
97
|
+
rack-mount (0.8.3)
|
98
|
+
rack (>= 1.0.0)
|
99
|
+
rack-protection (1.2.0)
|
100
|
+
rack
|
101
|
+
rack-ssl (1.3.2)
|
102
|
+
rack
|
103
|
+
rack-test (0.6.1)
|
104
|
+
rack (>= 1.0)
|
105
|
+
rails (3.1.0)
|
106
|
+
actionmailer (= 3.1.0)
|
107
|
+
actionpack (= 3.1.0)
|
108
|
+
activerecord (= 3.1.0)
|
109
|
+
activeresource (= 3.1.0)
|
110
|
+
activesupport (= 3.1.0)
|
111
|
+
bundler (~> 1.0)
|
112
|
+
railties (= 3.1.0)
|
113
|
+
railties (3.1.0)
|
114
|
+
actionpack (= 3.1.0)
|
115
|
+
activesupport (= 3.1.0)
|
116
|
+
rack-ssl (~> 1.3.2)
|
117
|
+
rake (>= 0.8.7)
|
118
|
+
rdoc (~> 3.4)
|
119
|
+
thor (~> 0.14.6)
|
120
|
+
rake (0.9.2)
|
121
|
+
rdoc (3.12)
|
122
|
+
json (~> 1.4)
|
123
|
+
rspec (2.8.0)
|
124
|
+
rspec-core (~> 2.8.0)
|
125
|
+
rspec-expectations (~> 2.8.0)
|
126
|
+
rspec-mocks (~> 2.8.0)
|
127
|
+
rspec-core (2.8.0)
|
128
|
+
rspec-expectations (2.8.0)
|
129
|
+
diff-lcs (~> 1.1.2)
|
130
|
+
rspec-mocks (2.8.0)
|
131
|
+
sass (3.1.15)
|
132
|
+
sass-rails (3.1.5)
|
133
|
+
actionpack (~> 3.1.0)
|
134
|
+
railties (~> 3.1.0)
|
135
|
+
sass (~> 3.1.10)
|
136
|
+
tilt (~> 1.3.2)
|
137
|
+
sham_rack (1.3.3)
|
138
|
+
rack
|
139
|
+
sinatra (1.3.2)
|
140
|
+
rack (~> 1.3, >= 1.3.6)
|
141
|
+
rack-protection (~> 1.2)
|
142
|
+
tilt (~> 1.3, >= 1.3.3)
|
143
|
+
sprockets (2.0.3)
|
144
|
+
hike (~> 1.2)
|
145
|
+
rack (~> 1.0)
|
146
|
+
tilt (~> 1.1, != 1.3.0)
|
147
|
+
sqlite3 (1.3.5)
|
148
|
+
sqlite3-ruby (1.3.3)
|
149
|
+
sqlite3 (>= 1.3.3)
|
150
|
+
term-ansicolor (1.0.7)
|
151
|
+
thin (1.3.1)
|
152
|
+
daemons (>= 1.0.9)
|
153
|
+
eventmachine (>= 0.12.6)
|
154
|
+
rack (>= 1.0.0)
|
155
|
+
thor (0.14.6)
|
156
|
+
tilt (1.3.3)
|
157
|
+
treetop (1.4.10)
|
158
|
+
polyglot
|
159
|
+
polyglot (>= 0.3.1)
|
160
|
+
tzinfo (0.3.32)
|
161
|
+
uglifier (1.2.3)
|
162
|
+
execjs (>= 0.3.0)
|
163
|
+
multi_json (>= 1.0.2)
|
164
|
+
webmock (1.8.3)
|
165
|
+
addressable (>= 2.2.7)
|
166
|
+
crack (>= 0.1.7)
|
167
|
+
yard (0.7.5)
|
168
|
+
|
169
|
+
PLATFORMS
|
170
|
+
ruby
|
171
|
+
|
172
|
+
DEPENDENCIES
|
173
|
+
appraisal (~> 0.4)
|
174
|
+
aruba (~> 0.3.2)
|
175
|
+
bourne
|
176
|
+
coffee-rails
|
177
|
+
copy_tuner_client!
|
178
|
+
cucumber (~> 0.10.0)
|
179
|
+
i18n
|
180
|
+
jquery-rails
|
181
|
+
rails (= 3.1.0)
|
182
|
+
rake (= 0.9.2)
|
183
|
+
rspec (~> 2.3)
|
184
|
+
sass-rails
|
185
|
+
sham_rack
|
186
|
+
sinatra
|
187
|
+
sqlite3-ruby
|
188
|
+
thin
|
189
|
+
uglifier
|
190
|
+
webmock
|
191
|
+
yard
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'copy_tuner_client'
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require 'thread'
|
2
|
+
require 'copy_tuner_client/client'
|
3
|
+
|
4
|
+
module CopyTunerClient
|
5
|
+
# Manages synchronization of copy between {I18nBackend} and {Client}. Acts
|
6
|
+
# like a Hash. Applications using the client will not need to interact with
|
7
|
+
# this class directly.
|
8
|
+
#
|
9
|
+
# Responsible for locking down access to data used by both threads.
|
10
|
+
class Cache
|
11
|
+
# Usually instantiated when {Configuration#apply} is invoked.
|
12
|
+
# @param client [Client] the client used to fetch and upload data
|
13
|
+
# @param options [Hash]
|
14
|
+
# @option options [Logger] :logger where errors should be logged
|
15
|
+
def initialize(client, options)
|
16
|
+
@blurbs = {}
|
17
|
+
@client = client
|
18
|
+
@downloaded = false
|
19
|
+
@logger = options[:logger]
|
20
|
+
@mutex = Mutex.new
|
21
|
+
@queued = {}
|
22
|
+
@started = false
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns content for the given blurb.
|
26
|
+
# @param key [String] the key of the desired blurb
|
27
|
+
# @return [String] the contents of the blurb
|
28
|
+
def [](key)
|
29
|
+
lock { @blurbs[key] }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Sets content for the given blurb. The content will be pushed to the
|
33
|
+
# server on the next flush.
|
34
|
+
# @param key [String] the key of the blurb to update
|
35
|
+
# @param value [String] the new contents of the blurb
|
36
|
+
def []=(key, value)
|
37
|
+
lock { @queued[key] = value }
|
38
|
+
end
|
39
|
+
|
40
|
+
# Keys for all blurbs stored on the server.
|
41
|
+
# @return [Array<String>] keys
|
42
|
+
def keys
|
43
|
+
lock { @blurbs.keys }
|
44
|
+
end
|
45
|
+
|
46
|
+
# Yaml representation of all blurbs
|
47
|
+
# @return [String] yaml
|
48
|
+
def export
|
49
|
+
keys = {}
|
50
|
+
lock do
|
51
|
+
@blurbs.sort.each do |(blurb_key, value)|
|
52
|
+
current = keys
|
53
|
+
yaml_keys = blurb_key.split('.')
|
54
|
+
|
55
|
+
0.upto(yaml_keys.size - 2) do |i|
|
56
|
+
key = yaml_keys[i]
|
57
|
+
|
58
|
+
# Overwrite en.key with en.sub.key
|
59
|
+
unless current[key].class == Hash
|
60
|
+
current[key] = {}
|
61
|
+
end
|
62
|
+
|
63
|
+
current = current[key]
|
64
|
+
end
|
65
|
+
|
66
|
+
current[yaml_keys.last] = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
unless keys.size < 1
|
71
|
+
keys.to_yaml
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Waits until the first download has finished.
|
76
|
+
def wait_for_download
|
77
|
+
if pending?
|
78
|
+
logger.info 'Waiting for first download'
|
79
|
+
|
80
|
+
if logger.respond_to? :flush
|
81
|
+
logger.flush
|
82
|
+
end
|
83
|
+
|
84
|
+
while pending?
|
85
|
+
sleep 0.1
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def flush
|
91
|
+
with_queued_changes do |queued|
|
92
|
+
client.upload queued
|
93
|
+
end
|
94
|
+
rescue ConnectionError => error
|
95
|
+
logger.error error.message
|
96
|
+
end
|
97
|
+
|
98
|
+
def download
|
99
|
+
@started = true
|
100
|
+
|
101
|
+
client.download do |downloaded_blurbs|
|
102
|
+
downloaded_blurbs.reject! { |key, value| value == '' }
|
103
|
+
lock { @blurbs = downloaded_blurbs }
|
104
|
+
end
|
105
|
+
rescue ConnectionError => error
|
106
|
+
logger.error error.message
|
107
|
+
ensure
|
108
|
+
@downloaded = true
|
109
|
+
end
|
110
|
+
|
111
|
+
# Downloads and then flushes
|
112
|
+
def sync
|
113
|
+
download
|
114
|
+
flush
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
attr_reader :client, :logger
|
120
|
+
|
121
|
+
def with_queued_changes
|
122
|
+
changes_to_push = nil
|
123
|
+
|
124
|
+
lock do
|
125
|
+
unless @queued.empty?
|
126
|
+
changes_to_push = @queued
|
127
|
+
@queued = {}
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if changes_to_push
|
132
|
+
yield changes_to_push
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def lock(&block)
|
137
|
+
@mutex.synchronize &block
|
138
|
+
end
|
139
|
+
|
140
|
+
def pending?
|
141
|
+
@started && !@downloaded
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|