orthoses 1.0.0 → 1.1.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +38 -17
- data/lib/orthoses/content/duplication_checker.rb +10 -5
- data/lib/orthoses/version.rb +1 -1
- data/sig/orthoses.rbs +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8718c01d3ca0c5ea18285c9082218c526e280626d15da555b17773ec8d582ac3
|
4
|
+
data.tar.gz: 2541364526894cb9f2870a4a69169418ca57ad042911507bd96557e54df1abfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8dbc5aaeda5a1943a61bfc8b0190994373284e5c4712d2ffe710fe31fe95949406b8d2a3929dfad09b573b14c19d81c7f558cbc7ac197055d128596e2625272
|
7
|
+
data.tar.gz: 465cff7f5fa29e7b599549a790b85ba1d597e820e6437811ead5e8de031fee797ef07746bba448451b2b73715511e8bd59a65cb8b32bf86ab1d09832a06ac3a7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
Orthoses is a framework for RBS generation.
|
4
4
|
The Rack architecture keeps your code organized and extensible.
|
5
5
|
|
6
|
+
- You can choose which middleware to use.
|
7
|
+
- You can write your own middleware to use.
|
8
|
+
- You can publish your middleware and share it with the world.
|
9
|
+
|
6
10
|
## PoC
|
7
11
|
|
8
12
|
https://gist.github.com/ksss/00592da24f28774bf8fc5db08331666e
|
@@ -19,27 +23,38 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
19
23
|
|
20
24
|
## Usage
|
21
25
|
|
26
|
+
For example, You can write script in Rakefile.
|
27
|
+
|
22
28
|
```rb
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
require 'orthoses'
|
30
|
+
|
31
|
+
namespace :rbs do
|
32
|
+
desc "build RBS to sig/out"
|
33
|
+
task :build do
|
34
|
+
Orthoses::Builder.new do
|
35
|
+
use Orthoses::CreateFileByName
|
36
|
+
base_dir: Rails.root.join("sig/out"),
|
37
|
+
header: "# !!! GENERATED CODE !!!"
|
38
|
+
use Orthoses::Filter do |name, _content|
|
39
|
+
path, _lineno = Object.const_source_location(name)
|
40
|
+
return false unless path
|
41
|
+
%r{app/models}.match?(path)
|
42
|
+
end
|
43
|
+
use YourCustom::Middleware
|
44
|
+
use Orthoses::Mixin
|
45
|
+
use Orthoses::Constant
|
46
|
+
use Orthoses::Walk,
|
47
|
+
root: "Foo"
|
48
|
+
run -> {
|
49
|
+
# load library or application
|
50
|
+
}
|
51
|
+
end.call
|
31
52
|
end
|
32
|
-
|
33
|
-
use Orthoses::Mixin
|
34
|
-
use Orthoses::Constant
|
35
|
-
use Orthoses::Walk,
|
36
|
-
root: "Foo"
|
37
|
-
run -> () {
|
38
|
-
# load library or application
|
39
|
-
}
|
40
|
-
end.call
|
53
|
+
end
|
41
54
|
```
|
42
55
|
|
56
|
+
Then, you can see the result files under `sig/out`.
|
57
|
+
|
43
58
|
## Utils
|
44
59
|
|
45
60
|
`Orthoses::Utils` is a collection of useful methods.
|
@@ -176,3 +191,9 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
176
191
|
## Code of Conduct
|
177
192
|
|
178
193
|
Everyone interacting in the Orthoses project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ksss/orthoses/blob/main/CODE_OF_CONDUCT.md).
|
194
|
+
|
195
|
+
# TODO
|
196
|
+
|
197
|
+
- Share middleware sets for commonly used use cases.
|
198
|
+
- For library.
|
199
|
+
- For application.
|
@@ -11,11 +11,16 @@ module Orthoses
|
|
11
11
|
return unless @decl.respond_to?(:members)
|
12
12
|
uniq_map = {}
|
13
13
|
@decl.members.each do |member|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
if member.instance_of?(RBS::AST::Members::MethodDefinition) && member.overload
|
15
|
+
# avoid to duplicate and keep order
|
16
|
+
uniq_map[Object.new] = member
|
17
|
+
else
|
18
|
+
key = member_key(member)
|
19
|
+
drop_member = uniq_map[key]
|
20
|
+
uniq_map[key] = member
|
21
|
+
if drop_member
|
22
|
+
Orthoses.logger.info("#{@decl.name} \"#{member.location.source}\" was droped since duplication")
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
21
26
|
drop_known_method_definition(uniq_map)
|
data/lib/orthoses/version.rb
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|