lnr 0.1.0
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 +7 -0
 - data/Gemfile +8 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +17 -0
 - data/Rakefile +4 -0
 - data/exe/lnr +5 -0
 - data/lib/lnr/cli.rb +21 -0
 - data/lib/lnr/version.rb +5 -0
 - data/lib/lnr.rb +29 -0
 - data/sig/lnr.rbs +4 -0
 - metadata +54 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5413fa0dbfbb28959aa5306cd8b1609ccbeaf1899671faa59d7d44e26df13465
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c5ea610bf3d4e8018138ca4d5319169a11ad01788423a814a10b78047289c828
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: aa387b310a2e9a485c070204ba399c3a5295a278491fab9050bd660fed5417ab3185aa24ffec32ff1f6f894f578153b8257af4ce28958fffa173ab62486fbbbe
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fc5e780255d97c6239cbf430e783f0167060711da6d77e1f39becba6b4c88a366b481f067548311c2d4a2a7aa9e3620c988956f52d2204c0c5175eee777bbcf0
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2023 Yuya.Nishida.
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            X11 License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # lnr: make hard links recursive
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ```console
         
     | 
| 
      
 6 
     | 
    
         
            +
            $ gem install lnr
         
     | 
| 
      
 7 
     | 
    
         
            +
            ```
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```console
         
     | 
| 
      
 12 
     | 
    
         
            +
            $ lnr path1 path2
         
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/nishidayuya/lnr .
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/exe/lnr
    ADDED
    
    
    
        data/lib/lnr/cli.rb
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "lnr"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Lnr::Cli
         
     | 
| 
      
 4 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 5 
     | 
    
         
            +
                USAGE = <<~EOS
         
     | 
| 
      
 6 
     | 
    
         
            +
                  #{File.basename(Process.argv0)} source_directory destination_directory
         
     | 
| 
      
 7 
     | 
    
         
            +
                EOS
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def run(argv)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  source_root, destination_root = *argv
         
     | 
| 
      
 11 
     | 
    
         
            +
                  if !destination_root
         
     | 
| 
      
 12 
     | 
    
         
            +
                    $stderr.puts(USAGE)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    exit(1)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  source_root_path = Pathname(source_root).expand_path
         
     | 
| 
      
 17 
     | 
    
         
            +
                  destination_root_path = Pathname(destination_root).expand_path
         
     | 
| 
      
 18 
     | 
    
         
            +
                  Lnr.run(source_root_path, destination_root_path)
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/lnr/version.rb
    ADDED
    
    
    
        data/lib/lnr.rb
    ADDED
    
    | 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "pathname"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Lnr
         
     | 
| 
      
 6 
     | 
    
         
            +
              autoload :VERSION, "lnr/version"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              autoload :Cli, "lnr/cli"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 11 
     | 
    
         
            +
                def run(source_root_path, destination_root_path)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  source_root_path.find do |source_path|
         
     | 
| 
      
 13 
     | 
    
         
            +
                    relative_path = source_path.relative_path_from(source_root_path)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    destination_path = destination_root_path / relative_path
         
     | 
| 
      
 15 
     | 
    
         
            +
                    next if destination_path.exist?
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    case source_path.ftype.to_sym
         
     | 
| 
      
 18 
     | 
    
         
            +
                    when :file
         
     | 
| 
      
 19 
     | 
    
         
            +
                      destination_path.make_link(source_path)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    when :directory
         
     | 
| 
      
 21 
     | 
    
         
            +
                      destination_path.mkpath
         
     | 
| 
      
 22 
     | 
    
         
            +
                      destination_path.utime(source_path.atime, source_path.mtime)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    else
         
     | 
| 
      
 24 
     | 
    
         
            +
                      raise NotImplementedError, "not supported file type: type=#{source_path.ftype} path=#{source_path}"
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
    
        data/sig/lnr.rbs
    ADDED
    
    
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: lnr
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Yuya.Nishida.
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-05-15 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 13 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            email:
         
     | 
| 
      
 15 
     | 
    
         
            +
            - yuya@j96.org
         
     | 
| 
      
 16 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 17 
     | 
    
         
            +
            - lnr
         
     | 
| 
      
 18 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 19 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 20 
     | 
    
         
            +
            files:
         
     | 
| 
      
 21 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 22 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 23 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 24 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 25 
     | 
    
         
            +
            - exe/lnr
         
     | 
| 
      
 26 
     | 
    
         
            +
            - lib/lnr.rb
         
     | 
| 
      
 27 
     | 
    
         
            +
            - lib/lnr/cli.rb
         
     | 
| 
      
 28 
     | 
    
         
            +
            - lib/lnr/version.rb
         
     | 
| 
      
 29 
     | 
    
         
            +
            - sig/lnr.rbs
         
     | 
| 
      
 30 
     | 
    
         
            +
            homepage: https://github.com/nishidayuya/lnr
         
     | 
| 
      
 31 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 32 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 33 
     | 
    
         
            +
              homepage_uri: https://github.com/nishidayuya/lnr
         
     | 
| 
      
 34 
     | 
    
         
            +
              source_code_uri: https://github.com/nishidayuya/lnr
         
     | 
| 
      
 35 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 36 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 37 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 39 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 40 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 41 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 42 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 43 
     | 
    
         
            +
                  version: 2.6.0
         
     | 
| 
      
 44 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 45 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 46 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 47 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 48 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 49 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 50 
     | 
    
         
            +
            rubygems_version: 3.4.10
         
     | 
| 
      
 51 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 52 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 53 
     | 
    
         
            +
            summary: make hard links recursive
         
     | 
| 
      
 54 
     | 
    
         
            +
            test_files: []
         
     |