rbs_settingslogic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 779fc3eebeca8d727832283f9d726cd31f926f4e4143d9531c6680664eb89121
4
+ data.tar.gz: d9ea0ed7dddd3933aac010b211e5233cf48159c882531931b40cdb026ee9cba9
5
+ SHA512:
6
+ metadata.gz: ac6eb37432ce74a08795c327bb211bf34533e1f248997f5f8abf9fd31e0e889616cd7deba699f0bf99757eaa5098879d570e7bf0a1bdf7d052b935c95dc5e024
7
+ data.tar.gz: fe28b2d09c2efbd85d238e2881103b9671b0393497551b516eb7dda6617c5201d3dfe25e4f26eb805fd2d9459ba730dd8783f9084c2eac9ac56da096aee5e563
data/.rubocop.yml ADDED
@@ -0,0 +1,22 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ Style/StringLiterals:
8
+ Enabled: true
9
+ EnforcedStyle: double_quotes
10
+
11
+ Style/StringLiteralsInInterpolation:
12
+ Enabled: true
13
+ EnforcedStyle: double_quotes
14
+
15
+ Layout/LineLength:
16
+ Max: 120
17
+
18
+ Metrics/AbcSize:
19
+ Max: 20
20
+
21
+ Metrics/MethodLength:
22
+ Max: 20
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "shopify.ruby-lsp",
4
+ "soutaro.steep-vscode",
5
+ "tk0miya.rspec-daemon",
6
+ "tk0miya.rbs-helper"
7
+ ]
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "[ruby]": {
3
+ "editor.defaultFormatter": "Shopify.ruby-lsp",
4
+ },
5
+ "rbs-helper.signature-directory": "sig"
6
+ }
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at i.tkomiya@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Takeshi KOMIYA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # rbs_settingslogic
2
+
3
+ rbs_settingslogic is a RBS generator for [settingslogic gem](https://github.com/settingslogic/settingslogic)
4
+
5
+ ## Installation
6
+
7
+ Add a new entry to your Gemfile and run `bundle install`:
8
+
9
+ group :development do
10
+ gem 'rbs_settingslogic'
11
+ end
12
+
13
+ After the installation, please run rake task generator:
14
+
15
+ bundle exec rails g rbs_settingslogic:install
16
+
17
+ ## Usage
18
+
19
+ Run `rbs:settingslogic:setup` task:
20
+
21
+ bundle exec rake rbs:settingslogic:setup
22
+
23
+ Then rbs_settingslogic will scan your source code and generate RBS files into
24
+ `sig/settingslogic` directory.
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bin/setup` to install dependencies. You can also
29
+ run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`.
32
+
33
+ To release a new version, update the version number in `version.rb`, and then put
34
+ a git tag (ex. `git tag v1.0.0`) and push it to the GitHub. Then GitHub Actions
35
+ will release a new package to [rubygems.org](https://rubygems.org) automatically.
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tk0miya/rbs_settingslogic.
40
+ This project is intended to be a safe, welcoming space for collaboration, and
41
+ contributors are expected to adhere to the [code of conduct](https://github.com/tk0miya/rbs_settingslogic/blob/main/CODE_OF_CONDUCT.md).
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+
47
+ ## Code of Conduct
48
+
49
+ Everyone interacting in the rbs_settingslogic project's codebases, issue trackers
50
+ is expected to follow the [code of conduct](https://github.com/tk0miya/rbs_settingslogic/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/Steepfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ D = Steep::Diagnostic
4
+
5
+ target :lib do
6
+ signature "sig"
7
+ signature "lib/rbs_settingslogic/sig"
8
+
9
+ check "lib"
10
+
11
+ configure_code_diagnostics(D::Ruby.lenient)
12
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+
5
+ module RbsSettingslogic
6
+ class InstallGenerator < Rails::Generators::Base
7
+ def create_raketask
8
+ create_file "lib/tasks/rbs_settingslogic.rake", <<~RUBY
9
+ begin
10
+ require 'rbs_settingslogic/rake_task'
11
+
12
+ RbsSettingslogic::RakeTask.new
13
+ rescue LoadError
14
+ # failed to load rbs_settingslogic. Skip to load rbs_settingslogic tasks.
15
+ end
16
+ RUBY
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/class"
4
+ require "fileutils"
5
+ require "pathname"
6
+ require "rake/tasklib"
7
+
8
+ module RbsSettingslogic
9
+ class RakeTask < Rake::TaskLib
10
+ attr_accessor :name, :signature_root_dir
11
+
12
+ def initialize(name = :"rbs:settingslogic", &block)
13
+ super()
14
+
15
+ @name = name
16
+ @signature_root_dir = Rails.root / "sig/settingslogic"
17
+
18
+ block&.call(self)
19
+
20
+ define_clean_task
21
+ define_base_class_generate_task
22
+ define_generate_task
23
+ define_setup_task
24
+ end
25
+
26
+ def define_setup_task
27
+ desc "Run all tasks of rbs_settingslogic"
28
+
29
+ deps = [:"#{name}:clean", :"#{name}:generate", :"#{name}:base_class:generate"]
30
+ task("#{name}:setup" => deps)
31
+ end
32
+
33
+ def define_base_class_generate_task
34
+ desc "Generate RBS files for base class"
35
+ task "#{name}:base_class:generate": :environment do
36
+ signature_root_dir.mkpath
37
+
38
+ basedir = Pathname(__FILE__).dirname
39
+ FileUtils.cp basedir / "sig/settingslogic.rbs", signature_root_dir
40
+ end
41
+ end
42
+
43
+ def define_generate_task
44
+ desc "Generate RBS files for settingslogic gem"
45
+ task "#{name}:generate": :environment do
46
+ require "rbs_settingslogic" # load RbsSettingslogic lazily
47
+
48
+ Rails.application.eager_load!
49
+
50
+ ::Settingslogic.descendants.each do |klass|
51
+ path = signature_root_dir / "#{klass.name.to_s.underscore}.rbs"
52
+ path.dirname.mkpath
53
+ path.write(RbsSettingslogic::Settingslogic.generate(klass))
54
+ end
55
+ end
56
+ end
57
+
58
+ def define_clean_task
59
+ desc "Clean RBS files for settingslogic gem"
60
+ task "#{name}:clean": :environment do
61
+ signature_root_dir.rmtree if signature_root_dir.exist?
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/string/inflections"
4
+ require "rbs"
5
+
6
+ module RbsSettingslogic
7
+ module Settingslogic
8
+ def self.generate(klass)
9
+ Generator.new(klass).generate
10
+ end
11
+
12
+ class Generator
13
+ attr_reader :klass
14
+
15
+ def initialize(klass)
16
+ @klass = klass
17
+ end
18
+
19
+ def generate
20
+ format <<~RBS
21
+ class #{klass.name} < ::Settingslogic
22
+ #{generate_classes(klass)}
23
+ #{generate_methods(klass)}
24
+ end
25
+ RBS
26
+ end
27
+
28
+ private
29
+
30
+ def format(rbs)
31
+ parsed = RBS::Parser.parse_signature(rbs)
32
+ StringIO.new.tap do |out|
33
+ RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
34
+ end.string
35
+ end
36
+
37
+ def generate_classes(config)
38
+ config.filter_map do |key, value|
39
+ case value
40
+ when Hash
41
+ <<~RBS
42
+ class #{key.to_s.camelize} < ::Settingslogic
43
+ #{generate_classes(value)}
44
+ #{generate_methods(value)}
45
+ end
46
+ RBS
47
+ when Array
48
+ value.filter_map.with_index do |v, i|
49
+ case v
50
+ when Hash
51
+ <<~RBS
52
+ class #{key.to_s.camelize}#{i} < ::Settingslogic
53
+ #{generate_classes(v)}
54
+ #{generate_methods(v)}
55
+ end
56
+ RBS
57
+ end
58
+ end.join("\n")
59
+ end
60
+ end.join("\n")
61
+ end
62
+
63
+ def generate_methods(config)
64
+ config.map do |key, value|
65
+ "def self.#{key}: () -> #{stringify_type(key, value)}"
66
+ end.join("\n")
67
+ end
68
+
69
+ def stringify_type(name, value, index = nil)
70
+ case value
71
+ when Hash
72
+ "singleton(#{name.camelize}#{index})"
73
+ when Array
74
+ types = value.map.with_index { |v, i| stringify_type(name, v, i) }.uniq
75
+ "Array[#{types.join(" | ")}]"
76
+ when NilClass
77
+ "nil"
78
+ when TrueClass, FalseClass
79
+ "bool"
80
+ else
81
+ value.class.to_s
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,30 @@
1
+ class Settingslogic < Hash[untyped, untyped]
2
+ extend Enumerable[[untyped, untyped]]
3
+ def self.each: [U] () { ([untyped, untyped] arg0) -> U } -> self
4
+ | () -> Enumerator[[untyped, untyped], self]
5
+ def self.get: (untyped key) -> untyped
6
+ def self.source: (?untyped value) -> untyped
7
+ def self.namespace: (?untyped value) -> untyped
8
+ def self.suppress_errors: (?untyped value) -> untyped
9
+ def self.[]: (untyped key) -> untyped
10
+ def self.[]=: (untyped key, untyped val) -> untyped
11
+ def self.load!: () -> true
12
+ def self.reload!: () -> true
13
+
14
+ # methods from Hash instance
15
+
16
+ def self.deep_symbolize_keys: () -> Hash[Symbol, untyped]
17
+ def self.dig: (*untyped keys) -> untyped
18
+ def self.fetch: (untyped key, ?untyped default) -> untyped
19
+ def self.find: () { ([untyped, untyped]) -> boolish } -> [untyped, untyped]?
20
+ def self.key?: (untyped key) -> bool
21
+ def self.merge: (*Hash[untyped, untyped] other_hash) -> Hash[untyped, untyped]
22
+ def self.symbolize_keys: () -> Hash[Symbol, untyped]
23
+ def self.to_h: () -> Hash[untyped, untyped]
24
+ def self.values: () -> Array[untyped]
25
+
26
+ def []: (untyped key) -> untyped
27
+ def []=: (untyped key, untyped val) -> untyped
28
+ def to_hash: () -> Hash[untyped, untyped]
29
+ def symbolize_keys: () -> Hash[untyped, untyped]
30
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RbsSettingslogic
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rbs_settingslogic/settingslogic"
4
+ require_relative "rbs_settingslogic/version"
5
+
6
+ module RbsSettingslogic
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,182 @@
1
+ ---
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
6
+ remote: https://github.com/ruby/gem_rbs_collection.git
7
+ repo_dir: gems
8
+ path: ".gem_rbs_collection"
9
+ gems:
10
+ - name: abbrev
11
+ version: '0'
12
+ source:
13
+ type: stdlib
14
+ - name: actionpack
15
+ version: '6.0'
16
+ source:
17
+ type: git
18
+ name: ruby/gem_rbs_collection
19
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
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: c560bb18418e07a709f80954db2e2d975bbd6e14
28
+ remote: https://github.com/ruby/gem_rbs_collection.git
29
+ repo_dir: gems
30
+ - name: activesupport
31
+ version: '7.0'
32
+ source:
33
+ type: git
34
+ name: ruby/gem_rbs_collection
35
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
36
+ remote: https://github.com/ruby/gem_rbs_collection.git
37
+ repo_dir: gems
38
+ - name: ast
39
+ version: '2.4'
40
+ source:
41
+ type: git
42
+ name: ruby/gem_rbs_collection
43
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
44
+ remote: https://github.com/ruby/gem_rbs_collection.git
45
+ repo_dir: gems
46
+ - name: base64
47
+ version: '0'
48
+ source:
49
+ type: stdlib
50
+ - name: cgi
51
+ version: '0'
52
+ source:
53
+ type: stdlib
54
+ - name: concurrent-ruby
55
+ version: '1.1'
56
+ source:
57
+ type: git
58
+ name: ruby/gem_rbs_collection
59
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
60
+ remote: https://github.com/ruby/gem_rbs_collection.git
61
+ repo_dir: gems
62
+ - name: date
63
+ version: '0'
64
+ source:
65
+ type: stdlib
66
+ - name: erb
67
+ version: '0'
68
+ source:
69
+ type: stdlib
70
+ - name: fileutils
71
+ version: '0'
72
+ source:
73
+ type: stdlib
74
+ - name: i18n
75
+ version: '1.10'
76
+ source:
77
+ type: git
78
+ name: ruby/gem_rbs_collection
79
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
80
+ remote: https://github.com/ruby/gem_rbs_collection.git
81
+ repo_dir: gems
82
+ - name: json
83
+ version: '0'
84
+ source:
85
+ type: stdlib
86
+ - name: logger
87
+ version: '0'
88
+ source:
89
+ type: stdlib
90
+ - name: minitest
91
+ version: '0'
92
+ source:
93
+ type: stdlib
94
+ - name: monitor
95
+ version: '0'
96
+ source:
97
+ type: stdlib
98
+ - name: mutex_m
99
+ version: '0'
100
+ source:
101
+ type: stdlib
102
+ - name: optparse
103
+ version: '0'
104
+ source:
105
+ type: stdlib
106
+ - name: parallel
107
+ version: '1.20'
108
+ source:
109
+ type: git
110
+ name: ruby/gem_rbs_collection
111
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
112
+ remote: https://github.com/ruby/gem_rbs_collection.git
113
+ repo_dir: gems
114
+ - name: pathname
115
+ version: '0'
116
+ source:
117
+ type: stdlib
118
+ - name: rack
119
+ version: '2.2'
120
+ source:
121
+ type: git
122
+ name: ruby/gem_rbs_collection
123
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
124
+ remote: https://github.com/ruby/gem_rbs_collection.git
125
+ repo_dir: gems
126
+ - name: railties
127
+ version: '6.0'
128
+ source:
129
+ type: git
130
+ name: ruby/gem_rbs_collection
131
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
132
+ remote: https://github.com/ruby/gem_rbs_collection.git
133
+ repo_dir: gems
134
+ - name: rainbow
135
+ version: '3.0'
136
+ source:
137
+ type: git
138
+ name: ruby/gem_rbs_collection
139
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
140
+ remote: https://github.com/ruby/gem_rbs_collection.git
141
+ repo_dir: gems
142
+ - name: rbs
143
+ version: 3.2.1
144
+ source:
145
+ type: rubygems
146
+ - name: rdoc
147
+ version: '0'
148
+ source:
149
+ type: stdlib
150
+ - name: securerandom
151
+ version: '0'
152
+ source:
153
+ type: stdlib
154
+ - name: singleton
155
+ version: '0'
156
+ source:
157
+ type: stdlib
158
+ - name: tempfile
159
+ version: '0'
160
+ source:
161
+ type: stdlib
162
+ - name: thor
163
+ version: '1.2'
164
+ source:
165
+ type: git
166
+ name: ruby/gem_rbs_collection
167
+ revision: c560bb18418e07a709f80954db2e2d975bbd6e14
168
+ remote: https://github.com/ruby/gem_rbs_collection.git
169
+ repo_dir: gems
170
+ - name: time
171
+ version: '0'
172
+ source:
173
+ type: stdlib
174
+ - name: tsort
175
+ version: '0'
176
+ source:
177
+ type: stdlib
178
+ - name: uri
179
+ version: '0'
180
+ source:
181
+ type: stdlib
182
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,22 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ gems:
17
+ - name: actionpack
18
+ - name: actionview
19
+ - name: fileutils
20
+ - name: railties
21
+ - name: rack
22
+ - name: thor
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rbs_settingslogic/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rbs_settingslogic"
7
+ spec.version = RbsSettingslogic::VERSION
8
+ spec.authors = ["Takeshi KOMIYA"]
9
+ spec.email = ["i.tkomiya@gmail.com"]
10
+
11
+ spec.summary = "A RBS files generator for Settingslogic gem"
12
+ spec.description = "A RBS files generator for Settingslogic gem"
13
+ spec.homepage = "https://github.com/tk0miya/rbs_settingslogic"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage
20
+
21
+ spec.files = Dir.chdir(__dir__) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (File.expand_path(f) == __FILE__) ||
24
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "activesupport"
32
+ spec.add_dependency "rbs"
33
+ spec.add_dependency "settingslogic"
34
+
35
+ # For more information and examples about making a new gem, check out our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end
@@ -0,0 +1,5 @@
1
+ module RbsSettingslogic
2
+ class InstallGenerator < Rails::Generators::Base
3
+ def create_raketask: () -> void
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ module RbsSettingslogic
2
+ class RakeTask < Rake::TaskLib
3
+ attr_accessor name: Symbol
4
+ attr_accessor signature_root_dir: Pathname
5
+
6
+ def initialize: (?Symbol name) ? { (RakeTask) -> void } -> void
7
+ def define_setup_task: () -> void
8
+ def define_base_class_generate_task: () -> void
9
+ def define_generate_task: () -> void
10
+ def define_clean_task: () -> void
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ module RbsSettingslogic
2
+ module Settingslogic
3
+ def self.generate: (singleton(::Settingslogic) klass) -> String
4
+
5
+ class Generator
6
+ attr_reader klass: singleton(::Settingslogic)
7
+
8
+ def initialize: (singleton(::Settingslogic) klass) -> void
9
+ def generate: () -> String
10
+
11
+ private
12
+
13
+ def format: (String rbs) -> String
14
+ def generate_classes: (singleton(::Settingslogic) | Hash[untyped, untyped] config) -> String
15
+ def generate_methods: (singleton(::Settingslogic) | Hash[untyped, untyped] config) -> String
16
+ def stringify_type: (untyped name, untyped value, ?Integer? index) -> String
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ module RbsSettingslogic
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -0,0 +1,18 @@
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
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbs_settingslogic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Takeshi KOMIYA
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rbs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: settingslogic
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A RBS files generator for Settingslogic gem
56
+ email:
57
+ - i.tkomiya@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".rubocop.yml"
63
+ - ".vscode/extensions.json"
64
+ - ".vscode/settings.json"
65
+ - CODE_OF_CONDUCT.md
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - Steepfile
70
+ - lib/generators/rbs_settingslogic/install_generator.rb
71
+ - lib/rbs_settingslogic.rb
72
+ - lib/rbs_settingslogic/rake_task.rb
73
+ - lib/rbs_settingslogic/settingslogic.rb
74
+ - lib/rbs_settingslogic/sig/settingslogic.rbs
75
+ - lib/rbs_settingslogic/version.rb
76
+ - rbs_collection.lock.yaml
77
+ - rbs_collection.yaml
78
+ - rbs_settingslogic.gemspec
79
+ - sig/generators/rbs_settingslogic/install_generator.rbs
80
+ - sig/rbs_settingslogic.rbs
81
+ - sig/rbs_settingslogic/rake_task.rbs
82
+ - sig/rbs_settingslogic/settingslogic.rbs
83
+ - sig/shims/rake.rbs
84
+ homepage: https://github.com/tk0miya/rbs_settingslogic
85
+ licenses:
86
+ - MIT
87
+ metadata:
88
+ homepage_uri: https://github.com/tk0miya/rbs_settingslogic
89
+ source_code_uri: https://github.com/tk0miya/rbs_settingslogic
90
+ changelog_uri: https://github.com/tk0miya/rbs_settingslogic
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 2.6.0
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.4.10
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: A RBS files generator for Settingslogic gem
110
+ test_files: []