sorbet 0.5.5891 → 0.5.6155

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fetch-rbis.rb +12 -2
  3. data/lib/serialize.rb +13 -0
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e4ad8feb3606e17dd5c9930903c6c309f30ef00
4
- data.tar.gz: 109a75e52d1cad3da37bb982100c20d359f2b705
3
+ metadata.gz: 2d8017b91ec772c5cf373f5e24f8678618776244
4
+ data.tar.gz: 95f6fb01dd5933ff242d3870f3d9a6caccdd0ccf
5
5
  SHA512:
6
- metadata.gz: e0b00bd68efd79c8fef57aacea598d97654a3f52d91a2005b63c251c118ef65bea432a42c44e02a93cee229f810040de0606394b1913f5f515a363fe2e23c406
7
- data.tar.gz: 8ac1306c9c550402327d13f92e242f8200d5f810d9cdd99409aa4410db47a8881d0d36d0ddad4ae3173e02c6059a3c8706729179828cbaa2672ae72af0c85f70
6
+ metadata.gz: b88a32fb3b7a60167b7ecee54e63d5f2cab95502382883fce40cfb4d6ca925abae241c7b3788b0058240c2125f2ca9493a759bff6c68990b16df11967b7b6f73
7
+ data.tar.gz: e26392ddec65da02eafcd2e37c5a76ccc4e045c0430313450db6b41a5568f0493306e7e42dab74d0e6286cd5253bd84dc130fb490d2d46cd304c6772bc2ef293
data/lib/fetch-rbis.rb CHANGED
@@ -19,7 +19,7 @@ class Sorbet::Private::FetchRBIs
19
19
  XDG_CACHE_HOME = ENV['XDG_CACHE_HOME'] || "#{ENV['HOME']}/.cache"
20
20
  RBI_CACHE_DIR = "#{XDG_CACHE_HOME}/sorbet/sorbet-typed"
21
21
 
22
- SORBET_TYPED_REPO = 'https://github.com/sorbet/sorbet-typed.git'
22
+ SORBET_TYPED_REPO = ENV['SRB_SORBET_TYPED_REPO'] || 'https://github.com/sorbet/sorbet-typed.git'
23
23
  SORBET_TYPED_REVISION = ENV['SRB_SORBET_TYPED_REVISION'] || 'origin/master'
24
24
 
25
25
  HEADER = Sorbet::Private::Serialize.header(false, 'sorbet-typed')
@@ -29,7 +29,17 @@ class Sorbet::Private::FetchRBIs
29
29
  # Ensure our cache is up-to-date
30
30
  T::Sig::WithoutRuntime.sig {void}
31
31
  def self.fetch_sorbet_typed
32
- if !File.directory?(RBI_CACHE_DIR)
32
+ if File.directory?(RBI_CACHE_DIR)
33
+ cached_remote = IO.popen(["git", "-C", RBI_CACHE_DIR, "config", "--get", "remote.origin.url"]) {|pipe| pipe.read}.strip
34
+
35
+ # Compare the <owner>/<repo>.git to be agnostic of https vs ssh urls
36
+ cached_remote_repo = cached_remote.split(%r{github.com[:/]}).last
37
+ requested_remote_repo = SORBET_TYPED_REPO.split(%r{github.com[:/]}).last
38
+
39
+ if cached_remote_repo != requested_remote_repo
40
+ raise "Cached remote #{cached_remote_repo} does not match requested remote #{requested_remote_repo}. Delete #{RBI_CACHE_DIR} and try again."
41
+ end
42
+ else
33
43
  IO.popen(["git", "clone", SORBET_TYPED_REPO, RBI_CACHE_DIR]) {|pipe| pipe.read}
34
44
  raise "Failed to git pull" if $?.exitstatus != 0
35
45
  end
data/lib/serialize.rb CHANGED
@@ -337,6 +337,19 @@ class Sorbet::Private::Serialize
337
337
  uniq += 1
338
338
  end
339
339
  end
340
+
341
+ # Sanitize parameter names that are not valid.
342
+ # Ruby 2.7+ argument forwarding works by expanding `foo(...)`
343
+ # to `foo(**, ****, &&)`, in other words, to a rest parameter named
344
+ # `*`, a keyword rest parameter named `**` and a block argument named
345
+ # `&`. Those are all illegal parameter names which we should NOT
346
+ # generate. (Coincidentally, that is why Ruby 2.7+ uses those names,
347
+ # so that user code cannot mess with the forwarded arguments)
348
+ if ["*", "**", "&"].include?(name.to_s)
349
+ name = '_' + (uniq == 0 ? '' : uniq.to_s)
350
+ uniq += 1
351
+ end
352
+
340
353
  [kind, name]
341
354
  end
342
355
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5891
4
+ version: 0.5.6155
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-05 00:00:00.000000000 Z
11
+ date: 2020-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-static
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.5891
19
+ version: 0.5.6155
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.5891
26
+ version: 0.5.6155
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement