drb_fileclient 0.8.0 → 0.8.1
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
- checksums.yaml.gz.sig +3 -1
- data/lib/drb_fileclient.rb +35 -78
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 07a2cbcbbc70f014fa750685abf3a553e1d904873aba2c58b979b9178c1ab8e8
         | 
| 4 | 
            +
              data.tar.gz: 0c6ea77a2ce0c463a4ecc39a1c735f5b91645e917b1208d7e43258c9db096fd0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 33d3c8869c4228aa4bfd05e2b488d1606110bd3db7634f995d978cc132b3189124b13c5d301064a1f8844e9243c12685183456d12e87bd335eec5da8ee1a7105
         | 
| 7 | 
            +
              data.tar.gz: b75e6e463ed540df983fd10d655fa8bfeea7ad2072701c688b4278e224aa87fb74a1e242f2e87ff698a68f9a2393094ac7722620858862e434a4ae6ebb1d03dd
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | @@ -1 +1,3 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            ��IJ����'y���Q������2�(`0m)h"�^A��lT�h��$!6��11R�Xp�^��_TV��V[g���.��:�cN���s	� 8�Mt#pEB�C}���}��Au�	J�	�ez4�0�����*O6�[ȍf9Z������o�n���eY�l]e�.���*=�E������p����
         | 
| 2 | 
            +
            	�nzSWo��
         | 
| 3 | 
            +
            �'x�����r%�/�`"�5�P0�s0v�#�
         | 
    
        data/lib/drb_fileclient.rb
    CHANGED
    
    | @@ -10,32 +10,13 @@ require 'drb_fileclient-readwrite' | |
| 10 10 | 
             
            class DRbFileClient < DRbFileClientReadWrite
         | 
| 11 11 | 
             
              using ColouredText
         | 
| 12 12 |  | 
| 13 | 
            -
              def chdir(raw_path)
         | 
| 14 | 
            -
             | 
| 15 | 
            -
                return Dir.chdir raw_path unless @directory or raw_path =~ /^dfs:\/\//
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                if raw_path[0] == '/'  then
         | 
| 18 | 
            -
                  directory = raw_path[1..-1]
         | 
| 19 | 
            -
                elsif raw_path =~ /^dfs:\/\//
         | 
| 20 | 
            -
                  @file, directory = parse_path(raw_path)
         | 
| 21 | 
            -
                else
         | 
| 22 | 
            -
                  directory = File.join(@directory, raw_path)
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                if @file.exists? directory then
         | 
| 26 | 
            -
                  @directory = directory
         | 
| 27 | 
            -
                else
         | 
| 28 | 
            -
                  'No such file or directory'
         | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
              end
         | 
| 32 13 |  | 
| 33 14 | 
             
              def chmod(permissions, raw_path)
         | 
| 34 15 |  | 
| 35 16 | 
             
                if raw_path =~ /^dfs:\/\// then
         | 
| 36 17 |  | 
| 37 | 
            -
                   | 
| 38 | 
            -
                   | 
| 18 | 
            +
                  @@file, path = parse_path(raw_path)
         | 
| 19 | 
            +
                  @@file.chmod permissions, path
         | 
| 39 20 |  | 
| 40 21 | 
             
                else
         | 
| 41 22 | 
             
                  return FileUtils.chmod(permissions, raw_path)
         | 
| @@ -56,26 +37,26 @@ class DRbFileClient < DRbFileClientReadWrite | |
| 56 37 | 
             
                  if raw_path[/^dfs:\/\/([^\/]+)/] == raw_path2[/^dfs:\/\/([^\/]+)/] then
         | 
| 57 38 |  | 
| 58 39 | 
             
                    _, path = parse_path(raw_path)
         | 
| 59 | 
            -
                     | 
| 60 | 
            -
                     | 
| 40 | 
            +
                    @@file, path2 = parse_path(raw_path2)
         | 
| 41 | 
            +
                    @@file.cp path, path2
         | 
