rbs-src 0.5.0 → 0.7.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 +4 -4
 - data/Gemfile.lock +1 -1
 - data/README.md +29 -10
 - data/Steepfile +12 -0
 - data/lib/rbs/src/cli.rb +22 -10
 - data/lib/rbs/src/gem.rb +6 -3
 - data/lib/rbs/src/version.rb +1 -1
 - data/sig/rbs/gem.rbs +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8228a38c388aa1705ca70c266e411b621b45a7d86f296117bdfcb376befab15c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1b0f0daf59afe755d0fada717eb9573fead9936a3e1c5f9728b5ad72a9ca7496
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6c255dec49483e1822ff3c21ccd3078023a898aa11a4701e0be60b876d3f18558087fc1bdd2a2a44825fb125d07785af5e355e55347115fbff5c898e736725f5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: acfebcd0ae86f99e212c83c0df51f7b05466e149748c4edd6c8604b6b197c620ec69222186a1d5b6c1f1b0e620f9f220aebb3bbee49c96099623adacee62e89c
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -45,9 +45,15 @@ Load gem dependencies from `rbs_collection.lock.yaml` and set up all repositorie 
     | 
|
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
            If the git repository content is edited, it runs `git stash` and `git reset --hard`.
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
      
 48 
     | 
    
         
            +
            It accepts `--output` option to write the dependencies to a file.
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                $ rbs-src setup --output
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            You can load the dependencies to your type checkers from the file.
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
       48 
54 
     | 
    
         
             
            #### For Steep users
         
     | 
| 
       49 
55 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
            The recommended setup for Steep is the following:
         
     | 
| 
       51 
57 
     | 
    
         | 
| 
       52 
58 
     | 
    
         
             
            ```ruby
         
     | 
| 
       53 
59 
     | 
    
         
             
            # Steepfile
         
     | 
| 
         @@ -55,20 +61,33 @@ You need to edit your Steepfile to let the type checker stop using rbs-collectio 
     | 
|
| 
       55 
61 
     | 
    
         
             
            target ... do
         
     | 
| 
       56 
62 
     | 
    
         
             
              # Existing config...
         
     | 
| 
       57 
63 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
              #  
     | 
| 
       59 
     | 
    
         
            -
               
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 64 
     | 
    
         
            +
              # Assume we use `rbs-src setup --output` to generate `rbs_src.dep` file
         
     | 
| 
      
 65 
     | 
    
         
            +
              if (dep_path = Pathname("rbs_src.dep")).file?
         
     | 
| 
      
 66 
     | 
    
         
            +
                # Stop loading libraries through rbs-collection
         
     | 
| 
      
 67 
     | 
    
         
            +
                disable_collection()
         
     | 
| 
       61 
68 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 69 
     | 
    
         
            +
                signature "sig/rbs-src/*/*.rbs"
         
     | 
| 
      
 70 
     | 
    
         
            +
                signature "sig/rbs-src/*/[^_]*/**/*.rbs"
         
     | 
| 
       64 
71 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
               
     | 
| 
       67 
     | 
    
         
            -
              library('date')
         
     | 
| 
       68 
     | 
    
         
            -
              # ...
         
     | 
| 
      
 72 
     | 
    
         
            +
                dep_path.readlines().each {|lib| library(lib.chomp) }
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
       69 
74 
     | 
    
         
             
            end
         
     | 
| 
       70 
75 
     | 
    
         
             
            ```
         
     | 
| 
       71 
76 
     | 
    
         | 
| 
      
 77 
     | 
    
         
            +
            In this setup, you can use Steep without using `rbs-src` until you run `rbs-src setup --output`.
         
     | 
| 
      
 78 
     | 
    
         
            +
            Once you run `rbs-src setup --output`, it generates `rbs_src.dep` file and `Steepfile` loads the dependencies from the file.
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 81 
     | 
    
         
            +
            # When you install your rbs_collection dependencies
         
     | 
| 
      
 82 
     | 
    
         
            +
            $ rbs collection install && rbs-src setup --output
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            # When you update your rbs_collection dependencies
         
     | 
| 
      
 85 
     | 
    
         
            +
            $ rbs collection update && rbs-src setup --output
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            # When you stop using rbs-src
         
     | 
| 
      
 88 
     | 
    
         
            +
            $ rm -rf rbs_src.dep tmp/rbs-src sig/rbs-src
         
     | 
