rbs_config 0.2.0 → 1.0.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: 8f7dc816262f1365ddfbf97de2aa149271b18080d4de58dd96341a71e025ce02
4
- data.tar.gz: 6197190426cf582d43b13b315174cefea17c22b0d4c2c7da44b00a1d1d18217f
3
+ metadata.gz: 7c379914fccfe5ef6d08534927a87f1df4cfab80f84da0ffe80fd638d2ba35bb
4
+ data.tar.gz: deda4664549517817ae600c005ebfb5af42f12b65ffb437a36879d4092a5a2fb
5
5
  SHA512:
6
- metadata.gz: 3d712b3aa4dc185dd994bc8d00f9d8c693dd94cc0c68e0620a8398ff3417b14a741561220bc9665460ba0678118fd1ad779e68ae4d1f3d36eb7f597c7f6727ea
7
- data.tar.gz: c4366d824d02533718b947b00d8f28f8536efe74fc97c14846731df7a836202eac0913840d4a737a644910cf8536e807386485e69fbc3d3d1e2da551bb9acd16
6
+ metadata.gz: cb35f250bd004771189c8c6b540ac317d8a64ae5c6f8b3e80bbbc11dc19210380cacdd4f15b9184ef0dfe35f9b43648b3abd1de886a0db6dee426328fd57377d
7
+ data.tar.gz: e34cda204e7094262317525dae5c2885a6621dbd9760bb780304faad8df4d2c8806a7998cf5b8dffacf2f37ab438a8bb9fbc68f155323c6f086a294daf1a7730
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 2.7
3
3
 
4
4
  Style/Documentation:
5
5
  Enabled: false
@@ -7,7 +7,10 @@ module RbsConfig
7
7
  def create_raketask
8
8
  create_file "lib/tasks/rbs_config.rake", <<~RUBY
9
9
  begin
10
- require 'rbs_config/rake_task'
10
+ # frozen_string_literal: true
11
+
12
+ require "rbs_config/rake_task"
13
+
11
14
  RbsConfig::RakeTask.new do |task|
12
15
  # The type of configuration (default: :config)
13
16
  # task.type = :config | :rails
@@ -41,17 +41,20 @@ module RbsConfig
41
41
 
42
42
  def generate_classes(config)
43
43
  config.filter_map do |key, value|
44
- next unless value.is_a?(Hash)
44
+ case value
45
+ when Array
46
+ generate_classes({ key => value.first }).first if value.first.is_a?(Hash)
47
+ when Hash
48
+ classes = generate_classes(value)
49
+ methods = generate_methods(value)
45
50
 
46
- classes = generate_classes(value)
47
- methods = generate_methods(value)
48
-
49
- <<~RBS
50
- class #{key.camelize}
51
- #{classes.join("\n")}
52
- #{methods.join("\n")}
53
- end
54
- RBS
51
+ <<~RBS
52
+ class #{key.camelize}
53
+ #{classes.join("\n")}
54
+ #{methods.join("\n")}
55
+ end
56
+ RBS
57
+ end
55
58
  end
56
59
  end
57
60
 
@@ -78,7 +81,15 @@ module RbsConfig
78
81
  end
79
82
 
80
83
  def load_config(files)
81
- files.map { |f| YAML.unsafe_load(f.read) }.inject { |a, b| a.deep_merge(b) }
84
+ configs = files.map do |f|
85
+ content = ERB.new(f.read).result
86
+ if YAML.respond_to?(:unsafe_load)
87
+ YAML.unsafe_load(content)
88
+ else
89
+ YAML.load(content) # rubocop:disable Security/YAMLLoad
90
+ end
91
+ end
92
+ configs.inject { |a, b| a.deep_merge(b) }
82
93
  end
83
94
  end
84
95
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbsConfig
4
- VERSION = "0.2.0"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -2,7 +2,7 @@
2
2
  sources:
3
3
  - type: git
4
4
  name: ruby/gem_rbs_collection
5
- revision: a4c633634493ab7ae73219022f56acff56ab69af
5
+ revision: c34ed02f870fb02571f664062eb13ef507702029
6
6
  remote: https://github.com/ruby/gem_rbs_collection.git
7
7
  repo_dir: gems
8
8
  path: ".gem_rbs_collection"
@@ -11,12 +11,28 @@ gems:
11
11
  version: '0'
12
12
  source:
13
13
  type: stdlib