| 61 42 |  | 
| 62 43 | 
             
                  elsif raw_path2[/^dfs:\/\//]
         | 
| 63 44 |  | 
| 64 | 
            -
                     | 
| 45 | 
            +
                    @@file, path = parse_path(raw_path)
         | 
| 65 46 | 
             
                    file2, path2 = parse_path(raw_path2)
         | 
| 66 47 | 
             
                    puts ('path: ' + path.inspect).debug if @debug
         | 
| 67 48 | 
             
                    puts ('path2: ' + path.inspect).debug if @debug
         | 
| 68 | 
            -
                    content =  | 
| 49 | 
            +
                    content = @@file.read path
         | 
| 69 50 |  | 
| 70 51 | 
             
                    file2.write path2, content
         | 
| 71 52 |  | 
| 72 53 | 
             
                  else
         | 
| 73 54 |  | 
| 74 | 
            -
                     | 
| 55 | 
            +
                    @@file, path = parse_path(raw_path)
         | 
| 75 56 | 
             
                    #file2, path2 = parse_path(raw_path2)
         | 
| 76 57 | 
             
                    puts ('path: ' + path.inspect).debug if @debug
         | 
| 77 58 | 
             
                    puts ('path2: ' + path2.inspect).debug if @debug
         | 
| 78 | 
            -
                    content =  | 
| 59 | 
            +
                    content = @@file.read path
         | 
| 79 60 |  | 
| 80 61 | 
             
                    File.write raw_path2, content
         | 
| 81 62 |  | 
| @@ -98,104 +79,83 @@ class DRbFileClient < DRbFileClientReadWrite | |
| 98 79 |  | 
| 99 80 | 
             
              end
         | 
| 100 81 |  | 
| 101 | 
            -
              def directory?(filename=@filename)
         | 
| 102 | 
            -
             | 
| 103 | 
            -
                return File.directory? filename unless @directory or filename =~ /^dfs:\/\//
         | 
| 104 | 
            -
             | 
| 105 | 
            -
                if filename =~ /^dfs:\/\// then
         | 
| 106 | 
            -
                  @file, filename2 = parse_path(filename)
         | 
| 107 | 
            -
                else
         | 
| 108 | 
            -
             | 
| 109 | 
            -
                  filename2 = File.join(@directory, filename)
         | 
| 110 | 
            -
                end
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                @file.directory?(filename2)
         | 
| 113 | 
            -
             | 
| 114 | 
            -
              end
         | 
| 115 | 
            -
             | 
| 116 82 | 
             
              def ls(raw_path)
         | 
| 117 83 |  | 
| 118 | 
            -
                return Dir[raw_path] unless  | 
| 84 | 
            +
                return Dir[raw_path] unless @@directory or raw_path =~ /^dfs:\/\//
         | 
| 119 85 |  | 
| 120 86 | 
             
                if raw_path[0] == '/'  then
         | 
| 121 87 | 
             
                  path = raw_path[1..-1]
         | 
| 122 88 | 
             
                elsif raw_path =~ /^dfs:\/\//
         | 
| 123 | 
            -
                   | 
| 89 | 
            +
                  @@file, path = parse_path(raw_path)
         | 
| 124 90 | 
             
                else
         | 
| 125 | 
            -
                  path = File.join( | 
| 91 | 
            +
                  path = File.join(@@directory, raw_path)
         | 
| 126 92 | 
             
                end
         | 
| 127 93 |  | 
| 128 | 
            -
                 | 
| 94 | 
            +
                @@file.ls path
         | 
| 129 95 |  | 
| 130 96 | 
             
              end
         | 
| 131 97 |  | 
| 132 98 | 
             
              def mv(raw_path, raw_path2)
         | 
| 133 99 |  | 
| 134 | 
            -
                unless  | 
| 100 | 
            +
                unless @@directory or raw_path =~ /^dfs:\/\// then
         | 
| 135 101 | 
             
                  return FileUtils.mv raw_path, raw_path2
         | 
| 136 102 | 
             
                end
         | 
| 137 103 |  | 
| 138 104 | 
             
                if raw_path =~ /^dfs:\/\// then
         | 
| 139 105 | 
             
                  _, path = parse_path(raw_path)
         | 
| 140 106 | 
             
                else
         | 
| 141 | 
            -
                  path = File.join( | 
| 107 | 
            +
                  path = File.join(@@directory, raw_path)
         | 
| 142 108 | 
             
                end
         | 
| 143 109 |  | 
| 144 110 | 
             
                if raw_path2 =~ /^dfs:\/\// then
         | 
| 145 111 | 
             
                  _, path2 = parse_path(raw_path2)
         | 
| 146 112 | 
             
                else
         | 
| 147 | 
            -
                  path2 = File.join( | 
| 113 | 
            +
                  path2 = File.join(@@directory, raw_path2)
         | 
| 148 114 | 
             
                end
         | 
| 149 115 |  | 
| 150 | 
            -
                 | 
| 116 | 
            +
                @@file.mv path, path2
         | 
| 151 117 | 
             
              end
         | 
| 152 118 |  | 
| 153 | 
            -
              def pwd()
         | 
| 154 119 |  | 
| 155 | 
            -
                return Dir.pwd unless @directory
         | 
| 156 | 
            -
             | 
| 157 | 
            -
                '/' + @directory if @file
         | 
| 158 | 
            -
             | 
| 159 | 
            -
              end
         | 
| 160 120 |  | 
| 161 121 | 
             
              def ru(path)
         | 
| 162 122 |  | 
| 163 | 
            -
                return DirToXML.new(path, verbose: false).latest unless  | 
| 123 | 
            +
                return DirToXML.new(path, verbose: false).latest unless @@directory \
         | 
| 164 124 | 
             
                    or path =~ /^dfs:\/\//
         | 
| 165 125 |  | 
| 166 126 | 
             
                if path =~ /^dfs:\/\// then
         | 
| 167 | 
            -
                   | 
| 127 | 
            +
                  @@file, path2, addr = parse_path(path)
         | 
| 168 128 | 
             
                else
         | 
| 169 | 
            -
                  path2 = File.join( | 
| 129 | 
            +
                  path2 = File.join(@@directory, path)
         | 
| 170 130 | 
             
                end
         | 
| 171 131 |  | 
| 172 | 
            -
                found =  | 
| 132 | 
            +
                found = @@file.ru  path2
         | 
| 173 133 | 
             
                return (addr + found) if found and addr
         | 
| 174 134 |  | 
| 175 135 | 
             
              end
         | 
| 176 136 |  | 
| 177 137 | 
             
              def ru_r(path)
         | 
| 178 138 |  | 
| 179 | 
            -
                unless  | 
| 139 | 
            +
                unless @@directory or path =~ /^dfs:\/\// then
         | 
| 180 140 | 
             
                  return DirToXML.new(path, recursive: true, verbose: false).latest
         | 
| 181 141 | 
             
                end
         | 
| 182 142 |  | 
| 183 143 | 
             
                if path =~ /^dfs:\/\// then
         | 
| 184 | 
            -
                   | 
| 144 | 
            +
                  @@file, path2, addr = parse_path(path)
         | 
| 185 145 | 
             
                else
         | 
| 186 | 
            -
                  path2 = File.join( | 
| 146 | 
            +
                  path2 = File.join(@@directory, path)
         | 
| 187 147 | 
             
                end
         | 
| 188 148 |  | 
| 189 | 
            -
                found =  | 
| 149 | 
            +
                found = @@file.ru_r  path2
         | 
| 190 150 | 
             
                return (addr + found) if found and addr
         | 
| 191 151 |  | 
| 192 152 | 
             
              end
         | 
| 193 153 |  | 
| 194 154 | 
             
              def zip(filename_zip, a)
         | 
| 195 155 |  | 
| 196 | 
            -
                puts ' | 
| 156 | 
            +
                puts '@@directory: ' + @@directory.inspect if @debug
         | 
| 197 157 |  | 
| 198 | 
            -
                unless  | 
| 158 | 
            +
                unless @@directory or filename_zip =~ /^dfs:\/\// then
         | 
| 199 159 |  | 
| 200 160 | 
             
                  Zip::File.open(zipfile_zip, Zip::File::CREATE) do |x|
         | 
| 201 161 |  | 
| @@ -208,45 +168,42 @@ class DRbFileClient < DRbFileClientReadWrite | |
| 208 168 | 
             
                end
         | 
| 209 169 |  | 
| 210 170 | 
             
                if filename_zip =~ /^dfs:\/\// then
         | 
| 211 | 
            -
                   | 
| 171 | 
            +
                  @@file, filepath = parse_path(filename_zip)
         | 
| 212 172 | 
             
                else
         | 
| 213 | 
            -
                  filepath = File.join( | 
| 173 | 
            +
                  filepath = File.join(@@directory, filename_zip)
         | 
| 214 174 | 
             
                end
         | 
| 215 175 |  | 
| 216 | 
            -
                 | 
| 176 | 
            +
                @@file.zip filepath, a
         | 
| 217 177 |  | 
| 218 178 | 
             
              end
         | 
| 219 179 |  | 
| 220 180 | 
             
            end
         | 
| 221 181 |  | 
| 222 182 |  | 
| 223 | 
            -
            def DfsFile.directory?(filename)
         | 
| 224 | 
            -
              DRbFileClient.new.directory?(filename)
         | 
| 225 | 
            -
            end
         | 
| 226 | 
            -
            def DfsFile.chdir(path)
         | 
| 227 | 
            -
              DRbFileClient.new.chdir(path)
         | 
| 228 | 
            -
            end
         | 
| 229 183 | 
             
            def DfsFile.chmod(num, filename)
         | 
| 230 184 | 
             
              DRbFileClient.new.chmod(num, filename)
         | 
| 231 185 | 
             
            end
         | 
| 186 | 
            +
             | 
| 232 187 | 
             
            def DfsFile.cp(path, path2)
         | 
| 233 188 | 
             
              DRbFileClient.new.cp(path, path2)
         | 
| 234 189 | 
             
            end
         | 
| 190 | 
            +
             | 
| 235 191 | 
             
            def DfsFile.ls(path)
         | 
| 236 192 | 
             
              DRbFileClient.new.ls(path)
         | 
| 237 193 | 
             
            end
         | 
| 194 | 
            +
             | 
| 238 195 | 
             
            def DfsFile.mv(path, path2)
         | 
| 239 196 | 
             
              DRbFileClient.new.mv(path, path2)
         | 
| 240 197 | 
             
            end
         | 
| 241 | 
            -
             | 
| 242 | 
            -
              DRbFileClient.new.pwd()
         | 
| 243 | 
            -
            end
         | 
| 198 | 
            +
             | 
| 244 199 | 
             
            def DfsFile.ru(path)
         | 
| 245 200 | 
             
              DRbFileClient.new.ru(path)
         | 
| 246 201 | 
             
            end
         | 
| 202 | 
            +
             | 
| 247 203 | 
             
            def DfsFile.ru_r(path)
         | 
| 248 204 | 
             
              DRbFileClient.new.ru_r(path)
         | 
| 249 205 | 
             
            end
         | 
| 206 | 
            +
             | 
| 250 207 | 
             
            def DfsFile.zip(filename, a)
         | 
| 251 208 | 
             
              DRbFileClient.new.zip(filename, a)
         | 
| 252 209 | 
             
            end
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: drb_fileclient
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.8. | 
| 4 | 
            +
              version: 0.8.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Robertson
         | 
| @@ -35,7 +35,7 @@ cert_chain: | |
| 35 35 | 
             
              FGcgjmmz5fOIqq2sBxk6JW1yo2G43yIUzymWOYKT2Jh6RR0Gg3z66wWwYpFpx8yR
         | 
| 36 36 | 
             
              00JTBNVAgW+s2sLpeBtyMDbb
         | 
| 37 37 | 
             
              -----END CERTIFICATE-----
         | 
| 38 | 
            -
            date: 2022-02- | 
| 38 | 
            +
            date: 2022-02-23 00:00:00.000000000 Z
         | 
| 39 39 | 
             
            dependencies:
         | 
| 40 40 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 41 41 | 
             
              name: zip
         | 
| @@ -86,7 +86,7 @@ dependencies: | |
| 86 86 | 
             
                    version: '0.1'
         | 
| 87 87 | 
             
                - - ">="
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version: 0.1. | 
| 89 | 
            +
                    version: 0.1.5
         | 
| 90 90 | 
             
              type: :runtime
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -96,7 +96,7 @@ dependencies: | |
| 96 96 | 
             
                    version: '0.1'
         | 
| 97 97 | 
             
                - - ">="
         | 
| 98 98 | 
             
                  - !ruby/object:Gem::Version
         | 
| 99 | 
            -
                    version: 0.1. | 
| 99 | 
            +
                    version: 0.1.5
         | 
| 100 100 | 
             
            description: 
         | 
| 101 101 | 
             
            email: digital.robertson@gmail.com
         | 
| 102 102 | 
             
            executables: []
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |