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 +4 -4
- data/lib/sambal/version.rb +1 -1
- data/lib/sambal.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c4274c002052cc5617a22cf418b4111806789e4
|
|
4
|
+
data.tar.gz: c59a923920657398db1380f9d8c52882fe7258d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29fd6e3b5d317456566266fb63137b75ecf92da195f9cd19e807b48f954fb5413491e46a2834607ca4dd460c511fad71df6a5d3001932240c35d9023dac64c29
|
|
7
|
+
data.tar.gz: 743d8226678ff987da7f5c22343b676423c65ce9c1b8fb4a1be96727a9f97bf4762b6f7ee3e7910fc0f967bfd76a030df52909c558379fdc8a4a24312841535d
|
data/lib/sambal/version.rb
CHANGED
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:.*\\>/,
|
|
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
|
|
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
|
+
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-
|
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|