rspec-sorbet 1.8.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +5 -0
- data/.github/workflows/ci.yml +19 -51
- data/.gitignore +2 -1
- data/.rubocop.yml +16 -60
- data/CHANGELOG.md +53 -22
- data/Gemfile +15 -16
- data/README.md +16 -3
- data/Rakefile +3 -1
- data/bin/console +4 -3
- data/bin/rbi +6 -0
- data/bin/rspec +27 -0
- data/bin/rubocop +27 -0
- data/bin/setup +0 -2
- data/bin/tapioca +31 -0
- data/generate_require_files.rb +10 -10
- data/lib/rspec/all.rb +2 -2
- data/lib/rspec/sorbet/all.rb +2 -2
- data/lib/rspec/sorbet/doubles.rb +74 -13
- data/lib/rspec/sorbet/version.rb +1 -1
- data/lib/rspec/sorbet.rb +1 -1
- data/rspec-sorbet.gemspec +20 -18
- metadata +27 -84
- data/.reek.yml +0 -32
- data/.ruby-version +0 -1
- data/sorbet/config +0 -2
- data/sorbet/rbi/gems/activesupport.rbi +0 -1722
- data/sorbet/rbi/gems/ast.rbi +0 -48
- data/sorbet/rbi/gems/byebug.rbi +0 -1041
- data/sorbet/rbi/gems/coderay.rbi +0 -285
- data/sorbet/rbi/gems/concurrent-ruby.rbi +0 -1586
- data/sorbet/rbi/gems/docile.rbi +0 -32
- data/sorbet/rbi/gems/em-websocket.rbi +0 -225
- data/sorbet/rbi/gems/eventmachine.rbi +0 -489
- data/sorbet/rbi/gems/ffaker.rbi +0 -60
- data/sorbet/rbi/gems/guard.rbi +0 -397
- data/sorbet/rbi/gems/http_parser.rb.rbi +0 -37
- data/sorbet/rbi/gems/i18n.rbi +0 -133
- data/sorbet/rbi/gems/kwalify.rbi +0 -340
- data/sorbet/rbi/gems/listen.rbi +0 -324
- data/sorbet/rbi/gems/lumberjack.rbi +0 -300
- data/sorbet/rbi/gems/method_source.rbi +0 -64
- data/sorbet/rbi/gems/multi_json.rbi +0 -62
- data/sorbet/rbi/gems/nenv.rbi +0 -60
- data/sorbet/rbi/gems/notiffany.rbi +0 -215
- data/sorbet/rbi/gems/parallel.rbi +0 -82
- data/sorbet/rbi/gems/parser.rbi +0 -1846
- data/sorbet/rbi/gems/pry-byebug.rbi +0 -155
- data/sorbet/rbi/gems/pry.rbi +0 -1949
- data/sorbet/rbi/gems/rainbow.rbi +0 -118
- data/sorbet/rbi/gems/rake.rbi +0 -648
- data/sorbet/rbi/gems/rb-fsevent.rbi +0 -31
- data/sorbet/rbi/gems/rb-readline.rbi +0 -767
- data/sorbet/rbi/gems/reek.rbi +0 -1027
- data/sorbet/rbi/gems/regexp_parser.rbi +0 -913
- data/sorbet/rbi/gems/rexml.rbi +0 -605
- data/sorbet/rbi/gems/rspec-core.rbi +0 -1913
- data/sorbet/rbi/gems/rspec-expectations.rbi +0 -1123
- data/sorbet/rbi/gems/rspec-mocks.rbi +0 -1099
- data/sorbet/rbi/gems/rspec-support.rbi +0 -280
- data/sorbet/rbi/gems/rspec.rbi +0 -15
- data/sorbet/rbi/gems/rubocop-ast.rbi +0 -1053
- data/sorbet/rbi/gems/rubocop-rspec.rbi +0 -937
- data/sorbet/rbi/gems/rubocop.rbi +0 -6841
- data/sorbet/rbi/gems/ruby-progressbar.rbi +0 -305
- data/sorbet/rbi/gems/shellany.rbi +0 -29
- data/sorbet/rbi/gems/shoulda-matchers.rbi +0 -1848
- data/sorbet/rbi/gems/simplecov-html.rbi +0 -35
- data/sorbet/rbi/gems/simplecov.rbi +0 -361
- data/sorbet/rbi/gems/sqlite3.rbi +0 -354
- data/sorbet/rbi/gems/stackprof.rbi +0 -52
- data/sorbet/rbi/gems/thor.rbi +0 -32
- data/sorbet/rbi/gems/thread_safe.rbi +0 -82
- data/sorbet/rbi/gems/timecop.rbi +0 -98
- data/sorbet/rbi/gems/tzinfo.rbi +0 -406
- data/sorbet/rbi/gems/unicode-display_width.rbi +0 -17
- data/sorbet/rbi/hidden-definitions/errors.txt +0 -7275
- data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -14595
- data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6.0.0.rc1/activesupport.rbi +0 -23
- data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +0 -1431
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +0 -108
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +0 -276
- data/sorbet/rbi/sorbet-typed/lib/rubocop/~>0.85/rubocop.rbi +0 -2072
- data/sorbet/rbi/sorbet-typed/lib/rubocop-rspec/~>1.39/rubocop-rspec.rbi +0 -398
- data/sorbet/rbi/todo.rbi +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e49df5d697e2d441b06483b44261e8edb5ac59b7003c5356d88d6be106db79e
|
4
|
+
data.tar.gz: 17aebafd7cd92d511915bced0d87279e8a0a271ba4ed593a7cdd465c5514c31c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d37e33a3218ebde8de313aa0707c690f1d06c28b04f552dcc6611d09334d52b73a4aeafc50b132fdc7c1266f1a430a2affffc17928857ecebdefa788e081fa6
|
7
|
+
data.tar.gz: 777a239771115649469b1eff69936a5bd64c1815915ee322300028864d44092481d94b637c0b778b85020a965b900af7d3414ab903dc0ee703cd4dfabc18c47d
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,56 +1,24 @@
|
|
1
|
-
---
|
2
1
|
name: Continuous Integration
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
|
3
|
+
on: push
|
4
|
+
|
5
|
+
permissions:
|
6
|
+
contents: read
|
7
|
+
|
8
8
|
jobs:
|
9
|
-
|
10
|
-
runs-on: ubuntu-
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: ['3.1']
|
11
14
|
steps:
|
12
|
-
-
|
13
|
-
uses: actions/checkout@v2
|
14
|
-
- name: Extract branch name
|
15
|
-
shell: bash
|
16
|
-
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
17
|
-
id: extract_branch
|
18
|
-
- name: Install Linux dependencies
|
19
|
-
run: sudo apt-get update -qq && sudo apt-get install -y libsqlite3-dev
|
15
|
+
- uses: actions/checkout@v3
|
20
16
|
- name: Set up Ruby
|
21
|
-
uses:
|
17
|
+
uses: ruby/setup-ruby@v1
|
22
18
|
with:
|
23
|
-
ruby-version:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
}}"
|
30
|
-
restore-keys: "${{ runner.OS }}-gem-cache-\n"
|
31
|
-
- name: Install bundler
|
32
|
-
run: (bundler -v | grep "2.1.4") || gem install bundler:2.1.4
|
33
|
-
- name: Remove metrics from bundled gems
|
34
|
-
run: bundle config set without 'metrics'
|
35
|
-
- name: Install gems
|
36
|
-
run: bundle install --jobs $(nproc) --retry 3 --path vendor/bundle
|
37
|
-
- name: Create cache directory
|
38
|
-
run: mkdir -p tmp/cache
|
39
|
-
- name: Typecheck with Sorbet
|
40
|
-
run: bundle exec srb tc . --ignore=/vendor
|
41
|
-
- name: Run RSpec test suite
|
42
|
-
run: bundle exec rspec spec
|
43
|
-
env:
|
44
|
-
METRICS: '1'
|
45
|
-
- name: Post to Slack if build fails
|
46
|
-
if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stable')
|
47
|
-
uses: pullreminders/slack-action@master
|
48
|
-
env:
|
49
|
-
SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}"
|
50
|
-
with:
|
51
|
-
args: '{\"channel\":\"C33574SJJ\",\"text\":\"* ${{ github.repository }} BUILD
|
52
|
-
FAILURE*\", \"attachments\": [{ \"fallback\": \"Failure summary\", \"color\":
|
53
|
-
\"#ff0000\", \"fields\": [{\"title\": \"Branch\", \"value\":\"${{ steps.extract_branch.outputs.branch
|
54
|
-
}}\"}, {\"title\": \"Who broke it\", \"value\":\"${{ github.actor }}\"},
|
55
|
-
{ \"title\": \"Build output\", \"value\": \"https://github.com/${{ github.repository
|
56
|
-
}}/commit/${{ github.sha }}/checks\", \"short\": false }]}]}'
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Run RSpec tests
|
22
|
+
run: bin/rspec
|
23
|
+
- name: Check for Rubocop offenses
|
24
|
+
run: bin/rubocop --format github
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,66 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Enabled: true
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-shopify: rubocop.yml
|
3
|
+
require: rubocop-rspec
|
4
|
+
|
6
5
|
AllCops:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Exclude:
|
12
|
-
- app/assets/**/*
|
13
|
-
- bin/**/*
|
14
|
-
- client/node_modules/**/*
|
15
|
-
- config/**/*
|
16
|
-
- coverage/**/*
|
17
|
-
- data/**/*
|
18
|
-
- db/**/*
|
19
|
-
- db_*/**/*
|
20
|
-
- dw/**/*
|
21
|
-
- log/**/*
|
22
|
-
- phrase/**/*
|
23
|
-
- public/**/*
|
24
|
-
- tmp/**/*
|
25
|
-
- vendor/**/*
|
26
|
-
TargetRubyVersion: 2.5
|
27
|
-
Metrics/LineLength:
|
28
|
-
Max: 100
|
29
|
-
Layout/MultilineMethodCallIndentation:
|
30
|
-
EnforcedStyle: indented
|
31
|
-
Style/PercentLiteralDelimiters:
|
32
|
-
PreferredDelimiters:
|
33
|
-
"%w": "[]"
|
34
|
-
RSpec/ExampleLength:
|
35
|
-
Enabled: false
|
36
|
-
Max: 10
|
37
|
-
RSpec/MultipleExpectations:
|
38
|
-
Enabled: false
|
39
|
-
Max: 10
|
40
|
-
RSpec/NestedGroups:
|
41
|
-
Enabled: false
|
42
|
-
Max: 10
|
43
|
-
RSpec/MessageExpectation:
|
6
|
+
NewCops: disable
|
7
|
+
SuggestExtensions: false
|
8
|
+
|
9
|
+
RSpec/LeakyConstantDeclaration:
|
44
10
|
Enabled: false
|
45
|
-
|
46
|
-
|
47
|
-
require:
|
48
|
-
- rubocop-performance
|
49
|
-
- rubocop-rspec
|
50
|
-
- test_prof/rubocop
|
51
|
-
Metrics/BlockLength:
|
52
|
-
Enabled: false
|
53
|
-
RSpec/MessageSpies:
|
54
|
-
Enabled: false
|
55
|
-
RSpec/ExpectInHook:
|
11
|
+
|
12
|
+
RSpec/ExampleLength:
|
56
13
|
Enabled: false
|
57
|
-
|
58
|
-
|
59
|
-
Include:
|
60
|
-
- spec/**/*.rb
|
61
|
-
Rails/InverseOf:
|
14
|
+
|
15
|
+
RSpec/NamedSubject:
|
62
16
|
Enabled: false
|
63
|
-
|
17
|
+
|
18
|
+
RSpec/MultipleExpectations:
|
64
19
|
Enabled: false
|
65
|
-
|
20
|
+
|
21
|
+
RSpec/VerifiedDoubles:
|
66
22
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,41 +1,72 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
## 1.9.2
|
4
4
|
|
5
|
-
|
5
|
+
- Rubocop offenses resolved
|
6
|
+
- Sorbet signatures added to `RSpec::Sorbet::Doubles`
|
7
|
+
- Added `RSpec::Sorbet.reset!` to restore handlers to previous state
|
8
|
+
- Added fix to prevent `SystemStackError` by keeping track of when handlers have been configured. (thanks [@alex-tan](https://github.com/alex-tan))
|
9
|
+
- Added logic to pass type error onwards to existing inline type error handler.
|
10
|
+
- Slimmed down Gem RBIs to minimum needed for `srb tc` to pass in development.
|
6
11
|
|
7
|
-
|
12
|
+
## 1.9.1
|
8
13
|
|
9
|
-
|
14
|
+
- Support `T.nilable(T.class_of(...))` among others (thanks [@deecewan](https://github.com/deecewan))
|
10
15
|
|
11
|
-
|
16
|
+
## 1.9.0
|
12
17
|
|
13
|
-
|
18
|
+
- Allow specification of a custom validation handler (thanks [@bmalinconico](https://github.com/bmalinconico))
|
14
19
|
|
15
|
-
|
20
|
+
## 1.8.3
|
16
21
|
|
17
|
-
|
22
|
+
- Make sorbet a development dependency
|
18
23
|
|
19
|
-
|
24
|
+
## 1.8.2
|
20
25
|
|
21
|
-
|
26
|
+
- Reduce gem size by excluding RBIs from gem build
|
22
27
|
|
23
|
-
|
24
|
-
* `RSpec::Sorbet.allow_instance_doubles!` has been renamed to `RSpec::Sorbet.allow_doubles!`, an alias remains for backwards compatibility for the time being.
|
28
|
+
## 1.8.1
|
25
29
|
|
26
|
-
|
30
|
+
- [BUGFIX] Fix processing T.let type mismatch messages when there are digits in module name
|
27
31
|
|
28
|
-
|
32
|
+
## 1.8.0
|
29
33
|
|
30
|
-
|
34
|
+
- Fixed issues around union types referencing typed enumerables.
|
31
35
|
|
32
|
-
|
36
|
+
## 1.7.0
|
33
37
|
|
34
|
-
|
38
|
+
- Added support `T.class_of`.
|
35
39
|
|
36
|
-
|
40
|
+
## 1.6.0
|
37
41
|
|
38
|
-
|
42
|
+
- Non-verifying double support improved.
|
39
43
|
|
40
|
-
|
41
|
-
|
44
|
+
## 1.5.0
|
45
|
+
|
46
|
+
- Added support for `T.cast`.
|
47
|
+
|
48
|
+
## 1.4.0
|
49
|
+
|
50
|
+
- Added support for `T.let` referencing `T.nilable` types.
|
51
|
+
|
52
|
+
## 1.3.0
|
53
|
+
|
54
|
+
- Added ability to allow any kind of double (Class, Instance, Object).
|
55
|
+
- `RSpec::Sorbet.allow_instance_doubles!` has been renamed to `RSpec::Sorbet.allow_doubles!`, an alias remains for backwards compatibility for the time being.
|
56
|
+
|
57
|
+
## 1.2.1
|
58
|
+
|
59
|
+
- Fix call check when opts contains :message instead of :pretty_message.
|
60
|
+
|
61
|
+
## 1.2.0
|
62
|
+
|
63
|
+
- Added support for verifying `T::Enumerable` types.
|
64
|
+
|
65
|
+
## 1.1.0
|
66
|
+
|
67
|
+
- Add basic `instance_double` verification to help check the type of an instance double.
|
68
|
+
|
69
|
+
## 1.0.0
|
70
|
+
|
71
|
+
- Initial release
|
72
|
+
- Supports just allowing instance doubles for now
|
data/Gemfile
CHANGED
@@ -1,25 +1,24 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in rspec-sorbet.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
8
|
group :development, :test do
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem 'sqlite3'
|
18
|
-
gem 'stackprof'
|
19
|
-
gem 'timecop'
|
9
|
+
gem "guard-livereload", require: false
|
10
|
+
gem "guard-rspec"
|
11
|
+
gem "pry-byebug"
|
12
|
+
gem "rb-fsevent", require: false
|
13
|
+
gem "rspec"
|
14
|
+
gem "rubocop-rspec"
|
15
|
+
gem "rubocop-shopify"
|
16
|
+
gem "rubocop"
|
17
|
+
gem "stackprof"
|
18
|
+
gem "tapioca"
|
20
19
|
end
|
21
20
|
|
22
21
|
group :test do
|
23
|
-
gem
|
24
|
-
gem
|
22
|
+
gem "ffaker"
|
23
|
+
gem "rspec-github", require: false
|
25
24
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
![rspec-sorbet](https://user-images.githubusercontent.com/2643026/63100456-02c12c00-bf6f-11e9-8430-630a27bc6e42.png)
|
2
2
|
|
3
|
-
# RSpec Sorbet [![Gem Version](https://badge.fury.io/rb/rspec-sorbet.svg)](https://badge.fury.io/rb/rspec-sorbet) ![CI Badge](https://github.com/
|
3
|
+
# RSpec Sorbet [![Gem Version](https://badge.fury.io/rb/rspec-sorbet.svg)](https://badge.fury.io/rb/rspec-sorbet) ![CI Badge](https://github.com/samuelgiles/rspec-sorbet/workflows/Continuous%20Integration/badge.svg)
|
4
4
|
|
5
5
|
A small gem consisting of helpers for using Sorbet & RSpec together.
|
6
6
|
|
@@ -19,7 +19,7 @@ require 'rspec/sorbet'
|
|
19
19
|
|
20
20
|
Out of the box if you're using `instance_double`, `class_double` or `object_double` in your specs you'll encounter errors such as the following:
|
21
21
|
|
22
|
-
```
|
22
|
+
```ruby
|
23
23
|
TypeError:
|
24
24
|
Parameter 'my_parameter': Expected type MyObject, got type RSpec::Mocks::InstanceVerifyingDouble with value #<InstanceDouble(MyObject) (anonymous)>
|
25
25
|
Caller: /Users/samuelgiles/Documents/Projects/Clients/Bellroy/bellroy/spec/lib/checkout/use_cases/my_use_case.rb:9
|
@@ -33,4 +33,17 @@ RSpec::Sorbet.allow_doubles!
|
|
33
33
|
|
34
34
|
### `eq` matcher usage with `T::Struct`'s
|
35
35
|
|
36
|
-
Using the [`eq` matcher](https://www.rubydoc.info/github/rspec/rspec-expectations/RSpec%2FMatchers:eq) to compare [`T::Struct`'s](https://sorbet.org/docs/tstruct) might not behave as you'd expect whereby two separate instances of the same struct class with identical attributes are not `==` out of the box. The standalone [sorbet-struct-comparable](https://github.com/
|
36
|
+
Using the [`eq` matcher](https://www.rubydoc.info/github/rspec/rspec-expectations/RSpec%2FMatchers:eq) to compare [`T::Struct`'s](https://sorbet.org/docs/tstruct) might not behave as you'd expect whereby two separate instances of the same struct class with identical attributes are not `==` out of the box. The standalone [sorbet-struct-comparable](https://github.com/samuelgiles/sorbet-struct-comparable) gem may be of interest if you are looking for a simple attribute based comparison that will help make the `eq` matcher behave as you expect.
|
37
|
+
|
38
|
+
### Specifying a custom validation handler
|
39
|
+
|
40
|
+
You can customise the handler of Sorbet validation errors if you so desire.
|
41
|
+
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
def handler(signature, opts)
|
45
|
+
raise MyCustomException, "The options were #{opts}"
|
46
|
+
end
|
47
|
+
|
48
|
+
T::Configuration.call_validation_error_handler = handler
|
49
|
+
```
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require "bundler/setup"
|
5
|
+
require "rspec/sorbet"
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require 'rspec/sorbet'
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require "irb"
|
14
15
|
IRB.start(__FILE__)
|
data/bin/rbi
ADDED
data/bin/rspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/setup
CHANGED
data/bin/tapioca
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'tapioca' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
|
13
|
+
"../../Gemfile",
|
14
|
+
Pathname.new(__FILE__).realpath,
|
15
|
+
)
|
16
|
+
|
17
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
18
|
+
|
19
|
+
if File.file?(bundle_binstub)
|
20
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
21
|
+
load(bundle_binstub)
|
22
|
+
else
|
23
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
24
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
require "rubygems"
|
29
|
+
require "bundler/setup"
|
30
|
+
|
31
|
+
load Gem.bin_path("tapioca", "tapioca")
|
data/generate_require_files.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
# typed: true
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
BASE_FOLDER_PATH =
|
4
|
+
BASE_FOLDER_PATH = "rspec"
|
5
5
|
|
6
6
|
def directories_in(root)
|
7
7
|
Dir.entries(root).sort.select do |entry|
|
8
8
|
fully_qualified_entry = File.join(root, entry)
|
9
|
-
File.directory?(fully_qualified_entry) && ![
|
9
|
+
File.directory?(fully_qualified_entry) && ![".", ".."].include?(entry.to_s)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def files_in(root)
|
14
14
|
Dir.entries(root).sort.reject do |entry|
|
15
15
|
fully_qualified_entry = File.join(root, entry)
|
16
|
-
File.directory?(fully_qualified_entry) || entry.to_s ==
|
16
|
+
File.directory?(fully_qualified_entry) || entry.to_s == "all.rb" || entry[-3..-1] != ".rb"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def recursive_files_in(root)
|
21
|
-
full_paths = Dir.glob(File.join(root,
|
21
|
+
full_paths = Dir.glob(File.join(root, "**", "*")).sort.reject do |entry|
|
22
22
|
fully_qualified_entry = File.join(root, entry)
|
23
|
-
File.directory?(fully_qualified_entry) || entry[-7..-1] ==
|
23
|
+
File.directory?(fully_qualified_entry) || entry[-7..-1] == "/all.rb" || entry[-3..-1] != ".rb"
|
24
24
|
end
|
25
25
|
|
26
|
-
remove_path = root.split(
|
27
|
-
full_paths.map { |full_path| full_path.gsub(remove_path,
|
26
|
+
remove_path = root.split("/")[0..-2].join("/") + "/"
|
27
|
+
full_paths.map { |full_path| full_path.gsub(remove_path, "") }
|
28
28
|
end
|
29
29
|
|
30
30
|
def write_require_file(root, require_directories, require_files)
|
31
|
-
require_file_path = File.join(root,
|
32
|
-
File.open(require_file_path,
|
31
|
+
require_file_path = File.join(root, "all.rb")
|
32
|
+
File.open(require_file_path, "w") do |file|
|
33
33
|
file.write("# frozen_string_literal: true\n\n")
|
34
34
|
file.write("# THIS FILE IS AUTOGENERATED AND SHOULD NOT BE MANUALLY MODIFIED\n\n")
|
35
35
|
require_directories.each do |require_directory|
|
@@ -40,7 +40,7 @@ def write_require_file(root, require_directories, require_files)
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
root = File.join(__dir__,
|
43
|
+
root = File.join(__dir__, "lib", BASE_FOLDER_PATH)
|
44
44
|
directories = directories_in(root)
|
45
45
|
write_require_file(root, directories, files_in(root))
|
46
46
|
directories.each do |directory|
|
data/lib/rspec/all.rb
CHANGED
data/lib/rspec/sorbet/all.rb
CHANGED