rbs-src 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7ade9d16159cd243f1f3849c3cecf99ff9e9bcb8988380778a19d56ab09f0e1
4
- data.tar.gz: 85bd20a7118741b61d5e0186893a8f990a8f257c03a19fbc3a3410f056cb1257
3
+ metadata.gz: 8228a38c388aa1705ca70c266e411b621b45a7d86f296117bdfcb376befab15c
4
+ data.tar.gz: 1b0f0daf59afe755d0fada717eb9573fead9936a3e1c5f9728b5ad72a9ca7496
5
5
  SHA512:
6
- metadata.gz: 0c238d9c2c9a514bd62259176db2790507dc9543e9b0bd93d5530956d722158dc0f1bfd6f63ee5db037e0f3f89e581446f7935349d4336b4934c8aed774514cd
7
- data.tar.gz: 177efc73a82a9de0bb01ed8155db0f843acaeedfb37bffb82e3de05db9140f21893e8ef1f0d47694e183d1eda9f0184d9b887e443ad9ba31f2eaf23274e7800f
6
+ metadata.gz: 6c255dec49483e1822ff3c21ccd3078023a898aa11a4701e0be60b876d3f18558087fc1bdd2a2a44825fb125d07785af5e355e55347115fbff5c898e736725f5
7
+ data.tar.gz: acfebcd0ae86f99e212c83c0df51f7b05466e149748c4edd6c8604b6b197c620ec69222186a1d5b6c1f1b0e620f9f220aebb3bbee49c96099623adacee62e89c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs-src (0.6.0)
4
+ rbs-src (0.7.0)
5
5
  rainbow (~> 3.1.1)
6
6
 
7
7
  GEM
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
- You need to edit your Steepfile to let the type checker stop using rbs-collection.
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
- # Add `#signature` call to support loading RBS files from symlinked directory
59
- signature "sig/rbs-src/*/*.rbs"
60
- signature "sig/rbs-src/*/[^_]*/**/*.rbs"
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
- # Stop loading libraries through rbs-collection
63
- disable_collection()
69
+ signature "sig/rbs-src/*/*.rbs"
70
+ signature "sig/rbs-src/*/[^_]*/**/*.rbs"
64
71
 
65
- # Load standard libraries and gems manually
66
- library('abbrev')
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
- unless other_libs.empty?
205
- runner.push "You have to load other libraries without rbs-collection:" do
206
- if has_gem?("steep")
207
- runner.puts "Add the following lines in your Steepfile:"
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
- else
213
- other_libs.each do |name, version|
214
- runner.puts "-r #{name} \\"
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rbs
4
4
  module Src
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.0"
6
6
  end
7
7
  end
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.6.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-09-14 00:00:00.000000000 Z
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.6
80
+ rubygems_version: 3.4.10
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: rbs-src