six-rsync 0.6.9 → 0.7.0
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/Rakefile +2 -1
- data/lib/six/rsync-app.rb +2 -0
- data/lib/six/rsync.rb +2 -1
- data/lib/six/rsync/base.rb +2 -2
- data/lib/six/rsync/lib.rb +34 -3
- metadata +8 -5
data/Rakefile
CHANGED
@@ -12,13 +12,14 @@ require 'rake/testtask'
|
|
12
12
|
|
13
13
|
spec = Gem::Specification.new do |s|
|
14
14
|
s.name = 'six-rsync'
|
15
|
-
s.version = '0.
|
15
|
+
s.version = '0.7.0'
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.extra_rdoc_files = ['README', 'LICENSE']
|
18
18
|
s.summary = 'Your summary here'
|
19
19
|
s.description = s.summary
|
20
20
|
s.author = 'Sickboy'
|
21
21
|
s.email = 'sb@dev-heaven.net'
|
22
|
+
#s.add_dependency('faster_require', '>= 0.5.2')
|
22
23
|
s.add_dependency('log4r', '>= 1.1.2')
|
23
24
|
s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
|
24
25
|
s.require_path = "lib"
|
data/lib/six/rsync-app.rb
CHANGED
data/lib/six/rsync.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#begin; require 'faster_require'; rescue LoadError; end if RUBY_PLATFORM =~ /cygwin|mingw|win32/
|
2
3
|
|
3
4
|
require 'fileutils'
|
4
5
|
require 'digest/md5'
|
@@ -27,7 +28,7 @@ module Six
|
|
27
28
|
|
28
29
|
module Rsync
|
29
30
|
COMPONENT = 'six-rsync'
|
30
|
-
VERSION = '0.
|
31
|
+
VERSION = '0.7.0'
|
31
32
|
BASE_PATH = Dir.pwd
|
32
33
|
|
33
34
|
case RUBY_PLATFORM
|
data/lib/six/rsync/base.rb
CHANGED
data/lib/six/rsync/lib.rb
CHANGED
@@ -13,7 +13,7 @@ module Six
|
|
13
13
|
attr_accessor :verbose
|
14
14
|
PROTECTED = false
|
15
15
|
WINDRIVE = /\"(\w)\:/
|
16
|
-
DEFAULT_CONFIG = {:hosts => [], :exclude => []}.to_yaml
|
16
|
+
DEFAULT_CONFIG = {:hosts => [], :exclude => [], :include => []}.to_yaml
|
17
17
|
DEFAULT_TIMEOUT = 60
|
18
18
|
PARAMS = if PROTECTED
|
19
19
|
"--dry-run --times -O --no-whole-file -r --delete --progress -h --exclude=.rsync"
|
@@ -337,7 +337,12 @@ module Six
|
|
337
337
|
arr_opts << "-I" if opts[:force]
|
338
338
|
|
339
339
|
init
|
340
|
-
|
340
|
+
config[:include] = opts[:include] if opts.keys.include?(:include)
|
341
|
+
config[:exclude] = opts[:exclude] if opts.keys.include?(:exclude)
|
342
|
+
config[:hosts] = opts[:hosts] if opts.keys.include?(:hosts)
|
343
|
+
save_config(config)
|
344
|
+
|
345
|
+
update('', arr_opts, opts.merge({:force => true}))
|
341
346
|
opts[:bare] ? {:repository => @rsync_work_dir} : {:working_directory => @rsync_work_dir}
|
342
347
|
end
|
343
348
|
|
@@ -346,6 +351,10 @@ module Six
|
|
346
351
|
|
347
352
|
handle_config
|
348
353
|
handle_hosts
|
354
|
+
config[:hosts] = opts[:hosts] if opts.keys.include?(:hosts)
|
355
|
+
config[:include] = opts[:include] if opts.keys.include?(:include)
|
356
|
+
config[:exclude] = opts[:exclude] if opts.keys.include?(:exclude)
|
357
|
+
save_config(config)
|
349
358
|
|
350
359
|
load_repos(:local)
|
351
360
|
begin
|
@@ -358,7 +367,9 @@ module Six
|
|
358
367
|
hosts = config[:hosts].clone
|
359
368
|
host = hosts.sample
|
360
369
|
|
361
|
-
|
370
|
+
man = false
|
371
|
+
man = true if !opts[:include].nil? && !opts[:include].empty?
|
372
|
+
if opts[:force] && !man
|
362
373
|
done = false
|
363
374
|
b, i = false, 0
|
364
375
|
#verbose = @verbose
|
@@ -473,6 +484,7 @@ module Six
|
|
473
484
|
|
474
485
|
mismatch = []
|
475
486
|
@repos_remote[typ].each_pair do |key, value|
|
487
|
+
next unless include_match(key, typ)
|
476
488
|
if value == @repos_local[typ][key]
|
477
489
|
#@logger.info "Match! #{key}"
|
478
490
|
else
|
@@ -548,6 +560,7 @@ module Six
|
|
548
560
|
end
|
549
561
|
|
550
562
|
@repos_local[typ].each_pair do |key, value|
|
563
|
+
next unless include_match(key, typ)
|
551
564
|
del_file(key, typ) unless config[:exclude].include?(key) || !@repos_remote[typ][key].nil?
|
552
565
|
end
|
553
566
|
|
@@ -560,6 +573,22 @@ module Six
|
|
560
573
|
|
561
574
|
|
562
575
|
private
|
576
|
+
def include_match(key, typ)
|
577
|
+
return true if config[:include].empty?
|
578
|
+
config[:include].each do |i|
|
579
|
+
if typ == :pack
|
580
|
+
key = key.sub(/\.gz$/, "")
|
581
|
+
end
|
582
|
+
case i
|
583
|
+
when /^*\.(\S*)$/
|
584
|
+
return true if key =~ /\.#{$1}$/
|
585
|
+
when /^(\S*)\.*/
|
586
|
+
return true if key =~ /^#{$1}\./
|
587
|
+
end
|
588
|
+
end
|
589
|
+
return false
|
590
|
+
end
|
591
|
+
|
563
592
|
def handle_config
|
564
593
|
@config = load_config
|
565
594
|
unless @config
|
@@ -596,6 +625,7 @@ module Six
|
|
596
625
|
def config
|
597
626
|
cfg = @config ||= YAML::load(DEFAULT_CONFIG)
|
598
627
|
cfg[:exclude] = [] unless cfg[:exclude]
|
628
|
+
cfg[:include] = [] unless cfg[:include]
|
599
629
|
cfg[:hosts] = [] unless cfg[:hosts]
|
600
630
|
cfg
|
601
631
|
end
|
@@ -645,6 +675,7 @@ module Six
|
|
645
675
|
relative.gsub!(@rsync_work_dir, '')
|
646
676
|
relative.gsub!(reg, '')
|
647
677
|
|
678
|
+
next unless include_match(relative, typ)
|
648
679
|
next if config[:exclude].include?(relative)
|
649
680
|
sum = md5(file)
|
650
681
|
h[relative] = sum if sum
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 7
|
8
|
+
- 0
|
9
|
+
version: 0.7.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sickboy
|
@@ -14,13 +14,14 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-07-24 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: log4r
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
@@ -67,6 +68,7 @@ rdoc_options: []
|
|
67
68
|
require_paths:
|
68
69
|
- lib
|
69
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
70
72
|
requirements:
|
71
73
|
- - ">="
|
72
74
|
- !ruby/object:Gem::Version
|
@@ -74,6 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
76
|
- 0
|
75
77
|
version: "0"
|
76
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
77
80
|
requirements:
|
78
81
|
- - ">="
|
79
82
|
- !ruby/object:Gem::Version
|
@@ -83,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
86
|
requirements: []
|
84
87
|
|
85
88
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.3.
|
89
|
+
rubygems_version: 1.3.7
|
87
90
|
signing_key:
|
88
91
|
specification_version: 3
|
89
92
|
summary: Your summary here
|