sorbet 0.4.4250 → 0.4.4253

Sign up to get free protection for your applications and to get access to all the features.
data/lib/status.rb ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ module Sorbet::Private::Status
5
+ def self.say(message, print_without_tty: true)
6
+ if STDOUT.isatty
7
+ # Carriage return to reset cursor, ANSI escape code to clear current line.
8
+ # (In case the new message is shorter than the old message.)
9
+ print "\r\033[K#{message}"
10
+ elsif print_without_tty
11
+ puts message
12
+ end
13
+ end
14
+
15
+ def self.done
16
+ if STDOUT.isatty
17
+ # Clear the require_relative output when we're done requiring.
18
+ print "\r\033[K"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Sorbet; end
4
+ module Sorbet::Private; end
5
+ module Sorbet::Private::StepInterface
6
+ def self.main
7
+ end
8
+
9
+ def self.output_file
10
+ end
11
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative './step_interface'
5
+
6
+ class Sorbet; end
7
+ module Sorbet::Private; end
8
+ class Sorbet::Private::SuggestTyped
9
+ include Sorbet::Private::StepInterface
10
+
11
+ def self.main
12
+ count = 0
13
+ while count < 100
14
+ count += 1
15
+ if suggest_typed
16
+ return true
17
+ end
18
+ end
19
+ puts "Adding `typed:` sigils did not converge after 100 tries."
20
+ false
21
+ end
22
+
23
+ def self.suggest_typed
24
+ IO.popen(
25
+ [File.realpath("#{__dir__}/../bin/srb"), 'tc', '--suggest-typed', '--error-white-list=7022', '--typed=strict', '--silence-dev-message', '-a'],
26
+ err: [:child, :out],
27
+ ) do |io|
28
+ out = io.read
29
+ return true if out == "No errors! Great job.\n"
30
+ end
31
+ false
32
+ end
33
+
34
+ def self.output_file
35
+ nil
36
+ end
37
+ end
38
+
39
+ if $PROGRAM_NAME == __FILE__
40
+ Sorbet::Private::SuggestTyped.main
41
+ end
data/lib/t.rb ADDED
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # typed: false
3
+
4
+ # This file contains runtime stubs to make `T::Sig::WithoutRuntime.sig` work in
5
+ # the runtime. We're using `T::Sig::WithoutRuntime.sig` in this gem because we
6
+ # don't want to have to depend on the sorbet-runtime gem.
7
+
8
+ # Note that in particular because sigs are lazily evaluated and
9
+ # `T::Sig::WithoutRuntime.sig` never forces the sig block, we don't actually
10
+ # need implementations for anything that can only go inside the sig block.
11
+
12
+ module T
13
+ module Sig
14
+ module WithoutRuntime
15
+ def self.sig(&blk); end
16
+ end
17
+ end
18
+
19
+ def self.any(type_a, type_b, *types); end
20
+ def self.nilable(type); end
21
+ def self.untyped; end
22
+ def self.noreturn; end
23
+ def self.all(type_a, type_b, *types); end
24
+ def self.enum(values); end
25
+ def self.proc; end
26
+ def self.self_type; end
27
+ def self.class_of(klass); end
28
+ def self.type_alias(type); end
29
+ def self.type_parameter(name); end
30
+
31
+ def self.cast(value, type, checked: true); value; end
32
+ def self.let(value, type, checked: true); value; end
33
+ def self.assert_type!(value, type, checked: true); value; end
34
+ def self.unsafe(value); value; end
35
+ def self.must(arg, msg=nil); arg; end
36
+ def self.reveal_type(value); value; end
37
+
38
+ module Array
39
+ def self.[](type); end
40
+ end
41
+
42
+ module Hash
43
+ def self.[](keys, values); end
44
+ end
45
+
46
+ module Enumerable
47
+ def self.[](type); end
48
+ end
49
+
50
+ module Range
51
+ def self.[](type); end
52
+ end
53
+
54
+ module Set
55
+ def self.[](type); end
56
+ end
57
+ end
58
+
data/lib/todo-rbi.rb ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'json'
5
+
6
+ require_relative './serialize'
7
+ require_relative './step_interface'
8
+
9
+ class Sorbet::Private::TodoRBI
10
+ OUTPUT = 'sorbet/rbi/todo.rbi'
11
+ HEADER = Sorbet::Private::Serialize.header('strong', 'todo')
12
+
13
+ include Sorbet::Private::StepInterface
14
+
15
+ def self.main
16
+ File.delete(OUTPUT) if File.exist?(OUTPUT)
17
+
18
+ IO.popen(
19
+ [
20
+ File.realpath("#{__dir__}/../bin/srb"),
21
+ 'tc',
22
+ '--print=missing-constants',
23
+ '--stdout-hup-hack',
24
+ '--silence-dev-message',
25
+ '--no-error-count',
26
+ ],
27
+ err: '/dev/null',
28
+ ) do |io|
29
+ missing_constants = io.read.split("\n")
30
+
31
+ output = String.new
32
+ output << HEADER
33
+ missing_constants.each do |const|
34
+ next if const.include?("<") || const.include?("class_of")
35
+ output << "module #{const.gsub('T.untyped::', '')}; end\n"
36
+ end
37
+ File.write(OUTPUT, output) if output != HEADER
38
+ end
39
+ end
40
+
41
+ def self.output_file
42
+ OUTPUT
43
+ end
44
+ end
45
+
46
+ if $PROGRAM_NAME == __FILE__
47
+ Sorbet::Private::TodoRBI.main
48
+ end
metadata CHANGED
@@ -1,25 +1,115 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4250
4
+ version: 0.4.4253
5
5
  platform: ruby