| 
      
 89 
     | 
    
         
            +
            ```
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
       72 
91 
     | 
    
         
             
            ### rbs-src link
         
     | 
| 
       73 
92 
     | 
    
         | 
| 
       74 
93 
     | 
    
         
             
            The command clones and set up a symlink of a ruby gem, not loaded from `rbs_collection.lock.yaml`.
         
     | 
    
        data/Steepfile
    CHANGED
    
    | 
         @@ -6,10 +6,22 @@ target :lib do 
     | 
|
| 
       6 
6 
     | 
    
         
             
              check "lib"                       # Directory name
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
              configure_code_diagnostics(D::Ruby.default)      # `default` diagnostics setting (applies by default)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       9 
10 
     | 
    
         
             
              # configure_code_diagnostics(D::Ruby.strict)       # `strict` diagnostics setting
         
     | 
| 
       10 
11 
     | 
    
         
             
              # configure_code_diagnostics(D::Ruby.lenient)      # `lenient` diagnostics setting
         
     | 
| 
       11 
12 
     | 
    
         
             
              # configure_code_diagnostics(D::Ruby.silent)       # `silent` diagnostics setting
         
     | 
| 
       12 
13 
     | 
    
         
             
              # configure_code_diagnostics do |hash|             # You can setup everything yourself
         
     | 
| 
       13 
14 
     | 
    
         
             
              #   hash[D::Ruby::NoMethod] = :information
         
     | 
| 
       14 
15 
     | 
    
         
             
              # end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # `rbs-src setup -o` generates `rbs_src.dep` file
         
     | 
| 
      
 18 
     | 
    
         
            +
              if (dep_path = Pathname("rbs_src.dep")).file?
         
     | 
| 
      
 19 
     | 
    
         
            +
                # Stop loading libraries through rbs-collection
         
     | 
| 
      
 20 
     | 
    
         
            +
                disable_collection()
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                signature "sig/rbs-src/*/*.rbs"
         
     | 
| 
      
 23 
     | 
    
         
            +
                signature "sig/rbs-src/*/[^_]*/**/*.rbs"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                dep_path.readlines().each {|lib| library(lib.chomp) }
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
       15 
27 
     | 
    
         
             
            end
         
     | 
    
        data/lib/rbs/src/cli.rb
    CHANGED
    
    | 
         @@ -132,11 +132,13 @@ module Rbs 
     | 
|
| 
       132 
132 
     | 
    
         
             
                      rbs_collection_lock_path = RBS::Collection::Config.to_lockfile_path(RBS::Collection::Config::PATH)
         
     | 
| 
       133 
133 
     | 
    
         
             
                      repository_prefix = Pathname("tmp/rbs-src")
         
     | 
| 
       134 
134 
     | 
    
         
             
                      rbs_prefix = Pathname("sig/rbs-src")
         
     | 
| 
      
 135 
     | 
    
         
            +
                      output_path= nil #: Pathname?
         
     | 
| 
       135 
136 
     | 
    
         | 
| 
       136 
137 
     | 
    
         
             
                      OptionParser.new do |opts|
         
     | 
| 
       137 
138 
     | 
    
         
             
                        opts.on("--rbs-collection-lock=PATH", "The path to rbs_collection.lock.yaml (default: #{rbs_collection_lock_path})") { rbs_collection_lock_path = Pathname(_1) }
         
     | 
| 
       138 
139 
     | 
    
         
             
                        opts.on("--repo-prefix=PREFIX", "The location to put repository in (default: #{repository_prefix})") { repository_prefix = Pathname(_1) }
         
     | 
| 
       139 
140 
     | 
    
         
             
                        opts.on("--rbs-prefix=PREFIX", "The location to put symlinks in (default: #{rbs_prefix})") { rbs_prefix = Pathname(_1) }
         
     | 
| 
      
 141 
     | 
    
         
            +
                        opts.on("--output[=PATH]", "-o[PATH]", "The path to write the list of stdlib dependencies (default: rbs_src.dep)") {|path| output_path = Pathname(path || "rbs_src.dep") }
         
     | 
| 
       140 
142 
     | 
    
         | 
| 
       141 
143 
     | 
    
         
             
                        opts.banner = <<~BANNER
         
     | 
| 
       142 
144 
     | 
    
         
             
                          Usage: rbs-src setup [options]
         
     | 
| 
         @@ -201,17 +203,27 @@ module Rbs 
     | 
|
| 
       201 
203 
     | 
    
         | 
| 
       202 
204 
     | 
    
         
             
                      other_libs.sort_by! { _1[0] }
         
     | 
| 
       203 
205 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
                       
     | 
| 
       205 
     | 
    
         
            -
                        runner.push " 
     | 
| 
       206 
     | 
    
         
            -
                           
     | 
| 
       207 
     | 
    
         
            -
                             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
                            other_libs.each do |name, version|
         
     | 
| 
       210 
     | 
    
         
            -
                              runner.puts "  library('#{name}')"
         
     | 
| 
      
 206 
     | 
    
         
            +
                      if output_path
         
     | 
| 
      
 207 
     | 
    
         
            +
                        runner.push "Writing dependencies to #{output_path}:" do
         
     | 
| 
      
 208 
     | 
    
         
            +
                          output_path.open("w") do |io|
         
     | 
| 
      
 209 
     | 
    
         
            +
                            other_libs.each do |name, _|
         
     | 
| 
      
 210 
     | 
    
         
            +
                              io.puts name
         
     | 
| 
       211 
211 
     | 
    
         
             
                            end
         
     | 
| 
       212 
     | 
    
         
            -
                           
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
      
 212 
     | 
    
         
            +
                          end
         
     | 
| 
      
 213 
     | 
    
         
            +
                        end
         
     | 
| 
      
 214 
     | 
    
         
            +
                      else
         
     | 
| 
      
 215 
     | 
    
         
            +
                        unless other_libs.empty?
         
     | 
| 
      
 216 
     | 
    
         
            +
                          runner.push "You have to load other libraries without rbs-collection:" do
         
     | 
| 
      
 217 
     | 
    
         
            +
                            if has_gem?("steep")
         
     | 
| 
      
 218 
     | 
    
         
            +
                              runner.puts "Add the following lines in your Steepfile:"
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
                              other_libs.each do |name, version|
         
     | 
| 
      
 221 
     | 
    
         
            +
                                runner.puts "  library('#{name}')"
         
     | 
| 
      
 222 
     | 
    
         
            +
                              end
         
     | 
| 
      
 223 
     | 
    
         
            +
                            else
         
     | 
| 
      
 224 
     | 
    
         
            +
                              other_libs.each do |name, version|
         
     | 
| 
      
 225 
     | 
    
         
            +
                                runner.puts "-r #{name} \\"
         
     | 
| 
      
 226 
     | 
    
         
            +
                              end
         
     | 
| 
       215 
227 
     | 
    
         
             
                            end
         
     | 
| 
       216 
228 
     | 
    
         
             
                          end
         
     | 
| 
       217 
229 
     | 
    
         
             
                        end
         
     | 
    
        data/lib/rbs/src/gem.rb
    CHANGED
    
    | 
         @@ -19,8 +19,8 @@ module Rbs 
     | 
|
| 
       19 
19 
     | 
    
         
             
                    repository_root.join(repository_dir, name, version)
         
     | 
| 
       20 
20 
     | 
    
         
             
                  end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                  def rbs_path
         
     | 
| 
       23 
     | 
    
         
            -
                    rbs_prefix + "#{name}-#{ 
     | 
| 
      
 22 
     | 
    
         
            +
                  def rbs_path(suffix = version)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    rbs_prefix + "#{name}-#{suffix}"
         
     | 
| 
       24 
24 
     | 
    
         
             
                  end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                  def status(runner, commit:)
         
     | 
| 
         @@ -50,7 +50,7 @@ module Rbs 
     | 
|
| 
       50 
50 
     | 
    
         
             
                    end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                    runner.puts "💪 Checking out the commit #{commit}..."
         
     | 
| 
       53 
     | 
    
         
            -
                    runner.execute!("git", " 
     | 
| 
      
 53 
     | 
    
         
            +
                    runner.execute!("git", "checkout", commit, chdir: repository_root)
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                  def clone(runner, repository_url:, commit:)
         
     | 
| 
         @@ -66,6 +66,9 @@ module Rbs 
     | 
|
| 
       66 
66 
     | 
    
         
             
                  end
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
                  def link
         
     | 
| 
      
 69 
     | 
    
         
            +
                    Pathname.glob(rbs_path("*").to_s).each do |path|
         
     | 
| 
      
 70 
     | 
    
         
            +
                      File.unlink(path.to_s)
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
       69 
72 
     | 
    
         
             
                    File.symlink(repository_path.relative_path_from(rbs_path.parent), rbs_path)
         
     | 
| 
       70 
73 
     | 
    
         
             
                  end
         
     | 
| 
       71 
74 
     | 
    
         
             
                end
         
     | 
    
        data/lib/rbs/src/version.rb
    CHANGED
    
    
    
        data/sig/rbs/gem.rbs
    CHANGED
    
    | 
         @@ -19,7 +19,7 @@ module Rbs 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  def repository_path: () -> Pathname
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  # The path of the directory in the `#rbs_prefix` that contains the RBS files of the gem
         
     | 
| 
       22 
     | 
    
         
            -
                  def rbs_path: () -> Pathname
         
     | 
| 
      
 22 
     | 
    
         
            +
                  def rbs_path: (?String suffix) -> Pathname
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  def clone: (CommandRunner, repository_url: String, commit: String?) -> void
         
     | 
| 
       25 
25 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rbs-src
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Soutaro Matsumoto
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-10-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rainbow
         
     | 
| 
         @@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       77 
77 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       78 
78 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       79 
79 
     | 
    
         
             
            requirements: []
         
     | 
| 
       80 
     | 
    
         
            -
            rubygems_version: 3.4. 
     | 
| 
      
 80 
     | 
    
         
            +
            rubygems_version: 3.4.10
         
     | 
| 
       81 
81 
     | 
    
         
             
            signing_key:
         
     | 
| 
       82 
82 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       83 
83 
     | 
    
         
             
            summary: rbs-src
         
     |