rbrsync 0.0.2 → 0.0.3
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.
- data/lib/rbrsync/rbrsync.rb +13 -30
- data/lib/rbrsync/version.rb +1 -1
- metadata +2 -2
data/lib/rbrsync/rbrsync.rb
CHANGED
@@ -220,12 +220,12 @@ module RbRsync
|
|
220
220
|
attr_accessor :to_host, :to_user, :to_path
|
221
221
|
|
222
222
|
def from
|
223
|
-
@from
|
223
|
+
@from ||= build_path(from_user, from_host, from_path)
|
224
224
|
end
|
225
225
|
attr_writer :from
|
226
226
|
|
227
227
|
def to
|
228
|
-
@to
|
228
|
+
@to ||= build_path(to_user, to_host, to_path)
|
229
229
|
end
|
230
230
|
attr_writer :to
|
231
231
|
|
@@ -233,27 +233,9 @@ module RbRsync
|
|
233
233
|
Negator.new self
|
234
234
|
end
|
235
235
|
|
236
|
-
# returns the
|
236
|
+
# returns the rsync command that would be executed
|
237
237
|
def command
|
238
|
-
|
239
|
-
c = ""
|
240
|
-
c << "rsync"
|
241
|
-
@options.each_pair do |flag, value|
|
242
|
-
next if value.nil?
|
243
|
-
|
244
|
-
if value.is_a? Array
|
245
|
-
value.each do |v|
|
246
|
-
c << " --#{flag}='#{v}'"
|
247
|
-
end
|
248
|
-
else
|
249
|
-
c << " --#{flag}"
|
250
|
-
end
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
c << " #{from} #{to}"
|
255
|
-
|
256
|
-
c
|
238
|
+
build_command.join ' '
|
257
239
|
end
|
258
240
|
|
259
241
|
# perform the sync
|
@@ -263,9 +245,9 @@ module RbRsync
|
|
263
245
|
cmd = build_command
|
264
246
|
|
265
247
|
status = Open4.popen4(*cmd) do |pid, stdin, stdout, stderr|
|
248
|
+
puts stderr.read if stderr
|
266
249
|
end
|
267
250
|
|
268
|
-
puts status.exitstatus
|
269
251
|
end
|
270
252
|
|
271
253
|
def self.boolean_methods
|
@@ -274,19 +256,20 @@ module RbRsync
|
|
274
256
|
|
275
257
|
protected
|
276
258
|
def build_command
|
277
|
-
cmd = []
|
278
|
-
cmd << 'rsync'
|
259
|
+
cmd = ['rsync']
|
279
260
|
|
280
261
|
@options.each_pair do |flag, value|
|
281
262
|
next if value.nil?
|
282
|
-
c = "--#{flag}"
|
283
263
|
|
284
|
-
if value.is_a?
|
285
|
-
|
264
|
+
if value.is_a? Array
|
265
|
+
value.each do |v|
|
266
|
+
cmd << "--#{flag}='#{v}'"
|
267
|
+
end
|
268
|
+
else
|
269
|
+
cmd << "--#{flag}"
|
286
270
|
end
|
287
|
-
|
288
|
-
cmd << c
|
289
271
|
end
|
272
|
+
|
290
273
|
|
291
274
|
cmd << from
|
292
275
|
cmd << to
|
data/lib/rbrsync/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbrsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-04-
|
13
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: open4
|