sambala 0.9.6 → 0.9.7

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.
@@ -84,7 +84,7 @@ class Sambala
84
84
  # === Example
85
85
  # samba.cd('aFolder/anOtherFolder/') # => true
86
86
  def cd(to='.')
87
- execute_all('cd',clean_path(to))
87
+ execute('cd',clean_path(to))[0]
88
88
  end
89
89
 
90
90
  # The +du+ instance method does exactly what _du_ usually does: estimates file space usage.
@@ -144,7 +144,7 @@ class Sambala
144
144
  # === Example
145
145
  # samba.lcd('aLocalFolder/anOtherFolder/') # => true
146
146
  def lcd(to='.')
147
- execute_all('lcd', to)
147
+ execute('lcd', to)[0]
148
148
  end
149
149
 
150
150
  # The +lowercase+ method toggles lowercasing of filenames for the get command.
@@ -155,7 +155,7 @@ class Sambala
155
155
  # === Example
156
156
  # samba.lowercase # => true # toggle from files all UPPERCASE to all lowercase
157
157
  def lowercase
158
- execute_all('lowercase' ,'')
158
+ execute('lowercase' ,'')[0]
159
159
  end
160
160
 
161
161
  # The method +ls+ or its alias _dir_, list the files and directories matching :mask in the current working directory on the smb server.
@@ -179,7 +179,7 @@ class Sambala
179
179
  # === Example
180
180
  # samba.mask('filter*') # => true
181
181
  def mask(mask)
182
- execute_all('mask' ,mask)
182
+ execute('mask' ,mask)[0]
183
183
  end
184
184
 
185
185
  # The +mget+ method copy all files matching :mask from the server to the client machine
@@ -244,7 +244,7 @@ class Sambala
244
244
  # === Example
245
245
  # samba.recurse # => true
246
246
  def recurse
247
- execute_all('recurse' ,'')
247
+ execute('recurse' ,'')[0]
248
248
  end
249
249
 
250
250
  # The +rmdir+ method deletes the specified directory
@@ -33,23 +33,9 @@ class Sambala
33
33
  # * _queue_ = the command operation mode
34
34
  # === Example
35
35
  # result = execute('cd','dir/otherDir*',false) # => true
36
- def execute(command,data,queue)
36
+ def execute(command,data,queue=false)
37
37
  (queue.is_a? TrueClass) ? exec_queue(command,data) : exec_interactive(command,data)
38
38
  end
39
-
40
- # The +execute_all+ method does a special command invocation where all smbclient workers running in parallel
41
- # are all sent the same command. The method returns one boolean value for all workers success.
42
- # === Parameters
43
- # * _command_ = the command as a string
44
- # * _data_ = the command argument as a string
45
- # === Example
46
- # result = execute_all('mask','match*') # => true
47
- def execute_all(command,data)
48
- result = @gardener.seed_all("#{command} #{data}")
49
- $log_sambala.debug("execute_all result") {"#{result.inspect}"}
50
- bools = result.map { |row| row[:success] }
51
- bools.uniq.size == 1 ? true : false
52
- end
53
39
 
54
40
  # The +exec_interactive+ method follows +execute+ when queue=false.
55
41
  # === Parameters
@@ -20,7 +20,7 @@ TITLE
20
20
  class TestSambalaMain < Test::Unit::TestCase
21
21
 
22
22
  def setup
23
- @log_test = GlobaLog.logger(STDERR,:info)
23
+ @log_test = GlobaLog.logger(STDERR,:info,true)
24
24
  check_smbclient_presence
25
25
  get_samba_param_from_input
26
26
  init_sambala
@@ -173,7 +173,7 @@ class TestSambalaMain < Test::Unit::TestCase
173
173
  end
174
174
 
175
175
  def check_queue
176
- jobs = 20
176
+ jobs = 30
177
177
  @log_test.info("Testing queue... (be patient, this will take a couple minutes)")
178
178
  assert_equal(true, @samba.queue_empty?)
179
179
  assert_equal(true, @samba.queue_done?)
@@ -201,6 +201,12 @@ class TestSambalaMain < Test::Unit::TestCase
201
201
  result = @samba.queue_processing
202
202
  @log_test.debug("queue processing result is: #{result.inspect}")
203
203
  assert_kind_of(Array,result)
204
+ 301.times do |n|
205
+ break unless result[0].nil?
206
+ sleep 1
207
+ result = @samba.queue_completed
208
+ flunk("Could not get any queue done...") if n == 300
209
+ end
204
210
  assert_kind_of(Array,result[0])
205
211
  assert_equal(2,result[0].size)
206
212
  assert_kind_of(Integer,result[0][0])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambala
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis-Philippe Perron