14
+ - name: actionpack
15
+ version: '6.0'
16
+ source:
17
+ type: git
18
+ name: ruby/gem_rbs_collection
19
+ revision: c34ed02f870fb02571f664062eb13ef507702029
20
+ remote: https://github.com/ruby/gem_rbs_collection.git
21
+ repo_dir: gems
22
+ - name: actionview
23
+ version: '6.0'
24
+ source:
25
+ type: git
26
+ name: ruby/gem_rbs_collection
27
+ revision: c34ed02f870fb02571f664062eb13ef507702029
28
+ remote: https://github.com/ruby/gem_rbs_collection.git
29
+ repo_dir: gems
14
30
  - name: activesupport
15
31
  version: '7.0'
16
32
  source:
17
33
  type: git
18
34
  name: ruby/gem_rbs_collection
19
- revision: a4c633634493ab7ae73219022f56acff56ab69af
35
+ revision: c34ed02f870fb02571f664062eb13ef507702029
20
36
  remote: https://github.com/ruby/gem_rbs_collection.git
21
37
  repo_dir: gems
22
38
  - name: ast
@@ -24,31 +40,47 @@ gems:
24
40
  source:
25
41
  type: git
26
42
  name: ruby/gem_rbs_collection
27
- revision: a4c633634493ab7ae73219022f56acff56ab69af
43
+ revision: c34ed02f870fb02571f664062eb13ef507702029
28
44
  remote: https://github.com/ruby/gem_rbs_collection.git
29
45
  repo_dir: gems
30
46
  - name: base64
31
47
  version: '0'
32
48
  source:
33
49
  type: stdlib
50
+ - name: cgi
51
+ version: '0'
52
+ source:
53
+ type: stdlib
34
54
  - name: concurrent-ruby
35
55
  version: '1.1'
36
56
  source:
37
57
  type: git
38
58
  name: ruby/gem_rbs_collection
39
- revision: a4c633634493ab7ae73219022f56acff56ab69af
59
+ revision: c34ed02f870fb02571f664062eb13ef507702029
40
60
  remote: https://github.com/ruby/gem_rbs_collection.git
41
61
  repo_dir: gems
42
62
  - name: date
43
63
  version: '0'
44
64
  source:
45
65
  type: stdlib
66
+ - name: dbm
67
+ version: '0'
68
+ source:
69
+ type: stdlib
70
+ - name: erb
71
+ version: '0'
72
+ source:
73
+ type: stdlib
74
+ - name: fileutils
75
+ version: '0'
76
+ source:
77
+ type: stdlib
46
78
  - name: i18n
47
79
  version: '1.10'
48
80
  source:
49
81
  type: git
50
82
  name: ruby/gem_rbs_collection
51
- revision: a4c633634493ab7ae73219022f56acff56ab69af
83
+ revision: c34ed02f870fb02571f664062eb13ef507702029
52
84
  remote: https://github.com/ruby/gem_rbs_collection.git
53
85
  repo_dir: gems
54
86
  - name: json
@@ -80,29 +112,89 @@ gems:
80
112
  source:
81
113
  type: git
82
114
  name: ruby/gem_rbs_collection
83
- revision: a4c633634493ab7ae73219022f56acff56ab69af
115
+ revision: c34ed02f870fb02571f664062eb13ef507702029
116
+ remote: https://github.com/ruby/gem_rbs_collection.git
117
+ repo_dir: gems
118
+ - name: parser
119
+ version: '3.2'
120
+ source:
121
+ type: git
122
+ name: ruby/gem_rbs_collection
123
+ revision: c34ed02f870fb02571f664062eb13ef507702029
84
124
  remote: https://github.com/ruby/gem_rbs_collection.git
85
125
  repo_dir: gems
86
126
  - name: pathname
87
127
  version: '0'
88
128
  source:
89
129
  type: stdlib
130
+ - name: pstore
131
+ version: '0'
132
+ source:
133
+ type: stdlib
134
+ - name: rack
135
+ version: '2.2'
136
+ source:
137
+ type: git
138
+ name: ruby/gem_rbs_collection
139
+ revision: c34ed02f870fb02571f664062eb13ef507702029
140
+ remote: https://github.com/ruby/gem_rbs_collection.git
141
+ repo_dir: gems
142
+ - name: railties
143
+ version: '6.0'
144
+ source:
145
+ type: git
146
+ name: ruby/gem_rbs_collection
147
+ revision: c34ed02f870fb02571f664062eb13ef507702029
148
+ remote: https://github.com/ruby/gem_rbs_collection.git
149
+ repo_dir: gems
90
150
  - name: rainbow
91
151
  version: '3.0'
92
152
  source:
93
153
  type: git
94
154
  name: ruby/gem_rbs_collection
95
- revision: a4c633634493ab7ae73219022f56acff56ab69af
155
+ revision: c34ed02f870fb02571f664062eb13ef507702029
156
+ remote: https://github.com/ruby/gem_rbs_collection.git
157
+ repo_dir: gems
158
+ - name: rake
159
+ version: '13.0'
160
+ source:
161
+ type: git
162
+ name: ruby/gem_rbs_collection
163
+ revision: c34ed02f870fb02571f664062eb13ef507702029
96
164
  remote: https://github.com/ruby/gem_rbs_collection.git
97
165
  repo_dir: gems
98
166
  - name: rbs
99
- version: 3.2.0
167
+ version: 3.1.3
100
168
  source:
101
169
  type: rubygems
102
170
  - name: rdoc
103
171
  version: '0'
104
172
  source:
105
173
  type: stdlib
174
+ - name: regexp_parser
175
+ version: '2.8'
176
+ source:
177
+ type: git
178
+ name: ruby/gem_rbs_collection
179
+ revision: c34ed02f870fb02571f664062eb13ef507702029
180
+ remote: https://github.com/ruby/gem_rbs_collection.git
181
+ repo_dir: gems
182
+ - name: rubocop
183
+ version: '1.57'
184
+ source:
185
+ type: git
186
+ name: ruby/gem_rbs_collection
187
+ revision: c34ed02f870fb02571f664062eb13ef507702029
188
+ remote: https://github.com/ruby/gem_rbs_collection.git
189
+ repo_dir: gems
190
+ - name: rubocop-ast
191
+ version: '1.30'
192
+ source:
193
+ type: git
194
+ name: ruby/gem_rbs_collection
195
+ revision: c34ed02f870fb02571f664062eb13ef507702029
196
+ remote: https://github.com/ruby/gem_rbs_collection.git
197
+ repo_dir: gems
106
198
  - name: securerandom
107
199
  version: '0'
108
200
  source:
@@ -111,6 +203,22 @@ gems:
111
203
  version: '0'
112
204
  source:
113
205
  type: stdlib
206
+ - name: strscan
207
+ version: '0'
208
+ source:
209
+ type: stdlib
210
+ - name: tempfile
211
+ version: '0'
212
+ source:
213
+ type: stdlib
214
+ - name: thor
215
+ version: '1.2'
216
+ source:
217
+ type: git
218
+ name: ruby/gem_rbs_collection
219
+ revision: c34ed02f870fb02571f664062eb13ef507702029
220
+ remote: https://github.com/ruby/gem_rbs_collection.git
221
+ repo_dir: gems
114
222
  - name: time
115
223
  version: '0'
116
224
  source:
@@ -119,4 +227,20 @@ gems:
119
227
  version: '0'
120
228
  source:
121
229
  type: stdlib
230
+ - name: tzinfo
231
+ version: '2.0'
232
+ source:
233
+ type: git
234
+ name: ruby/gem_rbs_collection
235
+ revision: c34ed02f870fb02571f664062eb13ef507702029
236
+ remote: https://github.com/ruby/gem_rbs_collection.git
237
+ repo_dir: gems
238
+ - name: uri
239
+ version: '0'
240
+ source:
241
+ type: stdlib
242
+ - name: yaml
243
+ version: '0'
244
+ source:
245
+ type: stdlib
122
246
  gemfile_lock_path: Gemfile.lock
data/rbs_collection.yaml CHANGED
@@ -19,4 +19,10 @@ gems:
19
19
  - name: steep
20
20
  ignore: true
21
21
 
22
+ - name: actionpack
23
+ - name: actionview
22
24
  - name: pathname
25
+ - name: rack
26
+ - name: railties
27
+ - name: thor
28
+ - name: yaml
data/rbs_config.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "A RBS files generator for Config gem"
13
13
  spec.homepage = "https://github.com/tk0miya/rbs_config"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
@@ -4,7 +4,7 @@ module RbsConfig
4
4
 
5
5
  class Generator
6
6
  attr_reader class_name: String
7
- attr_reader files: Array[String]
7
+ attr_reader files: Array[Pathname]
8
8
 
9
9
  def initialize: (class_name: String, files: Array[Pathname]) -> void
10
10
  def generate: () -> String
