tapioca 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a98ca6b703be34409d122ea825e0cd55079669bc86eac3e0d13f201a6ee5059e
4
- data.tar.gz: 49c8800b44a551fc3f9222fd103fb3a39011927bf25b48e43c9ef998096eabba
3
+ metadata.gz: 257d63c47e53a94353682ff56b8e1a347971112fe9602913e06abea54c216b32
4
+ data.tar.gz: f342e9ab5b67975dcc529339310102b7005888b8cd0ea4b1cd09c85d6c348495
5
5
  SHA512:
6
- metadata.gz: d4d5540ba0d519f224edb20c52c268e64962e343b2d8cba8b0ed1d855270c249b4b71cdffcd30aebafba994bea42e2ac567fafa4b42e6154a1fc67f6cab37825
7
- data.tar.gz: 22edc86401311b86a3791076d9fd9f7c463c37166e0383987407cdec555c4829ce6a72b899cccb9690d82e3cf96fd366f91926adde90012ddaf38acdb8a8d3ba
6
+ metadata.gz: c01492305d2a5c12b7d79fb684a8e99b15614f2c4985d6d5abae67a44f1e258b4203c234b5ec82a96876cfdcaf014667a0e754f054885a22dbb8c249523f792d
7
+ data.tar.gz: ccd6065fad0555a596b6fb66907eaef19aabf7f5a14ef47b768d60c77ee01a2c340a367911d5cd1382a8a07822ed2e2e22f46b2c8d7192aefcd18936d1b03375
@@ -138,6 +138,7 @@ module Tapioca
138
138
 
139
139
  class GemSpec
140
140
  extend(T::Sig)
141
+ include GemHelper
141
142
 
142
143
  IGNORED_GEMS = T.let(["sorbet", "sorbet-static", "sorbet-runtime", "sorbet-static-and-runtime"].freeze,
143
144
  T::Array[String])
@@ -160,7 +161,7 @@ module Tapioca
160
161
 
161
162
  sig { params(gemfile_dir: String).returns(T::Boolean) }
162
163
  def ignore?(gemfile_dir)
163
- gem_ignored? || gem_in_app_dir?(gemfile_dir)
164
+ gem_ignored? || gem_in_app_dir?(gemfile_dir, full_gem_path)
164
165
  end
165
166
 
166
167
  sig { returns(String) }
@@ -284,27 +285,10 @@ module Tapioca
284
285
  false
285
286
  end
286
287
 
287
- sig { params(path: T.any(String, Pathname)).returns(String) }
288
- def to_realpath(path)
289
- path_string = path.to_s
290
- path_string = File.realpath(path_string) if File.exist?(path_string)
291
- path_string
292
- end
293
-
294
288
  sig { returns(T::Boolean) }
295
289
  def gem_ignored?
296
290
  IGNORED_GEMS.include?(name)
297
291
  end
298
-
299
- sig { params(gemfile_dir: String).returns(T::Boolean) }
300
- def gem_in_app_dir?(gemfile_dir)
301
- !gem_in_bundle_path? && full_gem_path.start_with?(gemfile_dir)
302
- end
303
-
304
- sig { returns(T::Boolean) }
305
- def gem_in_bundle_path?
306
- full_gem_path.start_with?(Bundler.bundle_path.to_s, Bundler.app_cache.to_s)
307
- end
308
292
  end
309
293
  end
310
294
  end
@@ -0,0 +1,26 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Tapioca
5
+ module GemHelper
6
+ extend T::Sig
7
+
8
+ sig { params(gemfile_dir: String, full_gem_path: String).returns(T::Boolean) }
9
+ def gem_in_app_dir?(gemfile_dir, full_gem_path)
10
+ !gem_in_bundle_path?(to_realpath(full_gem_path)) &&
11
+ full_gem_path.start_with?(to_realpath(gemfile_dir))
12
+ end
13
+
14
+ sig { params(full_gem_path: String).returns(T::Boolean) }
15
+ def gem_in_bundle_path?(full_gem_path)
16
+ full_gem_path.start_with?(Bundler.bundle_path.to_s, Bundler.app_cache.to_s)
17
+ end
18
+
19
+ sig { params(path: T.any(String, Pathname)).returns(String) }
20
+ def to_realpath(path)
21
+ path_string = path.to_s
22
+ path_string = File.realpath(path_string) if File.exist?(path_string)
23
+ path_string
24
+ end
25
+ end
26
+ end
@@ -5,6 +5,7 @@ require "tapioca"
5
5
  require "tapioca/runtime/reflection"
6
6
  require "tapioca/runtime/trackers"
7
7
  require "tapioca/runtime/dynamic_mixin_compiler"
8
+ require "tapioca/helpers/gem_helper"
8
9
  require "tapioca/runtime/loader"
9
10
  require "tapioca/helpers/sorbet_helper"
10
11
  require "tapioca/helpers/type_variable_helper"
@@ -5,6 +5,7 @@ module Tapioca
5
5
  module Runtime
6
6
  class Loader
7
7
  extend(T::Sig)
8
+ include Tapioca::GemHelper
8
9
 
9
10
  sig do
10
11
  params(gemfile: Tapioca::Gemfile, initialize_file: T.nilable(String), require_file: T.nilable(String)).void
@@ -55,7 +56,10 @@ module Tapioca
55
56
  safe_require("active_support/core_ext/class/subclasses")
56
57
 
57
58
  # We can use `Class#descendants` here, since we know Rails is loaded
58
- Object.const_get("Rails::Engine").descendants.reject(&:abstract_railtie?)
59
+ Object.const_get("Rails::Engine")
60
+ .descendants
61
+ .reject(&:abstract_railtie?)
62
+ .reject { |engine| gem_in_app_dir?(Rails.root.to_path, engine.config.root.to_path) }
59
63
  end
60
64
 
61
65
  sig { params(path: String).void }
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.8.1"
5
+ VERSION = "0.8.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapioca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2022-05-30 00:00:00.000000000 Z
14
+ date: 2022-06-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -214,6 +214,7 @@ files:
214
214
  - lib/tapioca/gemfile.rb
215
215
  - lib/tapioca/helpers/cli_helper.rb
216
216
  - lib/tapioca/helpers/config_helper.rb
217
+ - lib/tapioca/helpers/gem_helper.rb
217
218
  - lib/tapioca/helpers/rbi_helper.rb
218
219
  - lib/tapioca/helpers/shims_helper.rb
219
220
  - lib/tapioca/helpers/signatures_helper.rb
@@ -263,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
264
  - !ruby/object:Gem::Version
264
265
  version: '0'
265
266
  requirements: []
266
- rubygems_version: 3.2.20
267
+ rubygems_version: 3.3.3
267
268
  signing_key:
268
269
  specification_version: 4
269
270
  summary: A Ruby Interface file generator for gems, core types and the Ruby standard