sambala 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sambala.rb +6 -6
- data/lib/sambala_gardener.rb +2 -0
- metadata +1 -1
data/lib/sambala.rb
CHANGED
@@ -71,7 +71,7 @@ class Sambala
|
|
71
71
|
def initialize(options={:domain => '', :host => '', :share => '', :user => '', :password => '', :threads => 1})
|
72
72
|
begin
|
73
73
|
options[:threads] = 4 if options[:threads] > 4
|
74
|
-
options[:init_timeout] = options[:threads]
|
74
|
+
options[:init_timeout] = options[:threads]
|
75
75
|
@options = options; gardener_ok
|
76
76
|
rescue
|
77
77
|
@gardener.close unless @gardener.nil? || @gardener.class != 'Gardener'
|
@@ -135,8 +135,8 @@ class Sambala
|
|
135
135
|
# === Example
|
136
136
|
# samba.get(:from => 'aFile.txt') # => [true, "getting file \\aFile.txt.rb of size 3877 as test.rb (99.6 kb/s) (average 89.9 kb/s)\r\n"]
|
137
137
|
def get(opts={:from => nil, :to => nil, :queue => false})
|
138
|
-
opts[:to].nil? ? strng = opts[:from] : strng = opts[:from] + ' ' + opts[:to]
|
139
|
-
execute('get',
|
138
|
+
opts[:to].nil? ? strng = opts[:from] : strng = clean_path(opts[:from]) + ' ' + opts[:to]
|
139
|
+
execute('get', strng, opts[:queue])
|
140
140
|
end
|
141
141
|
|
142
142
|
# The +lcd+ instance method changes the current working directory on the local machine to the directory specified.
|
@@ -147,7 +147,7 @@ class Sambala
|
|
147
147
|
# === Example
|
148
148
|
# samba.lcd('aLocalFolder/anOtherFolder/') # => true
|
149
149
|
def lcd(to='.')
|
150
|
-
execute_all('lcd',
|
150
|
+
execute_all('lcd', to)
|
151
151
|
end
|
152
152
|
|
153
153
|
# The +lowercase+ method toggles lowercasing of filenames for the get command.
|
@@ -236,8 +236,8 @@ class Sambala
|
|
236
236
|
# samba.put(:from => 'aLocalFile.txt') # => [false, "aLocalFile.txt does not exist\r\n"]
|
237
237
|
|
238
238
|
def put(opts={:from => nil, :to => nil, :queue => false})
|
239
|
-
opts[:to].nil? ? strng = opts[:from] : strng = opts[:from] + ' ' + opts[:to]
|
240
|
-
execute('put' ,
|
239
|
+
opts[:to].nil? ? strng = opts[:from] : strng = opts[:from] + ' ' + clean_path(opts[:to])
|
240
|
+
execute('put' , strng, opts[:queue])
|
241
241
|
end
|
242
242
|
|
243
243
|
# The +recurse+ method toggles directory recursion
|
data/lib/sambala_gardener.rb
CHANGED
@@ -85,9 +85,11 @@ class Sambala
|
|
85
85
|
init.map! { |result| result[:success] }
|
86
86
|
throw :gardener if init.uniq.size == 1 and init[0] == true
|
87
87
|
rescue Timeout::Error
|
88
|
+
$! = "Slugish Network or Server?"
|
88
89
|
end
|
89
90
|
kill_gardener_and_incr
|
90
91
|
end
|
92
|
+
$! = "All Attemps Failed, Gardener could not be initiated" if $!.nil?
|
91
93
|
raise SmbInitError.exception("Couldn't set smbclient properly (#{$!.to_s})")
|
92
94
|
end
|
93
95
|
@posix_support = posix?(@init_status[0][:message])
|