rbs 1.5.1 → 1.7.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/ruby.yml +0 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +51 -0
- data/Gemfile +2 -0
- data/Rakefile +7 -22
- data/Steepfile +9 -1
- data/core/enumerator.rbs +1 -0
- data/core/io.rbs +3 -1
- data/core/kernel.rbs +4 -4
- data/core/trace_point.rbs +1 -1
- data/docs/collection.md +116 -0
- data/ext/rbs/extension/constants.c +140 -0
- data/ext/rbs/extension/constants.h +72 -0
- data/ext/rbs/extension/extconf.rb +3 -0
- data/ext/rbs/extension/lexer.c +1070 -0
- data/ext/rbs/extension/lexer.h +145 -0
- data/ext/rbs/extension/location.c +295 -0
- data/ext/rbs/extension/location.h +59 -0
- data/ext/rbs/extension/main.c +9 -0
- data/ext/rbs/extension/parser.c +2418 -0
- data/ext/rbs/extension/parser.h +23 -0
- data/ext/rbs/extension/parserstate.c +313 -0
- data/ext/rbs/extension/parserstate.h +141 -0
- data/ext/rbs/extension/rbs_extension.h +40 -0
- data/ext/rbs/extension/ruby_objs.c +585 -0
- data/ext/rbs/extension/ruby_objs.h +46 -0
- data/ext/rbs/extension/unescape.c +65 -0
- data/goodcheck.yml +1 -1
- data/lib/rbs/ast/comment.rb +0 -12
- data/lib/rbs/buffer.rb +4 -0
- data/lib/rbs/builtin_names.rb +1 -0
- data/lib/rbs/cli.rb +98 -10
- data/lib/rbs/collection/cleaner.rb +29 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +95 -0
- data/lib/rbs/collection/config.rb +85 -0
- data/lib/rbs/collection/installer.rb +27 -0
- data/lib/rbs/collection/sources/git.rb +162 -0
- data/lib/rbs/collection/sources/rubygems.rb +40 -0
- data/lib/rbs/collection/sources/stdlib.rb +38 -0
- data/lib/rbs/collection/sources.rb +22 -0
- data/lib/rbs/collection.rb +13 -0
- data/lib/rbs/environment_loader.rb +12 -0
- data/lib/rbs/errors.rb +16 -1
- data/lib/rbs/location.rb +221 -217
- data/lib/rbs/location_aux.rb +108 -0
- data/lib/rbs/locator.rb +10 -7
- data/lib/rbs/parser_aux.rb +24 -0
- data/lib/rbs/repository.rb +13 -7
- data/lib/rbs/types.rb +2 -3
- data/lib/rbs/validator.rb +4 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -2
- data/lib/rbs.rb +4 -7
- data/rbs.gemspec +2 -1
- data/sig/ancestor_builder.rbs +2 -2
- data/sig/annotation.rbs +2 -2
- data/sig/builtin_names.rbs +1 -0
- data/sig/cli.rbs +5 -0
- data/sig/collection/cleaner.rbs +13 -0
- data/sig/collection/collections.rbs +112 -0
- data/sig/collection/config.rbs +69 -0
- data/sig/collection/installer.rbs +15 -0
- data/sig/collection.rbs +4 -0
- data/sig/comment.rbs +7 -7
- data/sig/constant_table.rbs +1 -1
- data/sig/declarations.rbs +9 -9
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +2 -2
- data/sig/environment_loader.rbs +3 -0
- data/sig/errors.rbs +30 -25
- data/sig/location.rbs +42 -79
- data/sig/locator.rbs +2 -2
- data/sig/members.rbs +7 -7
- data/sig/method_types.rbs +3 -3
- data/sig/parser.rbs +11 -21
- data/sig/polyfill.rbs +12 -3
- data/sig/repository.rbs +4 -0
- data/sig/types.rbs +45 -27
- data/sig/writer.rbs +1 -1
- data/stdlib/json/0/json.rbs +3 -3
- data/stdlib/objspace/0/objspace.rbs +406 -0
- data/stdlib/openssl/0/openssl.rbs +1 -1
- data/stdlib/tempfile/0/tempfile.rbs +270 -0
- data/steep/Gemfile.lock +10 -10
- metadata +43 -7
- data/lib/rbs/parser.rb +0 -3614
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f2e7e51d08feb7b1a562ac43c679da8fc6f0a7cfc2ecef65e11c1e8c3d0d2b9
|
4
|
+
data.tar.gz: d41ed33c0b5de01cd1746faa3572e56f651ecfc808c046cdb4166a0ec357138e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc198dc7d40caaa802604cb1f633098955540d838c4e1adcca635da85880703378d981a4f37c528e7f4b3720fc6f152d7fc6c7bcb11ce3e0abba76fd14a6d47c
|
7
|
+
data.tar.gz: 68c6643f9adf4761bec2a2ffb211e223cb732a37c341652c4625191b5ab6d6791c91196f3c3bc4fd5624d6d853558c33e28f8462f483f923badad8f38498a675
|
data/.github/workflows/ruby.yml
CHANGED
@@ -19,10 +19,6 @@ jobs:
|
|
19
19
|
- test
|
20
20
|
- stdlib_test
|
21
21
|
- rubocop validate test_doc build test_generate_stdlib
|
22
|
-
- confirm_parser
|
23
|
-
exclude:
|
24
|
-
- container_tag: master-nightly-focal
|
25
|
-
job: confirm_parser
|
26
22
|
container:
|
27
23
|
image: rubylang/ruby:${{ matrix.container_tag }}
|
28
24
|
steps:
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,57 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.7.0 (beta.1)
|
6
|
+
|
7
|
+
## Library changes
|
8
|
+
|
9
|
+
* Replace RBS::Parser ([#788](https://github.com/ruby/rbs/pull/788))
|
10
|
+
|
11
|
+
## 1.6.2 (2021-09-09)
|
12
|
+
|
13
|
+
## Signature updates
|
14
|
+
|
15
|
+
* `Enumerator::Lazy#force` ([\#782](https://github.com/ruby/rbs/pull/782))
|
16
|
+
* `IO.readlines` ([\#780](https://github.com/ruby/rbs/pull/780))
|
17
|
+
|
18
|
+
## Miscellaneous
|
19
|
+
|
20
|
+
* Set `$XDG_CACHE_HOME` during test ([\#781](https://github.com/ruby/rbs/pull/781))
|
21
|
+
|
22
|
+
## 1.6.1 (2021-09-05)
|
23
|
+
|
24
|
+
This is a minor release including test fixes.
|
25
|
+
|
26
|
+
## Miscellaneous
|
27
|
+
|
28
|
+
* Fix stdlib test for `Resolv::Hosts` by removing `/etc/hosts` dependency ([\#779](https://github.com/ruby/rbs/pull/779))
|
29
|
+
* Fix bundler related test for test-bundled-gems ([\#778](https://github.com/ruby/rbs/pull/778))
|
30
|
+
|
31
|
+
## 1.6.0 (2021-09-05)
|
32
|
+
|
33
|
+
This release includes a preview of `rbs collection` commands, which is _bundler for RBS_.
|
34
|
+
The command helps you manage RBS files from gem_rbs_collection or other repositories.
|
35
|
+
|
36
|
+
This feature is a preview, and any feedback is welcome!
|
37
|
+
|
38
|
+
## Signature updates
|
39
|
+
|
40
|
+
* objspace ([\#763](https://github.com/ruby/rbs/pull/763), [\#776](https://github.com/ruby/rbs/pull/776))
|
41
|
+
* tempfile ([\#767](https://github.com/ruby/rbs/pull/767), [\#775](https://github.com/ruby/rbs/pull/775))
|
42
|
+
* `IO#set_encoding_by_bom` ([\#106](https://github.com/ruby/rbs/pull/106))
|
43
|
+
* `OpenSSL::PKey::EC#dh_compute_key` ([\#775](https://github.com/ruby/rbs/pull/775))
|
44
|
+
|
45
|
+
## Library changes
|
46
|
+
|
47
|
+
* Add `rbs collection` ([\#589](https://github.com/ruby/rbs/pull/589), [\#772](https://github.com/ruby/rbs/pull/772), [\#773](https://github.com/ruby/rbs/pull/773))
|
48
|
+
|
49
|
+
## Miscellaneous
|
50
|
+
|
51
|
+
* Let `bin/annotate-with-rdoc` process nested constants/classes ([\#766](https://github.com/ruby/rbs/pull/766), [\#768](https://github.com/ruby/rbs/pull/768))
|
52
|
+
* Stop printing version mismatch message in CI ([\#777](https://github.com/ruby/rbs/pull/777))
|
53
|
+
* Update Steep and fix type errors ([\#770](https://github.com/ruby/rbs/pull/770), [\#774](https://github.com/ruby/rbs/pull/774))
|
54
|
+
* Add dependabot configuration ([\#771](https://github.com/ruby/rbs/pull/771))
|
55
|
+
|
5
56
|
## 1.5.1 (2021-08-22)
|
6
57
|
|
7
58
|
### Miscellaneous
|
data/Gemfile
CHANGED
@@ -5,6 +5,7 @@ gemspec
|
|
5
5
|
|
6
6
|
# Development dependencies
|
7
7
|
gem "rake"
|
8
|
+
gem "rake-compiler"
|
8
9
|
gem "test-unit"
|
9
10
|
gem "rspec"
|
10
11
|
gem "racc"
|
@@ -16,6 +17,7 @@ gem 'stackprof'
|
|
16
17
|
gem "goodcheck"
|
17
18
|
gem "dbm"
|
18
19
|
gem 'digest'
|
20
|
+
gem 'tempfile'
|
19
21
|
|
20
22
|
# Test gems
|
21
23
|
gem "rbs-amber", path: "test/assets/test-gem"
|
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
require "rbconfig"
|
4
|
+
require 'rake/extensiontask'
|
4
5
|
|
5
6
|
$LOAD_PATH << File.join(__dir__, "test")
|
6
7
|
|
7
8
|
ruby = ENV["RUBY"] || RbConfig.ruby
|
8
|
-
racc = ENV.fetch("RACC", "racc")
|
9
9
|
rbs = File.join(__dir__, "exe/rbs")
|
10
10
|
bin = File.join(__dir__, "bin")
|
11
11
|
|
12
|
-
Rake::
|
12
|
+
Rake::ExtensionTask.new("rbs/extension")
|
13
|
+
|
14
|
+
Rake::TestTask.new(:test => :compile) do |t|
|
13
15
|
t.libs << "test"
|
14
16
|
t.libs << "lib"
|
15
17
|
t.test_files = FileList["test/**/*_test.rb"].reject do |path|
|
@@ -19,7 +21,7 @@ end
|
|
19
21
|
|
20
22
|
multitask :default => [:test, :stdlib_test, :rubocop, :validate, :test_doc]
|
21
23
|
|
22
|
-
task :test_doc
|
24
|
+
task :test_doc do
|
23
25
|
files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
26
|
`git ls-files -z`.split("\x0").select do |file| Pathname(file).extname == ".md" end
|
25
27
|
end
|
@@ -27,7 +29,7 @@ task :test_doc => :parser do
|
|
27
29
|
sh "#{ruby} #{__dir__}/bin/run_in_md.rb #{files.join(" ")}"
|
28
30
|
end
|
29
31
|
|
30
|
-
task :validate => :
|
32
|
+
task :validate => :compile do
|
31
33
|
sh "#{ruby} #{rbs} validate --silent"
|
32
34
|
|
33
35
|
FileList["stdlib/*"].each do |path|
|
@@ -72,7 +74,7 @@ task :validate => :parser do
|
|
72
74
|
end
|
73
75
|
|
74
76
|
FileList["test/stdlib/**/*_test.rb"].each do |test|
|
75
|
-
task test => :
|
77
|
+
task test => :compile do
|
76
78
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test}"
|
77
79
|
end
|
78
80
|
task stdlib_test: test
|
@@ -82,21 +84,6 @@ task :rubocop do
|
|
82
84
|
sh "rubocop --parallel"
|
83
85
|
end
|
84
86
|
|
85
|
-
rule ".rb" => ".y" do |t|
|
86
|
-
sh "#{racc} -v -o #{t.name} #{t.source}"
|
87
|
-
end
|
88
|
-
|
89
|
-
task :parser => "lib/rbs/parser.rb"
|
90
|
-
task :test => :parser
|
91
|
-
task :stdlib_test => :parser
|
92
|
-
task :build => :parser
|
93
|
-
|
94
|
-
task :confirm_parser do
|
95
|
-
puts "Testing if parser.rb is updated with respect to parser.y"
|
96
|
-
sh "#{racc} -v -o lib/rbs/parser.rb lib/rbs/parser.y"
|
97
|
-
sh "git diff --exit-code lib/rbs/parser.rb"
|
98
|
-
end
|
99
|
-
|
100
87
|
namespace :generate do
|
101
88
|
desc "Generate a test file for a stdlib class signatures"
|
102
89
|
task :stdlib_test, [:class] do |_task, args|
|
@@ -225,5 +212,3 @@ task :test_generate_stdlib do
|
|
225
212
|
sh "RBS_GENERATE_TEST_PATH=/tmp/Array_test.rb rake 'generate:stdlib_test[Array]'"
|
226
213
|
sh "ruby -c /tmp/Array_test.rb"
|
227
214
|
end
|
228
|
-
|
229
|
-
CLEAN.include("lib/rbs/parser.rb")
|
data/Steepfile
CHANGED
@@ -1,13 +1,21 @@
|
|
1
|
+
D = Steep::Diagnostic
|
2
|
+
|
1
3
|
target :lib do
|
2
4
|
signature "sig"
|
3
5
|
check "lib"
|
4
6
|
ignore "lib/rbs/parser.rb"
|
5
7
|
ignore "lib/rbs/prototype", "lib/rbs/test", "lib/rbs/test.rb"
|
6
8
|
|
7
|
-
library "set", "pathname", "json", "logger", "monitor", "tsort"
|
9
|
+
library "set", "pathname", "json", "logger", "monitor", "tsort", "uri"
|
8
10
|
signature "stdlib/strscan/0/"
|
9
11
|
signature "stdlib/rubygems/0/"
|
10
12
|
signature "stdlib/optparse/0/"
|
13
|
+
|
14
|
+
configure_code_diagnostics do |config|
|
15
|
+
config[D::Ruby::MethodDefinitionMissing] = :hint
|
16
|
+
config[D::Ruby::ElseOnExhaustiveCase] = :hint
|
17
|
+
config[D::Ruby::FallbackAny] = :hint
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
# target :lib do
|
data/core/enumerator.rbs
CHANGED
data/core/io.rbs
CHANGED
@@ -635,6 +635,8 @@ class IO < Object
|
|
635
635
|
def set_encoding: (?String | Encoding ext_or_ext_int_enc) -> self
|
636
636
|
| (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
|
637
637
|
|
638
|
+
def set_encoding_by_bom: () -> Encoding?
|
639
|
+
|
638
640
|
# Returns status information for *ios* as an object of type `File::Stat` .
|
639
641
|
#
|
640
642
|
# ```ruby
|
@@ -747,7 +749,7 @@ class IO < Object
|
|
747
749
|
|
748
750
|
def self.read: (String name, ?Integer length, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> String
|
749
751
|
|
750
|
-
def self.readlines: (String name, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> ::Array[String]
|
752
|
+
def self.readlines: (String name, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode, ?chomp: boolish) -> ::Array[String]
|
751
753
|
|
752
754
|
def self.select: [X, Y, Z] (::Array[X & io]? read_array, ?::Array[Y & io]? write_array, ?::Array[Z & io]? error_array) -> [Array[X], Array[Y], Array[Z]]
|
753
755
|
| [X, Y, Z] (::Array[X & io]? read_array, ?::Array[Y & io]? write_array, ?::Array[Z & io]? error_array, Numeric? timeout) -> [Array[X], Array[Y], Array[Z]]?
|
data/core/kernel.rbs
CHANGED
@@ -482,8 +482,8 @@ module Kernel : BasicObject
|
|
482
482
|
| [:child, int] # redirect to the redirected file descriptor
|
483
483
|
| :close # close the file descriptor in child process
|
484
484
|
|
485
|
-
def self?.spawn: (String command, *String args, ?unsetenv_others: boolish, ?pgroup
|
486
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup
|
485
|
+
def self?.spawn: (String command, *String args, ?unsetenv_others: boolish, ?pgroup: (true | Integer), ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> Integer
|
486
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: (true | Integer), ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> Integer
|
487
487
|
|
488
488
|
# Executes *command…* in a subshell. *command…* is one of following forms.
|
489
489
|
#
|
@@ -510,8 +510,8 @@ module Kernel : BasicObject
|
|
510
510
|
# *
|
511
511
|
#
|
512
512
|
# See `Kernel.exec` for the standard shell.
|
513
|
-
def self?.system: (String command, *String args, ?unsetenv_others: boolish, ?pgroup
|
514
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup
|
513
|
+
def self?.system: (String command, *String args, ?unsetenv_others: boolish, ?pgroup: (true | Integer), ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> (NilClass | FalseClass | TrueClass)
|
514
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: (true | Integer), ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> (NilClass | FalseClass | TrueClass)
|
515
515
|
end
|
516
516
|
|
517
517
|
Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped
|
data/core/trace_point.rbs
CHANGED
data/docs/collection.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
# RBS Collection manager
|
2
|
+
|
3
|
+
`rbs collection` sub command manages third party gems' RBS. In short, it is `bundler` for RBS.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
* `git(1)`
|
8
|
+
* `Gemfile.lock`
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### Setup
|
14
|
+
|
15
|
+
First, generate the configuration file, `rbs_collection.yaml`, with `rbs collection init`.
|
16
|
+
|
17
|
+
```console
|
18
|
+
$ rbs collection init
|
19
|
+
created: rbs_collection.yaml
|
20
|
+
|
21
|
+
$ cat rbs_collection.yaml
|
22
|
+
# Download sources
|
23
|
+
sources:
|
24
|
+
- name: ruby/gem_rbs_collection
|
25
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
26
|
+
revision: main
|
27
|
+
repo_dir: gems
|
28
|
+
|
29
|
+
# A directory to install the downloaded RBSs
|
30
|
+
path: .gem_rbs_collection
|
31
|
+
|
32
|
+
gems:
|
33
|
+
# Skip loading rbs gem's RBS.
|
34
|
+
# It's unnecessary if you don't use rbs as a library.
|
35
|
+
- name: rbs
|
36
|
+
ignore: true
|
37
|
+
```
|
38
|
+
|
39
|
+
I also recommend updating `.gitignore`.
|
40
|
+
|
41
|
+
```console
|
42
|
+
$ echo /.gem_rbs_collection/ >> .gitignore
|
43
|
+
```
|
44
|
+
|
45
|
+
### Install dependencies
|
46
|
+
|
47
|
+
Then, install gems' RBS with `rbs collection install`! It copies RBS from [the gem RBS repository](https://github.com/ruby/gem_rbs_collection) to `.gem_rbs_collection/` directory by default.
|
48
|
+
I recommend to ignore `.gem_rbs_collection/` from version control system, such as Git.
|
49
|
+
|
50
|
+
```console
|
51
|
+
$ rbs collection install
|
52
|
+
Installing ast:2.4 (ruby/gem_rbs_collection@4b1a2a2f64c)
|
53
|
+
...
|
54
|
+
It's done! 42 gems's RBSs now installed.
|
55
|
+
```
|
56
|
+
|
57
|
+
Finally the third party RBSs are available! `rbs` commands, such as `rbs validate`, automatically load the third party RBSs.
|
58
|
+
|
59
|
+
### Other commands
|
60
|
+
|
61
|
+
`rbs collection` has two more commands.
|
62
|
+
|
63
|
+
* `rbs collection update` updates `rbs_collection.lock.yaml`.
|
64
|
+
* `rbs collection clean` removes unnecessary rbs from `.gem_rbs_collection` directory.
|
65
|
+
|
66
|
+
## Configuration
|
67
|
+
|
68
|
+
Configure `rbs collection` with editing `rbs_collection.yaml`.
|
69
|
+
|
70
|
+
```yaml
|
71
|
+
# Download sources.
|
72
|
+
# You can add own collection git repository.
|
73
|
+
sources:
|
74
|
+
- name: ruby/gem_rbs_collection
|
75
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
76
|
+
revision: main
|
77
|
+
repo_dir: gems
|
78
|
+
|
79
|
+
# A directory to install the downloaded RBSs
|
80
|
+
path: .gem_rbs_collection
|
81
|
+
|
82
|
+
gems:
|
83
|
+
# If the Gemfile.lock doesn't contain csv gem but you use csv gem,
|
84
|
+
# you can write the gem name explicitly to install RBS of the gem.
|
85
|
+
- name: csv
|
86
|
+
|
87
|
+
# If the Gemfile.lock contains nokogiri gem but you don't want to use the RBS,
|
88
|
+
# you can ignore the gem.
|
89
|
+
# `rbs collection` avoids to install nokogiri gem's RBS by this change.
|
90
|
+
# It is useful if the nokogiri RBS has a problem, such as compatibility issue with other RBS.
|
91
|
+
- name: nokogiri
|
92
|
+
ignore: true
|
93
|
+
```
|
94
|
+
|
95
|
+
## Files / Directories
|
96
|
+
|
97
|
+
* `rbs_collection.yaml`
|
98
|
+
* The configuration file.
|
99
|
+
* You need to edit it if:
|
100
|
+
* You don't want to ignore gem's RBS.
|
101
|
+
* You want to add gem's RBS explicitly.
|
102
|
+
* You can change the file path with `--collection` option. e.g. `rbs --collection another_conf.yaml collection install`.
|
103
|
+
* `rbs_collection.lock.yaml`
|
104
|
+
* RBS installs and loads RBS files with this file.
|
105
|
+
* It is auto-generated file. Do not edit this file.
|
106
|
+
* I recommend to manage it with VCS such as git.
|
107
|
+
* `.gem_rbs_collection/`
|
108
|
+
* RBS installs third party RBS files to the directory.
|
109
|
+
* I recommend to ignore it from VCS.
|
110
|
+
* You can change the path with `path` option of `rbs_collection.yaml` file.
|
111
|
+
|
112
|
+
|
113
|
+
## How it works
|
114
|
+
|
115
|
+
`rbs collection` is integrated with Bundler.
|
116
|
+
`rbs collection install` command generates `gem_rbs_collection.lock.yaml` from `gem_rbs_collection.yaml` and `Gemfile.lock`. It uses `Gemfile.lock` to detects dependencies.
|
@@ -0,0 +1,140 @@
|
|
1
|
+
#include "rbs_extension.h"
|
2
|
+
|
3
|
+
VALUE RBS_Parser;
|
4
|
+
VALUE RBS_Parser_KEYWORDS;
|
5
|
+
|
6
|
+
VALUE RBS;
|
7
|
+
VALUE RBS_AST;
|
8
|
+
VALUE RBS_AST_Comment;
|
9
|
+
VALUE RBS_AST_Annotation;
|
10
|
+
|
11
|
+
VALUE RBS_AST_Declarations;
|
12
|
+
|
13
|
+
VALUE RBS_AST_Declarations_ModuleTypeParams;
|
14
|
+
VALUE RBS_AST_Declarations_ModuleTypeParams_TypeParam;
|
15
|
+
|
16
|
+
VALUE RBS_AST_Declarations_Alias;
|
17
|
+
VALUE RBS_AST_Declarations_Constant;
|
18
|
+
VALUE RBS_AST_Declarations_Global;
|
19
|
+
VALUE RBS_AST_Declarations_Interface;
|
20
|
+
VALUE RBS_AST_Declarations_Module;
|
21
|
+
VALUE RBS_AST_Declarations_Module_Self;
|
22
|
+
VALUE RBS_AST_Declarations_Class;
|
23
|
+
VALUE RBS_AST_Declarations_Class_Super;
|
24
|
+
|
25
|
+
VALUE RBS_AST_Members;
|
26
|
+
VALUE RBS_AST_Members_Alias;
|
27
|
+
VALUE RBS_AST_Members_AttrAccessor;
|
28
|
+
VALUE RBS_AST_Members_AttrReader;
|
29
|
+
VALUE RBS_AST_Members_AttrWriter;
|
30
|
+
VALUE RBS_AST_Members_ClassInstanceVariable;
|
31
|
+
VALUE RBS_AST_Members_ClassVariable;
|
32
|
+
VALUE RBS_AST_Members_Extend;
|
33
|
+
VALUE RBS_AST_Members_Include;
|
34
|
+
VALUE RBS_AST_Members_InstanceVariable;
|
35
|
+
VALUE RBS_AST_Members_MethodDefinition;
|
36
|
+
VALUE RBS_AST_Members_Prepend;
|
37
|
+
VALUE RBS_AST_Members_Private;
|
38
|
+
VALUE RBS_AST_Members_Public;
|
39
|
+
|
40
|
+
VALUE RBS_Namespace;
|
41
|
+
VALUE RBS_TypeName;
|
42
|
+
|
43
|
+
VALUE RBS_Types_Alias;
|
44
|
+
VALUE RBS_Types_Bases_Any;
|
45
|
+
VALUE RBS_Types_Bases_Bool;
|
46
|
+
VALUE RBS_Types_Bases_Bottom;
|
47
|
+
VALUE RBS_Types_Bases_Class;
|
48
|
+
VALUE RBS_Types_Bases_Instance;
|
49
|
+
VALUE RBS_Types_Bases_Nil;
|
50
|
+
VALUE RBS_Types_Bases_Self;
|
51
|
+
VALUE RBS_Types_Bases_Top;
|
52
|
+
VALUE RBS_Types_Bases_Void;
|
53
|
+
VALUE RBS_Types_Bases;
|
54
|
+
VALUE RBS_Types_Block;
|
55
|
+
VALUE RBS_Types_ClassInstance;
|
56
|
+
VALUE RBS_Types_ClassSingleton;
|
57
|
+
VALUE RBS_Types_Function_Param;
|
58
|
+
VALUE RBS_Types_Function;
|
59
|
+
VALUE RBS_Types_Interface;
|
60
|
+
VALUE RBS_Types_Intersection;
|
61
|
+
VALUE RBS_Types_Literal;
|
62
|
+
VALUE RBS_Types_Optional;
|
63
|
+
VALUE RBS_Types_Proc;
|
64
|
+
VALUE RBS_Types_Record;
|
65
|
+
VALUE RBS_Types_Tuple;
|
66
|
+
VALUE RBS_Types_Union;
|
67
|
+
VALUE RBS_Types_Variable;
|
68
|
+
VALUE RBS_Types;
|
69
|
+
VALUE RBS_MethodType;
|
70
|
+
|
71
|
+
VALUE RBS_ParsingError;
|
72
|
+
|
73
|
+
void rbs__init_constants() {
|
74
|
+
ID id_RBS = rb_intern_const("RBS");
|
75
|
+
|
76
|
+
RBS = rb_const_get(rb_cObject, id_RBS);
|
77
|
+
RBS_ParsingError = rb_const_get(RBS, rb_intern("ParsingError"));
|
78
|
+
RBS_AST = rb_const_get(RBS, rb_intern("AST"));
|
79
|
+
RBS_AST_Comment = rb_const_get(RBS_AST, rb_intern("Comment"));
|
80
|
+
RBS_AST_Annotation = rb_const_get(RBS_AST, rb_intern("Annotation"));
|
81
|
+
|
82
|
+
RBS_AST_Declarations = rb_const_get(RBS_AST, rb_intern("Declarations"));
|
83
|
+
|
84
|
+
RBS_AST_Declarations_ModuleTypeParams = rb_const_get(RBS_AST_Declarations, rb_intern("ModuleTypeParams"));
|
85
|
+
RBS_AST_Declarations_ModuleTypeParams_TypeParam = rb_const_get(RBS_AST_Declarations_ModuleTypeParams, rb_intern("TypeParam"));
|
86
|
+
|
87
|
+
RBS_AST_Declarations_Alias = rb_const_get(RBS_AST_Declarations, rb_intern("Alias"));
|
88
|
+
RBS_AST_Declarations_Constant = rb_const_get(RBS_AST_Declarations, rb_intern("Constant"));
|
89
|
+
RBS_AST_Declarations_Global = rb_const_get(RBS_AST_Declarations, rb_intern("Global"));
|
90
|
+
RBS_AST_Declarations_Interface = rb_const_get(RBS_AST_Declarations, rb_intern("Interface"));
|
91
|
+
RBS_AST_Declarations_Module = rb_const_get(RBS_AST_Declarations, rb_intern("Module"));
|
92
|
+
RBS_AST_Declarations_Module_Self = rb_const_get(RBS_AST_Declarations_Module, rb_intern("Self"));
|
93
|
+
RBS_AST_Declarations_Class = rb_const_get(RBS_AST_Declarations, rb_intern("Class"));
|
94
|
+
RBS_AST_Declarations_Class_Super = rb_const_get(RBS_AST_Declarations_Class, rb_intern("Super"));
|
95
|
+
|
96
|
+
RBS_AST_Members = rb_const_get(RBS_AST, rb_intern("Members"));
|
97
|
+
RBS_AST_Members_Alias = rb_const_get(RBS_AST_Members, rb_intern("Alias"));
|
98
|
+
RBS_AST_Members_AttrAccessor = rb_const_get(RBS_AST_Members, rb_intern("AttrAccessor"));
|
99
|
+
RBS_AST_Members_AttrReader = rb_const_get(RBS_AST_Members, rb_intern("AttrReader"));
|
100
|
+
RBS_AST_Members_AttrWriter = rb_const_get(RBS_AST_Members, rb_intern("AttrWriter"));
|
101
|
+
RBS_AST_Members_ClassInstanceVariable = rb_const_get(RBS_AST_Members, rb_intern("ClassInstanceVariable"));
|
102
|
+
RBS_AST_Members_ClassVariable = rb_const_get(RBS_AST_Members, rb_intern("ClassVariable"));
|
103
|
+
RBS_AST_Members_Extend = rb_const_get(RBS_AST_Members, rb_intern("Extend"));
|
104
|
+
RBS_AST_Members_Include = rb_const_get(RBS_AST_Members, rb_intern("Include"));
|
105
|
+
RBS_AST_Members_InstanceVariable = rb_const_get(RBS_AST_Members, rb_intern("InstanceVariable"));
|
106
|
+
RBS_AST_Members_MethodDefinition = rb_const_get(RBS_AST_Members, rb_intern("MethodDefinition"));
|
107
|
+
RBS_AST_Members_Prepend = rb_const_get(RBS_AST_Members, rb_intern("Prepend"));
|
108
|
+
RBS_AST_Members_Private = rb_const_get(RBS_AST_Members, rb_intern("Private"));
|
109
|
+
RBS_AST_Members_Public = rb_const_get(RBS_AST_Members, rb_intern("Public"));
|
110
|
+
|
111
|
+
RBS_Namespace = rb_const_get(RBS, rb_intern("Namespace"));
|
112
|
+
RBS_TypeName = rb_const_get(RBS, rb_intern("TypeName"));
|
113
|
+
RBS_Types = rb_const_get(RBS, rb_intern("Types"));
|
114
|
+
RBS_Types_Alias = rb_const_get(RBS_Types, rb_intern("Alias"));
|
115
|
+
RBS_Types_Bases = rb_const_get(RBS_Types, rb_intern("Bases"));
|
116
|
+
RBS_Types_Bases_Any = rb_const_get(RBS_Types_Bases, rb_intern("Any"));
|
117
|
+
RBS_Types_Bases_Bool = rb_const_get(RBS_Types_Bases, rb_intern("Bool"));
|
118
|
+
RBS_Types_Bases_Bottom = rb_const_get(RBS_Types_Bases, rb_intern("Bottom"));
|
119
|
+
RBS_Types_Bases_Class = rb_const_get(RBS_Types_Bases, rb_intern("Class"));
|
120
|
+
RBS_Types_Bases_Instance = rb_const_get(RBS_Types_Bases, rb_intern("Instance"));
|
121
|
+
RBS_Types_Bases_Nil = rb_const_get(RBS_Types_Bases, rb_intern("Nil"));
|
122
|
+
RBS_Types_Bases_Self = rb_const_get(RBS_Types_Bases, rb_intern("Self"));
|
123
|
+
RBS_Types_Bases_Top = rb_const_get(RBS_Types_Bases, rb_intern("Top"));
|
124
|
+
RBS_Types_Bases_Void = rb_const_get(RBS_Types_Bases, rb_intern("Void"));
|
125
|
+
RBS_Types_Block = rb_const_get(RBS_Types, rb_intern("Block"));
|
126
|
+
RBS_Types_ClassInstance = rb_const_get(RBS_Types, rb_intern("ClassInstance"));
|
127
|
+
RBS_Types_ClassSingleton = rb_const_get(RBS_Types, rb_intern("ClassSingleton"));
|
128
|
+
RBS_Types_Function = rb_const_get(RBS_Types, rb_intern("Function"));
|
129
|
+
RBS_Types_Function_Param = rb_const_get(RBS_Types_Function, rb_intern("Param"));
|
130
|
+
RBS_Types_Interface = rb_const_get(RBS_Types, rb_intern("Interface"));
|
131
|
+
RBS_Types_Intersection = rb_const_get(RBS_Types, rb_intern("Intersection"));
|
132
|
+
RBS_Types_Literal = rb_const_get(RBS_Types, rb_intern("Literal"));
|
133
|
+
RBS_Types_Optional = rb_const_get(RBS_Types, rb_intern("Optional"));
|
134
|
+
RBS_Types_Proc = rb_const_get(RBS_Types, rb_intern("Proc"));
|
135
|
+
RBS_Types_Record = rb_const_get(RBS_Types, rb_intern("Record"));
|
136
|
+
RBS_Types_Tuple = rb_const_get(RBS_Types, rb_intern("Tuple"));
|
137
|
+
RBS_Types_Union = rb_const_get(RBS_Types, rb_intern("Union"));
|
138
|
+
RBS_Types_Variable = rb_const_get(RBS_Types, rb_intern("Variable"));
|
139
|
+
RBS_MethodType = rb_const_get(RBS, rb_intern("MethodType"));
|
140
|
+
}
|