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 +4 -4
- data/lib/tapioca/gemfile.rb +2 -18
- data/lib/tapioca/helpers/gem_helper.rb +26 -0
- data/lib/tapioca/internal.rb +1 -0
- data/lib/tapioca/runtime/loader.rb +5 -1
- data/lib/tapioca/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 257d63c47e53a94353682ff56b8e1a347971112fe9602913e06abea54c216b32
|
4
|
+
data.tar.gz: f342e9ab5b67975dcc529339310102b7005888b8cd0ea4b1cd09c85d6c348495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01492305d2a5c12b7d79fb684a8e99b15614f2c4985d6d5abae67a44f1e258b4203c234b5ec82a96876cfdcaf014667a0e754f054885a22dbb8c249523f792d
|
7
|
+
data.tar.gz: ccd6065fad0555a596b6fb66907eaef19aabf7f5a14ef47b768d60c77ee01a2c340a367911d5cd1382a8a07822ed2e2e22f46b2c8d7192aefcd18936d1b03375
|
data/lib/tapioca/gemfile.rb
CHANGED
@@ -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
|
data/lib/tapioca/internal.rb
CHANGED
@@ -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")
|
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 }
|
data/lib/tapioca/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|