orthoses 1.0.0 → 1.1.0

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: b99546cf07198d891673d96f57a8cd22602db3442fc8526377e113dc82716351
4
- data.tar.gz: 45d4d49fd66765eac0429d90718ae7b4bc3f66181f67efd97c9f4a5b4e970955
3
+ metadata.gz: 8718c01d3ca0c5ea18285c9082218c526e280626d15da555b17773ec8d582ac3
4
+ data.tar.gz: 2541364526894cb9f2870a4a69169418ca57ad042911507bd96557e54df1abfd
5
5
  SHA512:
6
- metadata.gz: e4d4ebe91a584ab50850ccdf60a489e37fe1c4da99fd8bc9ed2f8aa255b2e35f5b60b0b3ab5f2662833d34f8514f87be84018b17a97dcda76db4e57e1f52a834
7
- data.tar.gz: 78696a4162f7e469c52e059cf4fdc09160926f354ab5b3343db681d7ba78360c1406889da81830c585dda30a95921d9753fced392ad92f72324f27a8d0ad3747
6
+ metadata.gz: b8dbc5aaeda5a1943a61bfc8b0190994373284e5c4712d2ffe710fe31fe95949406b8d2a3929dfad09b573b14c19d81c7f558cbc7ac197055d128596e2625272
7
+ data.tar.gz: 465cff7f5fa29e7b599549a790b85ba1d597e820e6437811ead5e8de031fee797ef07746bba448451b2b73715511e8bd59a65cb8b32bf86ab1d09832a06ac3a7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orthoses (1.0.0)
4
+ orthoses (1.1.0)
5
5
  rbs (~> 2.0)
6
6
 
7
7
  GEM
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
- Orthoses::Builder.new do
24
- use Orthoses::CreateFileByName
25
- base_dir: Rails.root.join("sig/out"),
26
- header: "# !!! GENERATED CODE !!!"
27
- use Orthoses::Filter do |name, _content|
28
- path, _lineno = Object.const_source_location(name)
29
- return false unless path
30
- %r{app/models}.match?(path)
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
- use YourCustom::Middleware
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
- key = member_key(member)
15
- drop_member = uniq_map[key]
16
- uniq_map[key] = member
17
- if drop_member
18
- Orthoses.logger.info("#{@decl.name} \"#{member.location.source}\" was droped since duplication")
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthoses
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
data/sig/orthoses.rbs CHANGED
@@ -1,7 +1,7 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses
4
- VERSION: "1.0.0"
4
+ VERSION: "1.1.0"
5
5
  attr_accessor self.logger: ::Logger
6
6
  type store = Hash[String, Orthoses::Content]
7
7
  INSTANCE_METHOD_METHOD: UnboundMethod
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.0.0
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-09 00:00:00.000000000 Z
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs