sambal 0.2.1 → 0.2.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.
- checksums.yaml +4 -4
- data/.envrc +1 -0
- data/Jenkinsfile +34 -0
- data/README.md +4 -3
- data/default.nix +6 -0
- data/lib/sambal/client.rb +1 -1
- data/lib/sambal/test_server.rb +3 -3
- data/lib/sambal/version.rb +1 -1
- metadata +6 -4
- data/circle.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a50e0a519bdbc0ab8cccb0116250c2b073e5e305a906d9f46fac5012dc11814
|
4
|
+
data.tar.gz: 71ac3f8493eae53b548a0e58a207e38034615af0f0d915956d50ab338b5bc16e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e14f217b9d83deceae6bd11a17d94ce17ca59800850031a0d57d416fe5f1f1431a0de3b8c9d9e8a3f4b4695f9d4e16b15fa2e2cbb808cf16ba409ad60dc67d3
|
7
|
+
data.tar.gz: ba2eb773c39c1dccfd4b71dbe2b184f453b17cf02690124d010d30d18d3456e4976a7d33f5b11bacda7c192882d1336b686f859ca0147a736ac0a9ff8191ede4
|
data/.envrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
use_nix
|
data/Jenkinsfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/groovy
|
2
|
+
|
3
|
+
def hasCmd(cmd) { "command -v ${cmd} >/dev/null 2>&1" }
|
4
|
+
|
5
|
+
def shell(cmd) {
|
6
|
+
def nixInitPath = '$HOME/.nix-profile/etc/profile.d/nix.sh'
|
7
|
+
sh """
|
8
|
+
if ! ${hasCmd('nix-shell')}; then
|
9
|
+
if [ -e ${nixInitPath} ]; then
|
10
|
+
. ${nixInitPath}
|
11
|
+
else
|
12
|
+
curl https://nixos.org/nix/install | sh
|
13
|
+
. ${nixInitPath}
|
14
|
+
fi
|
15
|
+
fi
|
16
|
+
${cmd}
|
17
|
+
"""
|
18
|
+
}
|
19
|
+
|
20
|
+
def nixShell(cmd) { shell """ nix-shell --run "${cmd}" """ }
|
21
|
+
|
22
|
+
node('linux') {
|
23
|
+
stage("Prerequisites") { shell """ nix-env -iA nixpkgs.git """ }
|
24
|
+
|
25
|
+
stage("Checkout") { checkout scm }
|
26
|
+
|
27
|
+
stage("Setup") { nixShell '''
|
28
|
+
bundle install
|
29
|
+
mkdir -p /tmp/sambal-temp-path
|
30
|
+
'''
|
31
|
+
}
|
32
|
+
|
33
|
+
stage("Test") { nixShell "SAMBAL_TEMP_PATH=/tmp/sambal-temp-path bundle exec rspec" }
|
34
|
+
}
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://ci.insane.se/job/sambal/job/master/)
|
2
2
|
|
3
3
|
# Sambal
|
4
4
|
|
@@ -27,14 +27,15 @@ On a mac this can be installed through homebrew https://github.com/mxcl/homebrew
|
|
27
27
|
|
28
28
|
brew install samba
|
29
29
|
|
30
|
-
On the Mac it can probably also be installed both through Fink and MacPorts.
|
31
|
-
|
32
30
|
On Linux (Ubuntu) it's as easy as:
|
33
31
|
|
34
32
|
apt-get install smbclient
|
35
33
|
|
36
34
|
It should be available in a similar way on all major Linux distributions.
|
37
35
|
|
36
|
+
If you happen to be running [NixOS](https://nixos.org/) or at least the [Nix package manager](https://nixos.org/nix/download.html) you could just
|
37
|
+
use the `default.nix` file in this repo. That should also set you up for running the tests (which require samba).
|
38
|
+
|
38
39
|
## Usage
|
39
40
|
|
40
41
|
client = Sambal::Client.new(domain: 'WORKGROUP', host: '127.0.0.1', share: '', user: 'guest', password: '--no-pass', port: 445)
|
data/default.nix
ADDED
data/lib/sambal/client.rb
CHANGED
data/lib/sambal/test_server.rb
CHANGED
@@ -39,7 +39,7 @@ module Sambal
|
|
39
39
|
@erb_path = "#{File.expand_path(File.dirname(__FILE__))}/smb.conf.erb"
|
40
40
|
@host = "127.0.0.1" ## will always just be localhost
|
41
41
|
@root_path = File.expand_path(File.dirname(File.dirname(File.dirname(__FILE__))))
|
42
|
-
@tmp_path = "#{root_path}/spec_tmp"
|
42
|
+
@tmp_path = ENV.key?('SAMBAL_TEMP_PATH') ? ENV['SAMBAL_TEMP_PATH'] : "#{root_path}/spec_tmp"
|
43
43
|
@share_path = "#{tmp_path}/share"
|
44
44
|
@share_name = share_name
|
45
45
|
@config_path = "#{tmp_path}/smb.conf"
|
@@ -71,11 +71,11 @@ module Sambal
|
|
71
71
|
def start
|
72
72
|
if RUBY_PLATFORM=="java"
|
73
73
|
@smb_server_pid = Thread.new do
|
74
|
-
`smbd -S -F -s #{@config_path} -p #{@port} --option="lockdir"=#{@lock_path} --option="pid directory"=#{@pid_dir} --option="private directory"=#{@private_dir} --option="cache directory"=#{@cache_dir} --option="state directory"=#{@state_dir} > #{@log_path}/smb.log`
|
74
|
+
`smbd -S -F -s #{@config_path} -p #{@port} --option="lockdir"=#{@lock_path} --option="pid directory"=#{@pid_dir} --option="private directory"=#{@private_dir} --option="cache directory"=#{@cache_dir} --option="state directory"=#{@state_dir} < /dev/null > #{@log_path}/smb.log`
|
75
75
|
end
|
76
76
|
else
|
77
77
|
@smb_server_pid = fork do
|
78
|
-
|
78
|
+
exec "smbd -S -F -s #{@config_path} -p #{@port} --option=\"lockdir\"=#{@lock_path} --option=\"pid directory\"=#{@pid_dir} --option=\"private directory\"=#{@private_dir} --option=\"cache directory\"=#{@cache_dir} --option=\"state directory\"=#{@state_dir} < /dev/null > #{@log_path}/smb.log"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
sleep 2 ## takes a short time to start up
|
data/lib/sambal/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.2
|
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: 2018-
|
11
|
+
date: 2018-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -31,13 +31,15 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".envrc"
|
34
35
|
- ".gitignore"
|
35
36
|
- Gemfile
|
37
|
+
- Jenkinsfile
|
36
38
|
- LICENSE
|
37
39
|
- README.md
|
38
40
|
- Rakefile
|
39
41
|
- Spookfile
|
40
|
-
-
|
42
|
+
- default.nix
|
41
43
|
- lib/sambal.rb
|
42
44
|
- lib/sambal/client.rb
|
43
45
|
- lib/sambal/response.rb
|
@@ -66,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
68
|
version: '0'
|
67
69
|
requirements: []
|
68
70
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.7.
|
71
|
+
rubygems_version: 2.7.7
|
70
72
|
signing_key:
|
71
73
|
specification_version: 4
|
72
74
|
summary: Ruby Samba Client
|
data/circle.yml
DELETED