6
6
  authors:
7
- - Sorbet Contributors
7
+ - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-06-20 00:00:00.000000000 Z
12
- dependencies: []
13
- description:
14
- email:
15
- executables: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sorbet-static
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.4253
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.4253
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mocha
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: The main entrypoint for using Sorbet
70
+ email: sorbet@stripe.com
71
+ executables:
72
+ - srb-rbi
73
+ - srb
16
74
  extensions: []
17
75
  extra_rdoc_files: []
18
- files: []
19
- homepage:
20
- licenses: []
76
+ files:
77
+ - bin/srb
78
+ - bin/srb-rbi
79
+ - lib/constant_cache.rb
80
+ - lib/create-config.rb
81
+ - lib/fetch-rbis.rb
82
+ - lib/find-gem-rbis.rb
83
+ - lib/gem-generator-tracepoint.rb
84
+ - lib/gem-generator-tracepoint/tracepoint_serializer.rb
85
+ - lib/gem-generator-tracepoint/tracer.rb
86
+ - lib/gem_loader.rb
87
+ - lib/gem_loader.rbi
88
+ - lib/hidden-definition-finder.rb
89
+ - lib/real_stdlib.rb
90
+ - lib/require_everything.rb
91
+ - lib/serialize.rb
92
+ - lib/status.rb
93
+ - lib/step_interface.rb
94
+ - lib/suggest-typed.rb
95
+ - lib/t.rb
96
+ - lib/todo-rbi.rb
97
+ homepage: https://sorbet.run
98
+ licenses:
99
+ - Apache-2.0
21
100
  metadata: {}
22
- post_install_message: Sorbet is not available publically yet. This gem is only a placeholder.
101
+ post_install_message: |2
102
+
103
+ Thanks for installing Sorbet! To use it in your project, first run:
104
+
105
+ bundle exec srb init
106
+
107
+ which will get your project ready to use with Sorbet.
108
+ After that whenever you want to typecheck your code, run:
109
+
110
+ bundle exec srb tc
111
+
112
+ For more docs see: https://sorbet.org/docs/adopting
23
113
  rdoc_options: []
24
114
  require_paths:
25
115
  - lib
@@ -35,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
35
125
  version: '0'
36
126
  requirements: []
37
127
  rubyforge_project:
38
- rubygems_version: 2.7.6
128
+ rubygems_version: 2.5.2.3
39
129
  signing_key:
40
130
  specification_version: 4
41
131
  summary: A Typechecker for Ruby