filecluster 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fc/storage.rb +6 -6
- data/lib/fc/version.rb +1 -1
- data/lib/manage/storages.rb +18 -0
- metadata +4 -4
data/lib/fc/storage.rb
CHANGED
@@ -42,13 +42,13 @@ module FC
|
|
42
42
|
dst_path = "#{self.path}#{file_name}"
|
43
43
|
|
44
44
|
cmd = "rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}"
|
45
|
-
cmd = self.class.curr_host == host ? cmd : "ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host}
|
45
|
+
cmd = self.class.curr_host == host ? cmd : "ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"#{cmd}\""
|
46
46
|
r = `#{cmd} 2>&1`
|
47
47
|
raise r if $?.exitstatus != 0
|
48
48
|
|
49
49
|
cmd = self.class.curr_host == host ?
|
50
50
|
"cp -r #{local_path.shellescape} #{dst_path.shellescape}" :
|
51
|
-
"scp -rB #{local_path.shellescape} #{self.host}
|
51
|
+
"scp -rB #{local_path.shellescape} #{self.host}:\"#{dst_path.shellescape}\""
|
52
52
|
r = `#{cmd} 2>&1`
|
53
53
|
raise r if $?.exitstatus != 0
|
54
54
|
end
|
@@ -62,7 +62,7 @@ module FC
|
|
62
62
|
|
63
63
|
cmd = self.class.curr_host == host ?
|
64
64
|
"cp -r #{src_path.shellescape} #{local_path.shellescape}" :
|
65
|
-
"scp -rB #{self.host}
|
65
|
+
"scp -rB #{self.host}:\"#{src_path.shellescape}\" #{local_path.shellescape}"
|
66
66
|
r = `#{cmd} 2>&1`
|
67
67
|
raise r if $?.exitstatus != 0
|
68
68
|
end
|
@@ -72,13 +72,13 @@ module FC
|
|
72
72
|
dst_path = "#{self.path}#{file_name}"
|
73
73
|
cmd = self.class.curr_host == host ?
|
74
74
|
"rm -rf #{dst_path.shellescape}" :
|
75
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host}
|
75
|
+
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"rm -rf #{dst_path.shellescape}\""
|
76
76
|
r = `#{cmd} 2>&1`
|
77
77
|
raise r if $?.exitstatus != 0
|
78
78
|
|
79
79
|
cmd = self.class.curr_host == host ?
|
80
80
|
"ls -la #{dst_path.shellescape}" :
|
81
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host}
|
81
|
+
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"ls -la #{dst_path.shellescape}\""
|
82
82
|
r = `#{cmd} 2>/dev/null`
|
83
83
|
raise "Path #{dst_path} not deleted" unless r.empty?
|
84
84
|
end
|
@@ -89,7 +89,7 @@ module FC
|
|
89
89
|
|
90
90
|
cmd = self.class.curr_host == host ?
|
91
91
|
"du -sb #{dst_path.shellescape}" :
|
92
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host}
|
92
|
+
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"du -sb #{dst_path.shellescape}\""
|
93
93
|
r = ignore_errors ? `#{cmd} 2>/dev/null` : `#{cmd} 2>&1`
|
94
94
|
raise r if $?.exitstatus != 0
|
95
95
|
r.to_i
|
data/lib/fc/version.rb
CHANGED
data/lib/manage/storages.rb
CHANGED
@@ -236,4 +236,22 @@ def make_storages_sync(storage, make_delete, silent = false)
|
|
236
236
|
count = `find #{storage.path.shellescape} -empty -type d`.split("\n").count
|
237
237
|
`find #{storage.path.shellescape} -empty -type d -delete` if make_delete
|
238
238
|
puts "Deleted #{count} empty folders" unless silent
|
239
|
+
|
240
|
+
if (ARGV[3])
|
241
|
+
File.open(ARGV[3], 'w') do |file|
|
242
|
+
delete_files.each do |f|
|
243
|
+
file.puts storage.path+f
|
244
|
+
end
|
245
|
+
end
|
246
|
+
puts "Save deleted files to #{ARGV[3]}" unless silent
|
247
|
+
end
|
248
|
+
|
249
|
+
if (ARGV[4])
|
250
|
+
File.open(ARGV[4], 'w') do |file|
|
251
|
+
db_items.values.each do |item|
|
252
|
+
file.puts item[1] if !item[0] && item[1]
|
253
|
+
end
|
254
|
+
end
|
255
|
+
puts "Save deleted items_storages to #{ARGV[4]}" unless silent
|
256
|
+
end
|
239
257
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filecluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-readline
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
segments:
|
194
194
|
- 0
|
195
|
-
hash:
|
195
|
+
hash: -3823121111064236338
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
none: false
|
198
198
|
requirements:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash:
|
204
|
+
hash: -3823121111064236338
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
207
|
rubygems_version: 1.8.24
|