orthoses 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -1
- data/Gemfile.lock +21 -18
- data/lib/orthoses/call_tracer/lazy.rb +12 -0
- data/lib/orthoses/content/duplication_checker.rb +1 -1
- data/lib/orthoses/content/environment.rb +2 -1
- data/lib/orthoses/content/header_builder.rb +4 -5
- data/lib/orthoses/content.rb +1 -1
- data/lib/orthoses/trace/method.rb +7 -2
- data/lib/orthoses/utils.rb +9 -25
- data/lib/orthoses/version.rb +1 -1
- data/orthoses.gemspec +1 -1
- data/sig/orthoses/call_tracer/lazy.rbs +2 -1
- data/sig/orthoses/call_tracer.rbs +1 -1
- data/sig/orthoses/content/header_builder.rbs +1 -0
- data/sig/orthoses/lazy_trace_point.rbs +1 -1
- data/sig/orthoses/utils.rbs +0 -2
- data/sig/orthoses.rbs +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bde1745c71d6d30b7b45ce7f956a1c02f0d44353932c3743211aa1c05f58d39
|
4
|
+
data.tar.gz: bbe5b95a7665d39faab82b5f53e18cffd22962df1913f1c52698ea51c6045e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496d255f99751ac854e5b05ecac69b1e0dc7dbb5fca53bf99d6d622e2dbb154af643de7bf8de8190dca15ff1933fac35c17735da9285532a8a3246d7002836cd
|
7
|
+
data.tar.gz: 56c77cf9074eeb75547c1be3868e9843b0d5337400d2248592879f76fd6cc14f99660d8dbbf593c1d66bac1152e1dafbaa4820ea45a49f5f47945027ce45d53a
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,43 +1,44 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
orthoses (1.
|
5
|
-
rbs (~>
|
4
|
+
orthoses (1.6.0)
|
5
|
+
rbs (~> 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (7.0.4)
|
10
|
+
activesupport (7.0.4.3)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
14
14
|
tzinfo (~> 2.0)
|
15
15
|
ast (2.4.2)
|
16
|
-
concurrent-ruby (1.
|
16
|
+
concurrent-ruby (1.2.2)
|
17
17
|
csv (3.2.6)
|
18
18
|
ffi (1.15.5)
|
19
19
|
fileutils (1.7.0)
|
20
20
|
i18n (1.12.0)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
22
|
json (2.6.3)
|
23
|
-
language_server-protocol (3.17.0.
|
24
|
-
listen (3.
|
23
|
+
language_server-protocol (3.17.0.3)
|
24
|
+
listen (3.8.0)
|
25
25
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
26
26
|
rb-inotify (~> 0.9, >= 0.9.10)
|
27
|
-
logger (1.5.
|
28
|
-
minitest (5.
|
27
|
+
logger (1.5.3)
|
28
|
+
minitest (5.18.0)
|
29
29
|
parallel (1.22.1)
|
30
|
-
parser (3.1.
|
30
|
+
parser (3.2.1.1)
|
31
31
|
ast (~> 2.4.1)
|
32
|
+
pathname (0.2.1)
|
32
33
|
rainbow (3.1.1)
|
33
34
|
rake (13.0.6)
|
34
35
|
rb-fsevent (0.11.2)
|
35
36
|
rb-inotify (0.10.1)
|
36
37
|
ffi (~> 1.0)
|
37
|
-
rbs (
|
38
|
-
rgot (1.
|
39
|
-
securerandom (0.2.
|
40
|
-
steep (1.
|
38
|
+
rbs (3.0.4)
|
39
|
+
rgot (1.3.0)
|
40
|
+
securerandom (0.2.2)
|
41
|
+
steep (1.4.0.dev.2)
|
41
42
|
activesupport (>= 5.1)
|
42
43
|
csv (>= 3.0.9)
|
43
44
|
fileutils (>= 1.1.0)
|
@@ -47,27 +48,29 @@ GEM
|
|
47
48
|
logger (>= 1.3.0)
|
48
49
|
parallel (>= 1.0.0)
|
49
50
|
parser (>= 3.1)
|
51
|
+
pathname (>= 0.2.1)
|
50
52
|
rainbow (>= 2.2.2, < 4.0)
|
51
53
|
rbs (>= 2.8.0)
|
52
54
|
securerandom (>= 0.1)
|
53
55
|
strscan (>= 1.0.0)
|
54
56
|
terminal-table (>= 2, < 4)
|
55
|
-
strscan (3.0.
|
57
|
+
strscan (3.0.6)
|
56
58
|
terminal-table (3.0.2)
|
57
59
|
unicode-display_width (>= 1.1.1, < 3)
|
58
|
-
tzinfo (2.0.
|
60
|
+
tzinfo (2.0.6)
|
59
61
|
concurrent-ruby (~> 1.0)
|
60
|
-
unicode-display_width (2.
|
62
|
+
unicode-display_width (2.4.2)
|
61
63
|
|
62
64
|
PLATFORMS
|
63
65
|
ruby
|
64
66
|
|
65
67
|
DEPENDENCIES
|
68
|
+
activesupport
|
66
69
|
orthoses!
|
67
70
|
rake (~> 13.0)
|
68
71
|
rbs
|
69
72
|
rgot (~> 1.1)
|
70
|
-
steep
|
73
|
+
steep (= 1.4.0.dev.2)
|
71
74
|
|
72
75
|
BUNDLED WITH
|
73
|
-
2.
|
76
|
+
2.4.8
|
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
module Orthoses
|
4
4
|
class CallTracer
|
5
|
+
# CallTracer::Lazy is possible to perform a trace
|
6
|
+
# equivalent to CallTracer before method is defined.
|
7
|
+
# scope = CallTracerLazy.new
|
8
|
+
# scope.trace("ActiveRecord::Base#scope") do
|
9
|
+
# require 'active_record/all'
|
10
|
+
# @loader.call
|
11
|
+
# end
|
12
|
+
# scope.captures.each do |capture|
|
13
|
+
# capture.argument[:name]
|
14
|
+
# capture.argument[:body]
|
15
|
+
# capture.argument[:block]
|
16
|
+
# end
|
5
17
|
class Lazy
|
6
18
|
include Capturable
|
7
19
|
|
@@ -11,7 +11,7 @@ module Orthoses
|
|
11
11
|
return unless @decl.respond_to?(:members)
|
12
12
|
uniq_map = {}
|
13
13
|
@decl.members.each do |member|
|
14
|
-
if member.instance_of?(RBS::AST::Members::MethodDefinition) && member.
|
14
|
+
if member.instance_of?(RBS::AST::Members::MethodDefinition) && member.overloading?
|
15
15
|
# avoid to duplicate and keep order
|
16
16
|
uniq_map[Object.new] = member
|
17
17
|
else
|
@@ -7,7 +7,8 @@ module Orthoses
|
|
7
7
|
paths.each do |path|
|
8
8
|
Orthoses.logger.debug("Load #{path}")
|
9
9
|
buffer = RBS::Buffer.new(name: path.to_s, content: File.read(path.to_s, encoding: "UTF-8"))
|
10
|
-
RBS::Parser.parse_signature(buffer)
|
10
|
+
_, _, decls = RBS::Parser.parse_signature(buffer)
|
11
|
+
decls.each do |decl|
|
11
12
|
env << decl
|
12
13
|
end
|
13
14
|
end
|
@@ -3,7 +3,7 @@ module Orthoses
|
|
3
3
|
class HeaderBuilder
|
4
4
|
def initialize(env:)
|
5
5
|
@env = env
|
6
|
-
@resolver = RBS::TypeNameResolver.
|
6
|
+
@resolver = RBS::Resolver::TypeNameResolver.new(env)
|
7
7
|
end
|
8
8
|
|
9
9
|
def build(entry:, name_hint: nil)
|
@@ -66,11 +66,10 @@ module Orthoses
|
|
66
66
|
"interface #{name_and_params(resolved_name.relative!, entry.decl.type_params)}"
|
67
67
|
end
|
68
68
|
|
69
|
+
include RBS::Environment::ContextUtil
|
70
|
+
|
69
71
|
def build_context(entry:)
|
70
|
-
|
71
|
-
entry.outer[0, i + 1].map(&:name).inject(:+).to_namespace.absolute!
|
72
|
-
end
|
73
|
-
context.push(RBS::Namespace.root)
|
72
|
+
calculate_context(entry.outer + [entry.decl])
|
74
73
|
end
|
75
74
|
|
76
75
|
def name_and_params(name, params)
|
data/lib/orthoses/content.rb
CHANGED
@@ -119,7 +119,7 @@ module Orthoses
|
|
119
119
|
name: "orthoses/content.rb",
|
120
120
|
content: original_rbs
|
121
121
|
)
|
122
|
-
parsed_decls = RBS::Parser.parse_signature(buffer)
|
122
|
+
_, _, parsed_decls = RBS::Parser.parse_signature(buffer)
|
123
123
|
unless parsed_decls.length == 1
|
124
124
|
raise "expect decls.length == 1, but got #{parsed_decls.length}"
|
125
125
|
end
|
@@ -169,8 +169,13 @@ module Orthoses
|
|
169
169
|
kind: kind,
|
170
170
|
location: nil,
|
171
171
|
name: method_id,
|
172
|
-
|
173
|
-
|
172
|
+
overloading: false,
|
173
|
+
overloads: types.map { |type|
|
174
|
+
RBS::AST::Members::MethodDefinition::Overload.new(
|
175
|
+
annotations: [],
|
176
|
+
method_type: type
|
177
|
+
)
|
178
|
+
},
|
174
179
|
visibility: visibility
|
175
180
|
)
|
176
181
|
]
|
data/lib/orthoses/utils.rb
CHANGED
@@ -50,28 +50,6 @@ module Orthoses
|
|
50
50
|
RBS::Namespace.parse(name).to_type_name
|
51
51
|
end
|
52
52
|
|
53
|
-
class << self
|
54
|
-
# Generated scripts are not always located in the root.
|
55
|
-
# By default, it follows the upper level directory from the current directory
|
56
|
-
# to find the rbs_collection.yaml file and set it to `rbs_collection_pathname`.
|
57
|
-
# It can be reconfigured if necessary.
|
58
|
-
attr_accessor :rbs_collection_pathname
|
59
|
-
end
|
60
|
-
# set default
|
61
|
-
self.rbs_collection_pathname = ->() {
|
62
|
-
begin
|
63
|
-
start = here = Dir.pwd
|
64
|
-
until ok = RBS::Collection::Config::PATH.exist?
|
65
|
-
Dir.chdir("..")
|
66
|
-
return nil if Dir.pwd == here
|
67
|
-
here = Dir.pwd
|
68
|
-
end
|
69
|
-
Pathname(here) + RBS::Collection::Config::PATH
|
70
|
-
ensure
|
71
|
-
Dir.chdir(start)
|
72
|
-
end
|
73
|
-
}.call
|
74
|
-
|
75
53
|
def self.rbs_environment(library: nil, collection: true, cache: true)
|
76
54
|
@env_cache ||= {}
|
77
55
|
if cache && hit = @env_cache[[library, collection]]
|
@@ -80,9 +58,15 @@ module Orthoses
|
|
80
58
|
|
81
59
|
loader = RBS::EnvironmentLoader.new
|
82
60
|
|
83
|
-
if collection
|
84
|
-
|
85
|
-
|
61
|
+
if collection
|
62
|
+
config_path = RBS::Collection::Config.find_config_path || RBS::Collection::Config::PATH || raise("needs rbs_collection.yaml")
|
63
|
+
lock_path = RBS::Collection::Config.to_lockfile_path(config_path)
|
64
|
+
raise "needs rbs_collection.yaml file" unless lock_path.file?
|
65
|
+
lock = RBS::Collection::Config::Lockfile.from_lockfile(
|
66
|
+
lockfile_path: lock_path,
|
67
|
+
data: YAML.load_file(lock_path.to_s)
|
68
|
+
)
|
69
|
+
loader.add_collection(lock)
|
86
70
|
end
|
87
71
|
|
88
72
|
case library
|
data/lib/orthoses/version.rb
CHANGED
data/orthoses.gemspec
CHANGED
@@ -10,4 +10,5 @@ class Orthoses::Content::HeaderBuilder
|
|
10
10
|
private def build_context: (entry: untyped) -> untyped
|
11
11
|
private def name_and_params: (untyped name, untyped params) -> ::String
|
12
12
|
private def name_and_args: (untyped name, untyped args) -> (::String | nil)
|
13
|
+
include RBS::Environment::ContextUtil
|
13
14
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class Orthoses::LazyTracePoint < ::TracePoint
|
4
4
|
def method_added: (untyped id) -> untyped
|
5
5
|
def singleton_method_added: (untyped id) -> untyped
|
6
|
-
def initialize: (*untyped events)
|
6
|
+
def initialize: (*untyped events) { () -> untyped } -> void
|
7
7
|
def enable: (?target: untyped?, ?target_line: untyped?, ?target_thread: untyped?) ?{ () -> untyped } -> untyped
|
8
8
|
private def trace_instance_method: () ?{ () -> untyped } -> untyped
|
9
9
|
private def trace_singleton_method: () ?{ () -> untyped } -> untyped
|
data/sig/orthoses/utils.rbs
CHANGED
data/sig/orthoses.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthoses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
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: '
|
26
|
+
version: '3.0'
|
27
27
|
description: Build RBS by Rack base architecture
|
28
28
|
email:
|
29
29
|
- co000ri@gmail.com
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
|
-
rubygems_version: 3.4.
|
159
|
+
rubygems_version: 3.4.8
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Framework for Generate RBS
|