sambal 0.2.3 → 0.2.4
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/README.md +6 -2
 - data/lib/sambal/client.rb +7 -7
 - data/lib/sambal/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6c823f0d8de2bf8123f6eca3b6b30b5886a73e525319abe6293c84e326d57751
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5b37db63b852ee0ee9ae04b0ff2cd547a5e002ae7ce46b4bff0c93643a2f099e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3d980269e1dbe721c4cd6915e2999dc0e7c86827798302400a35ce2c4ff9bf8e95c59465eb30113fb34e4c150f468334175d9a90ed2eaf370dc65fc0540f9717
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b8d926be2d6e28c2429625e2a576994e459968d096b50cf4af822c3a0e31db11ee1129d236f6e271e8473a1378fba4c8083368a976d9348425e7da108ed41c74
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            # Sambal
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
         @@ -34,7 +34,11 @@ On Linux (Ubuntu) it's as easy as: 
     | 
|
| 
       34 
34 
     | 
    
         
             
            It should be available in a similar way on all major Linux distributions.
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
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 ` 
     | 
| 
      
 37 
     | 
    
         
            +
            use the `flake.nix` file in this repo. That should also set you up for running the tests (which require samba). Something like this:
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                nix develop
         
     | 
| 
      
 40 
     | 
    
         
            +
                bundle install
         
     | 
| 
      
 41 
     | 
    
         
            +
                bundle exec rspec
         
     | 
| 
       38 
42 
     | 
    
         | 
| 
       39 
43 
     | 
    
         
             
            ## Usage
         
     | 
| 
       40 
44 
     | 
    
         | 
    
        data/lib/sambal/client.rb
    CHANGED
    
    | 
         @@ -44,7 +44,7 @@ module Sambal 
     | 
|
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
                    @output, @input, @pid = PTY.spawn(command[0], *command[1..-1])
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                    res = @output.expect(/ 
     | 
| 
      
 47 
     | 
    
         
            +
                    res = @output.expect(/smb:.*\\>/, @timeout)[0] rescue nil
         
     | 
| 
       48 
48 
     | 
    
         
             
                    @connected = case res
         
     | 
| 
       49 
49 
     | 
    
         
             
                    when nil
         
     | 
| 
       50 
50 
     | 
    
         
             
                      false
         
     | 
| 
         @@ -116,7 +116,7 @@ module Sambal 
     | 
|
| 
       116 
116 
     | 
    
         
             
                  begin
         
     | 
| 
       117 
117 
     | 
    
         
             
                    file_context(filename) do |file|
         
     | 
| 
       118 
118 
     | 
    
         
             
                      response = ask_wrapped 'get', [file, output]
         
     | 
| 
       119 
     | 
    
         
            -
                      if response =~  
     | 
| 
      
 119 
     | 
    
         
            +
                      if response =~ /getting\sfile.*$/
         
     | 
| 
       120 
120 
     | 
    
         
             
                        Response.new(response, true)
         
     | 
| 
       121 
121 
     | 
    
         
             
                      else
         
     | 
| 
       122 
122 
     | 
    
         
             
                        Response.new(response, false)
         
     | 
| 
         @@ -140,7 +140,7 @@ module Sambal 
     | 
|
| 
       140 
140 
     | 
    
         | 
| 
       141 
141 
     | 
    
         
             
                def put(file, destination)
         
     | 
| 
       142 
142 
     | 
    
         
             
                  response = ask_wrapped 'put', [file, destination]
         
     | 
| 
       143 
     | 
    
         
            -
                  if response =~  
     | 
| 
      
 143 
     | 
    
         
            +
                  if response =~ /putting\sfile.*$/
         
     | 
| 
       144 
144 
     | 
    
         
             
                    Response.new(response, true)
         
     | 
| 
       145 
145 
     | 
    
         
             
                  else
         
     | 
| 
       146 
146 
     | 
    
         
             
                    Response.new(response, false)
         
     | 
| 
         @@ -155,7 +155,7 @@ module Sambal 
     | 
|
| 
       155 
155 
     | 
    
         
             
                    f << content
         
     | 
| 
       156 
156 
     | 
    
         
             
                  end
         
     | 
| 
       157 
157 
     | 
    
         
             
                  response = ask_wrapped 'put', [t.path, destination]
         
     | 
| 
       158 
     | 
    
         
            -
                  if response =~  
     | 
| 
      
 158 
     | 
    
         
            +
                  if response =~ /putting\sfile.*$/
         
     | 
| 
       159 
159 
     | 
    
         
             
                    Response.new(response, true)
         
     | 
| 
       160 
160 
     | 
    
         
             
                  else
         
     | 
| 
       161 
161 
     | 
    
         
             
                    Response.new(response, false)
         
     | 
| 
         @@ -191,7 +191,7 @@ module Sambal 
     | 
|
| 
       191 
191 
     | 
    
         
             
                    cd '..'
         
     | 
| 
       192 
192 
     | 
    
         
             
                    response = ask_wrapped 'rmdir', dir
         
     | 
| 
       193 
193 
     | 
    
         
             
                    next_line = response.split("\n")[1]
         
     | 
| 
       194 
     | 
    
         
            -
                    if next_line =~  
     | 
| 
      
 194 
     | 
    
         
            +
                    if next_line =~ /smb:.*\\>/
         
     | 
| 
       195 
195 
     | 
    
         
             
                      Response.new(response, true)
         
     | 
| 
       196 
196 
     | 
    
         
             
                    else
         
     | 
| 
       197 
197 
     | 
    
         
             
                      Response.new(response, false)
         
     | 
| 
         @@ -206,7 +206,7 @@ module Sambal 
     | 
|
| 
       206 
206 
     | 
    
         
             
                    file_context(filename) do |file|
         
     | 
| 
       207 
207 
     | 
    
         
             
                      response = ask_wrapped 'del', file
         
     | 
| 
       208 
208 
     | 
    
         
             
                      next_line = response.split("\n")[1]
         
     | 
| 
       209 
     | 
    
         
            -
                      if next_line =~  
     | 
| 
      
 209 
     | 
    
         
            +
                      if next_line =~ /smb:.*\\>/
         
     | 
| 
       210 
210 
     | 
    
         
             
                      Response.new(response, true)
         
     | 
| 
       211 
211 
     | 
    
         
             
                      #elsif next_line =~ /^NT_STATUS_NO_SUCH_FILE.*$/
         
     | 
| 
       212 
212 
     | 
    
         
             
                      #  Response.new(response, false)
         
     | 
| 
         @@ -255,7 +255,7 @@ module Sambal 
     | 
|
| 
       255 
255 
     | 
    
         
             
                def ask(cmd)
         
     | 
| 
       256 
256 
     | 
    
         
             
                  @input.print("#{cmd}\n")
         
     | 
| 
       257 
257 
     | 
    
         
             
                  response = begin
         
     | 
| 
       258 
     | 
    
         
            -
                               @output.expect( 
     | 
| 
      
 258 
     | 
    
         
            +
                               @output.expect(/smb:.*\\>/,@timeout)[0]
         
     | 
| 
       259 
259 
     | 
    
         
             
                             rescue => e
         
     | 
| 
       260 
260 
     | 
    
         
             
                               $stderr.puts e
         
     | 
| 
       261 
261 
     | 
    
         
             
                               nil
         
     | 
    
        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.4
         
     | 
| 
       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: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-12-19 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rspec
         
     |