sorbet-runtime-stub 0.1.4
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 +9 -0
- data/README.md +57 -0
- data/Rakefile +2 -0
- data/lib/sorbet-runtime-stub.rb +140 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28842eac1f246fb87f48035e1b8744a39ac2b617ae9ce0368343fe1372bad270
|
4
|
+
data.tar.gz: 24d7ac572b3486b5c0b5972318dd2d0dc9edde21928be92d87ee1a7fa3ac93c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eb1f59083dbc03b89c703d1f7c50bb34c2bfebd61f274e9a03405cb8d69af9e47fc02be89285300f799b9787aee25d5d3907c3e287099a1e18ff643e59114b4a
|
7
|
+
data.tar.gz: a8ef5a270bb6a77187b177bb5f361b9b57ce68a1d874346c61158ea89b3c5b3532a8e321c1480ae08a0bdf200b9af7569a9693a302df1e4f2767cffdf48b086b
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# sorbet-runtime-stub
|
2
|
+
|
3
|
+
This gem provides stub definitions for all the `T` namespace that Sorbet type signatures need for runtime. This is appropriate for people who want nothing to do with `sorbet-runtime` when their code is being run.
|
4
|
+
|
5
|
+
**Disclaimer**: This gem is being used in our applications but there are some still features missing and it may have some sharp edges.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'sorbet-runtime-stub'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install sorbet-runtime-stub
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Your code should decide to switch between requiring `sorbet-runtime` or `sorbet-runtime-stub`.
|
26
|
+
|
27
|
+
For example, if you don't want to load `sorbet-runtime` in a production environment in a Rails app, you can use:
|
28
|
+
```ruby
|
29
|
+
if ENV['RAILS_ENV'] == 'production'
|
30
|
+
require 'sorbet-runtime-stub'
|
31
|
+
else
|
32
|
+
require 'sorbet-runtime'
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
## Missing features
|
37
|
+
|
38
|
+
Some feature from sorbet-runtime like `T::Enum` and `T::Struct` as still not supported.
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/sorbet-runtime-stub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Shopify/sorbet-runtime-stub/blob/master/CODE_OF_CONDUCT.md).
|
49
|
+
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
54
|
+
|
55
|
+
## Code of Conduct
|
56
|
+
|
57
|
+
Everyone interacting in the Sorbet::Runtime::Stub project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Shopify/sorbet-runtime-stub/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# typed: ignore
|
2
|
+
|
3
|
+
module T
|
4
|
+
class << self
|
5
|
+
def absurd(value); end
|
6
|
+
def all(type_a, type_b, *types); end
|
7
|
+
def any(type_a, type_b, *types); end
|
8
|
+
def attached_class; end
|
9
|
+
def class_of(klass); end
|
10
|
+
def enum(values); end
|
11
|
+
def nilable(type); end
|
12
|
+
def noreturn; end
|
13
|
+
def self_type; end
|
14
|
+
def type_alias(type=nil, &_blk); end
|
15
|
+
def type_parameter(name); end
|
16
|
+
def untyped; end
|
17
|
+
|
18
|
+
def assert_type!(value, _type, _checked: true)
|
19
|
+
value
|
20
|
+
end
|
21
|
+
|
22
|
+
def cast(value, _type, _checked: true)
|
23
|
+
value
|
24
|
+
end
|
25
|
+
|
26
|
+
def let(value, _type, _checked: true)
|
27
|
+
value
|
28
|
+
end
|
29
|
+
|
30
|
+
def must(arg, _msg = nil)
|
31
|
+
arg
|
32
|
+
end
|
33
|
+
|
34
|
+
def proc
|
35
|
+
T::Proc.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def reveal_type(value)
|
39
|
+
value
|
40
|
+
end
|
41
|
+
|
42
|
+
def unsafe(value)
|
43
|
+
value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module Sig
|
48
|
+
def sig(&blk); end
|
49
|
+
end
|
50
|
+
|
51
|
+
module Helpers
|
52
|
+
def abstract!; end
|
53
|
+
def interface!; end
|
54
|
+
def final!; end
|
55
|
+
def sealed!; end
|
56
|
+
def mixes_in_class_methods(mod); end
|
57
|
+
end
|
58
|
+
|
59
|
+
module Generic
|
60
|
+
include T::Helpers
|
61
|
+
|
62
|
+
def type_parameters(*params); end
|
63
|
+
def type_member(variance=:invariant, fixed: nil, lower: nil, upper: BasicObject); end
|
64
|
+
def type_template(variance=:invariant, fixed: nil, lower: nil, upper: BasicObject); end
|
65
|
+
|
66
|
+
def [](*types)
|
67
|
+
self
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
module Array
|
72
|
+
def self.[](type); end
|
73
|
+
end
|
74
|
+
|
75
|
+
Boolean = Object.new.freeze
|
76
|
+
|
77
|
+
module Configuration
|
78
|
+
def self.call_validation_error_handler(signature, opts); end
|
79
|
+
def self.call_validation_error_handler=(value); end
|
80
|
+
def self.default_checked_level=(default_checked_level); end
|
81
|
+
def self.enable_checking_for_sigs_marked_checked_tests; end
|
82
|
+
def self.enable_final_checks_on_hooks; end
|
83
|
+
def self.enable_legacy_t_enum_migration_mode; end
|
84
|
+
def self.reset_final_checks_on_hooks; end
|
85
|
+
def self.hard_assert_handler(str, extra); end
|
86
|
+
def self.hard_assert_handler=(value); end
|
87
|
+
def self.inline_type_error_handler(error); end
|
88
|
+
def self.inline_type_error_handler=(value); end
|
89
|
+
def self.log_info_handler(str, extra); end
|
90
|
+
def self.log_info_handler=(value); end
|
91
|
+
def self.scalar_types; end
|
92
|
+
def self.scalar_types=(values); end
|
93
|
+
def self.sealed_violation_whitelist; end
|
94
|
+
def self.sealed_violation_whitelist=(sealed_violation_whitelist); end
|
95
|
+
def self.sig_builder_error_handler(error, location); end
|
96
|
+
def self.sig_builder_error_handler=(value); end
|
97
|
+
def self.sig_validation_error_handler(error, opts); end
|
98
|
+
def self.sig_validation_error_handler=(value); end
|
99
|
+
def self.soft_assert_handler(str, extra); end
|
100
|
+
def self.soft_assert_handler=(value); end
|
101
|
+
end
|
102
|
+
|
103
|
+
module Enumerable
|
104
|
+
def self.[](type); end
|
105
|
+
end
|
106
|
+
|
107
|
+
module Enumerator
|
108
|
+
def self.[](type); end
|
109
|
+
end
|
110
|
+
|
111
|
+
module Hash
|
112
|
+
def self.[](keys, values); end
|
113
|
+
end
|
114
|
+
|
115
|
+
class Proc
|
116
|
+
def bind(*_)
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
def params(*_param)
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
def void
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
def returns(_type)
|
129
|
+
self
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
module Range
|
134
|
+
def self.[](type); end
|
135
|
+
end
|
136
|
+
|
137
|
+
module Set
|
138
|
+
def self.[](type); end
|
139
|
+
end
|
140
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sorbet-runtime-stub
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shopify
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- ruby@shopify.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- README.md
|
22
|
+
- Rakefile
|
23
|
+
- lib/sorbet-runtime-stub.rb
|
24
|
+
homepage: https://github.com/Shopify/sorbet-runtime-stub
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata:
|
28
|
+
allowed_push_host: https://rubygems.org
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubygems_version: 3.0.3
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: A stub definition provider for Sorbet runtime dependencies
|
48
|
+
test_files: []
|