@@ -1,19 +1,19 @@
1
1
  module RbsConfig
2
2
  module RailsConfig
3
- def self.generate: (mapping: Hash[untyped, Hash[untyped, untyped] | ActiveSupport::OrderedOptions[untyped, untyped]]) -> String
3
+ def self.generate: (mapping: Hash[untyped, Hash[untyped, untyped] | ActiveSupport::OrderedOptions]) -> String
4
4
 
5
5
  class Generator
6
- attr_reader mapping: Hash[untyped, Hash[untyped, untyped] | ActiveSupport::OrderedOptions[untyped, untyped]]
6
+ attr_reader mapping: Hash[untyped, Hash[untyped, untyped] | ActiveSupport::OrderedOptions]
7
7
 
8
- def initialize: (mapping: Hash[untyped, Hash[untyped, untyped] | ActiveSupport::OrderedOptions[untyped, untyped]]) -> void
8
+ def initialize: (mapping: Hash[untyped, Hash[untyped, untyped] | ActiveSupport::OrderedOptions]) -> void
9
9
  def generate: () -> String
10
10
 
11
11
  private
12
12
 
13
13
  def format: (String rbs) -> String
14
- def generate_classes: (Hash[untyped, untyped] | ActiveSupport::OrderedOptions[untyped, untyped] config) -> Array[String]
15
- def generate_methods: (Hash[untyped, untyped] | ActiveSupport::OrderedOptions[untyped, untyped] config) -> Array[string]
16
- def generate_ordered_options_methods: (ActiveSupport::OrderedOptions[untyped, untyped] config) -> Array[string]
14
+ def generate_classes: (Hash[untyped, untyped] | ActiveSupport::OrderedOptions config) -> Array[String]
15
+ def generate_methods: (Hash[untyped, untyped] | ActiveSupport::OrderedOptions config) -> Array[string]
16
+ def generate_ordered_options_methods: (ActiveSupport::OrderedOptions config) -> Array[string]
17
17
  def generate_hash_methods: (Hash[untyped, untyped]) -> Array[string]
18
18
  def stringify_type: (untyped name, untyped value) -> String
19
19
  end
@@ -4,6 +4,7 @@ module RbsConfig
4
4
  attr_accessor class_name: String
5
5
  attr_accessor files: Array[Pathname]
6
6
  attr_accessor name: Symbol
7
+ attr_accessor mapping: Hash[untyped, Hash[untyped, untyped]]
7
8
  attr_accessor signature_root_dir: Pathname
8
9
 
9
10
  def initialize: (?Symbol name) ? { (RbsConfig::RakeTask) -> void } -> void
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi KOMIYA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-26 00:00:00.000000000 Z
11
+ date: 2024-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,7 +66,6 @@ files:
66
66
  - sig/rbs_config/config.rbs
67
67
  - sig/rbs_config/rails_config.rbs
68
68
  - sig/rbs_config/rake_task.rbs
69
- - sig/shims/rake.rbs
70
69
  homepage: https://github.com/tk0miya/rbs_config
71
70
  licenses:
72
71
  - MIT
@@ -82,14 +81,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
81
  requirements:
83
82
  - - ">="
84
83
  - !ruby/object:Gem::Version
85
- version: 2.6.0
84
+ version: 2.7.0
86
85
  required_rubygems_version: !ruby/object:Gem::Requirement
87
86
  requirements:
88
87
  - - ">="
89
88
  - !ruby/object:Gem::Version
90
89
  version: '0'
91
90
  requirements: []
92
- rubygems_version: 3.4.10
91
+ rubygems_version: 3.4.19
93
92
  signing_key:
94
93
  specification_version: 4
95
94
  summary: A RBS files generator for Config gem
data/sig/shims/rake.rbs DELETED
@@ -1,18 +0,0 @@
1
- module Rake
2
- class TaskLib
3
- include Rake::DSL
4
- end
5
-
6
- module DSL
7
- private
8
-
9
- def desc: (String description) -> void
10
- def file: (*untyped args) ?{ () -> void } -> void
11
- def import: (*String fns) -> void
12
- def multitask: (*untyped args) ?{ () -> void } -> void
13
- def namespace: (?String? name) ?{ () -> void } -> void
14
- def rule: (*untyped args) ?{ () -> void } -> void
15
- def task: (*untyped args) ?{ () -> void } -> void
16
- def sh: (*String cmd) ?{ (bool, Process::Status) -> void } -> void
17
- end
18
- end