sambal 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b315fa4d349b1e6fc99fce348c825260afdec5e
4
- data.tar.gz: e83a5ecd892da523b93b2db62e6e850113de682f
3
+ metadata.gz: 3c4274c002052cc5617a22cf418b4111806789e4
4
+ data.tar.gz: c59a923920657398db1380f9d8c52882fe7258d2
5
5
  SHA512:
6
- metadata.gz: 4c3dbced2ab1574ab38a4e6a0ac23f9c762cd6372a4bcd5f8e901a4276e8f7b04d49ef55a8ac8208ce2a7c36ce82becc03bfc43370ea64d880774935928be178
7
- data.tar.gz: a238eac084d85cda8d13384660769033cb4c669f6e7e3ed37634bb8fa4f4bdf4cf1f56e80c7af1f1b0139ead241f13a570295c39025f3ad35fd0965eadb04c4f
6
+ metadata.gz: 29fd6e3b5d317456566266fb63137b75ecf92da195f9cd19e807b48f954fb5413491e46a2834607ca4dd460c511fad71df6a5d3001932240c35d9023dac64c29
7
+ data.tar.gz: 743d8226678ff987da7f5c22343b676423c65ce9c1b8fb4a1be96727a9f97bf4762b6f7ee3e7910fc0f967bfd76a030df52909c558379fdc8a4a24312841535d
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module Sambal
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/sambal.rb CHANGED
@@ -44,11 +44,12 @@ module Sambal
44
44
 
45
45
  def initialize(options={})
46
46
  begin
47
- options = {domain: 'WORKGROUP', host: '127.0.0.1', share: '', user: 'guest', password: '--no-pass', port: 445}.merge(options)
47
+ options = {domain: 'WORKGROUP', host: '127.0.0.1', share: '', user: 'guest', password: '--no-pass', port: 445, timeout: 10}.merge(options)
48
+ @timeout = options[:timeout].to_i
48
49
  @o, @i, @pid = PTY.spawn("smbclient \"//#{options[:host]}/#{options[:share]}\" \"#{options[:password]}\" -W \"#{options[:domain]}\" -U \"#{options[:user]}\" -p #{options[:port]}")
49
50
  #@o.set_encoding('UTF-8:UTF-8') ## don't know didn't work, we only have this problem when the files are named using non-english characters
50
51
  #@i.set_encoding('UTF-8:UTF-8')
51
- res = @o.expect(/(.*\n)?smb:.*\\>/, 10)[0] rescue nil
52
+ res = @o.expect(/(.*\n)?smb:.*\\>/, @timeout)[0] rescue nil
52
53
  @connected = case res
53
54
  when nil
54
55
  $stderr.puts "Failed to connect"
@@ -234,7 +235,7 @@ module Sambal
234
235
 
235
236
  def ask(cmd)
236
237
  @i.printf("#{cmd}\n")
237
- response = @o.expect(/^smb:.*\\>/,10)[0] rescue nil
238
+ response = @o.expect(/^smb:.*\\>/,@timeout)[0] rescue nil
238
239
  if response.nil?
239
240
  $stderr.puts "Failed to do #{cmd}"
240
241
  raise Exception.new, "Failed to do #{cmd}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Axel Eriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec