filecluster 0.4.1 → 0.4.2
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/fc/item.rb +7 -1
- data/lib/fc/storage.rb +7 -7
- data/lib/fc/version.rb +1 -1
- metadata +3 -3
data/lib/fc/item.rb
CHANGED
@@ -99,7 +99,13 @@ module FC
|
|
99
99
|
item_storage.status = 'ready'
|
100
100
|
item_storage.save
|
101
101
|
reload
|
102
|
-
|
102
|
+
if remove_local && !src.instance_of?(FC::Storage) && File.exists?(src)
|
103
|
+
if File.directory?
|
104
|
+
Dir.delete(src)
|
105
|
+
else
|
106
|
+
File.delete(src)
|
107
|
+
end
|
108
|
+
end
|
103
109
|
end
|
104
110
|
end
|
105
111
|
end
|
data/lib/fc/storage.rb
CHANGED
@@ -67,14 +67,14 @@ module FC
|
|
67
67
|
dst_path = "#{self.path}#{file_name}"
|
68
68
|
|
69
69
|
cmd = "rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}"
|
70
|
-
cmd = self.class.curr_host == host ? cmd : "ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"#{cmd}\""
|
70
|
+
cmd = self.class.curr_host == host ? cmd : "ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"#{cmd}\""
|
71
71
|
r = `#{cmd} 2>&1`
|
72
72
|
raise r if $?.exitstatus != 0
|
73
73
|
|
74
74
|
op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'
|
75
75
|
cmd = self.class.curr_host == host ?
|
76
76
|
"#{op} #{local_path.shellescape} #{dst_path.shellescape}" :
|
77
|
-
"scp -r -oBatchMode=yes -oStrictHostKeyChecking=no #{local_path.shellescape} #{self.host}:\"#{dst_path.shellescape}\""
|
77
|
+
"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{local_path.shellescape} #{self.host}:\"#{dst_path.shellescape}\""
|
78
78
|
r = `#{cmd} 2>&1`
|
79
79
|
raise r if $?.exitstatus != 0
|
80
80
|
end
|
@@ -88,7 +88,7 @@ module FC
|
|
88
88
|
|
89
89
|
cmd = self.class.curr_host == host ?
|
90
90
|
"cp -r #{src_path.shellescape} #{local_path.shellescape}" :
|
91
|
-
"scp -r -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host}:\"#{src_path.shellescape}\" #{local_path.shellescape}"
|
91
|
+
"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host}:\"#{src_path.shellescape}\" #{local_path.shellescape}"
|
92
92
|
r = `#{cmd} 2>&1`
|
93
93
|
raise r if $?.exitstatus != 0
|
94
94
|
end
|
@@ -98,13 +98,13 @@ module FC
|
|
98
98
|
dst_path = "#{self.path}#{file_name}"
|
99
99
|
cmd = self.class.curr_host == host ?
|
100
100
|
"rm -rf #{dst_path.shellescape}" :
|
101
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"rm -rf #{dst_path.shellescape}\""
|
101
|
+
"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"rm -rf #{dst_path.shellescape}\""
|
102
102
|
r = `#{cmd} 2>&1`
|
103
103
|
raise r if $?.exitstatus != 0
|
104
104
|
|
105
105
|
cmd = self.class.curr_host == host ?
|
106
106
|
"ls -la #{dst_path.shellescape}" :
|
107
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"ls -la #{dst_path.shellescape}\""
|
107
|
+
"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"ls -la #{dst_path.shellescape}\""
|
108
108
|
r = `#{cmd} 2>/dev/null`
|
109
109
|
raise "Path #{dst_path} not deleted" unless r.empty?
|
110
110
|
end
|
@@ -115,7 +115,7 @@ module FC
|
|
115
115
|
|
116
116
|
cmd = self.class.curr_host == host ?
|
117
117
|
"du -sb #{dst_path.shellescape}" :
|
118
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"du -sb #{dst_path.shellescape}\""
|
118
|
+
"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"du -sb #{dst_path.shellescape}\""
|
119
119
|
r = ignore_errors ? `#{cmd} 2>/dev/null` : `#{cmd} 2>&1`
|
120
120
|
raise r if $?.exitstatus != 0
|
121
121
|
r.to_i
|
@@ -126,7 +126,7 @@ module FC
|
|
126
126
|
dst_path = "#{self.path}#{file_name}"
|
127
127
|
cmd = self.class.curr_host == host ?
|
128
128
|
"find #{dst_path.shellescape} -type f -exec md5sum {} \\; | awk '{print $1}' | sort | md5sum" :
|
129
|
-
"ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"find #{dst_path.shellescape} -type f -exec md5sum {} \\; | awk '{print \\$1}' | sort | md5sum\""
|
129
|
+
"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"find #{dst_path.shellescape} -type f -exec md5sum {} \\; | awk '{print \\$1}' | sort | md5sum\""
|
130
130
|
r = `#{cmd} 2>&1`
|
131
131
|
raise r if $?.exitstatus != 0
|
132
132
|
r.to_s[0..31]
|
data/lib/fc/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 94678285960030617
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
none: false
|
187
187
|
requirements:
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
segments:
|
192
192
|
- 0
|
193
|
-
hash:
|
193
|
+
hash: 94678285960030617
|
194
194
|
requirements: []
|
195
195
|
rubyforge_project:
|
196
196
|
rubygems_version: 1.8.24
|