rbs_actionmailer 1.0.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: f94c5128bdf5960b85f877a52e54aa382534ada4f41859aef9e6fd39b10cbfea
4
+ data.tar.gz: 142b1f42627e59458dd2c4fe9ccddfee7ef7b7bd84cc98918fdafdcd68c835a8
5
+ SHA512:
6
+ metadata.gz: 65678c0ed7ae2305f190f0c1b7356b4daefaa4364e1542b6aa370d109b321c9a96835be5211ede2e96a04affea6e925af6a7413afe75a29b5028009732f0b591
7
+ data.tar.gz: 3093c27c90d5ccebba6bba7658fee5045b31a956eeb869926ccc2740c107240dae21d4d58e6f205f20f775ff4ee7359e397d23f5b2fe8254ff46e7184d969a90
data/.rubocop.yml ADDED
@@ -0,0 +1,27 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.7
3
+
4
+ Metrics/AbcSize:
5
+ Max: 20
6
+
7
+ Metrics/MethodLength:
8
+ Max: 20
9
+
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ Style/StringLiterals:
14
+ EnforcedStyle: double_quotes
15
+
16
+ Style/StringLiteralsInInterpolation:
17
+ EnforcedStyle: double_quotes
18
+
19
+ # for RBS::Inline
20
+ Layout/LeadingCommentSpace:
21
+ Enabled: false
22
+
23
+ Style/AccessorGrouping:
24
+ Enabled: false
25
+
26
+ Style/CommentedKeyword:
27
+ Enabled: false
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "shopify.ruby-lsp",
4
+ "tk0miya.rbs-helper",
5
+ "soutaro.steep-vscode",
6
+ "tk0miya.rspec-daemon"
7
+ ]
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "[ruby]": {
3
+ "editor.defaultFormatter": "Shopify.ruby-lsp"
4
+ },
5
+ "rbs-helper.rbs-inline-on-save": true,
6
+ "rbs-helper.rbs-inline-signature-directory": "sig/",
7
+ "cSpell.words": [
8
+ "actionmailer",
9
+ "codebases",
10
+ "rubygems"
11
+ ]
12
+ }
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 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,68 @@
1
+ # rbs_actionmailer
2
+
3
+ rbs_actionmailer is a RBS generator for [actionmailer](https://github.com/rails/rails/blob/main/actionmailer/README.rdoc)
4
+
5
+ ## Installation
6
+
7
+ Add a new entry to your Gemfile and run `bundle install`:
8
+
9
+ group :development do
10
+ gem 'rbs_actionmailer', require: false
11
+ end
12
+
13
+ After the installation, please run rake task generator:
14
+
15
+ bundle exec rails g rbs_actionmailer:install
16
+
17
+ ## Usage
18
+
19
+ Run `rbs:actionmailer:setup` task:
20
+
21
+ bundle exec rake rbs:actionmailer:setup
22
+
23
+ Then rbs_actionmailer will scan your source code and generate RBS files into
24
+ `sig/actionmailer` directory.
25
+
26
+ rbs_actionmailer supports [RBS::Inline](https://github.com/soutaro/rbs-inline) style type annotations.
27
+ If your mailer class has type annotation comments, they will be applied to the generated RBS:
28
+
29
+ ```ruby
30
+ class MyMailer < ActionMailer::Base
31
+ # @rbs user: User
32
+ def welcome(user)
33
+ end
34
+ end
35
+ ```
36
+
37
+ rbs_actionmailer will generate the following RBS:
38
+
39
+ ```ruby
40
+ class MyMailer < ActionMailer::Base
41
+ def self.welcome: (User user) -> ActionMailer::MessageDelivery
42
+ def welcome: (User user) -> Mail::Message
43
+ end
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. You can also
49
+ run `bin/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ To release a new version, update the version number in `version.rb`, and then put
52
+ a git tag (ex. `git tag v1.0.0`) and push it to the GitHub. Then GitHub Actions
53
+ will release a new package to [rubygems.org](https://rubygems.org).
54
+
55
+ ## Contributing
56
+
57
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tk0miya/rbs_actionmailer.
58
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are
59
+ expected to adhere to the [code of conduct](https://github.com/tk0miya/rbs_actionmailer/blob/main/CODE_OF_CONDUCT.md).
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
64
+
65
+ ## Code of Conduct
66
+
67
+ Everyone interacting in the RbsActionmailer project's codebases, issue is expected to
68
+ follow the [code of conduct](https://github.com/tk0miya/rbs_actionmailer/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,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ D = Steep::Diagnostic
4
+
5
+ target :lib do
6
+ signature "sig"
7
+
8
+ check "lib"
9
+
10
+ configure_code_diagnostics(D::Ruby.lenient)
11
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RbsActionmailer
4
+ class InstallGenerator < Rails::Generators::Base
5
+ def create_raketask
6
+ create_file "lib/tasks/rbs_actionmailer.rake", <<~RUBY
7
+ # frozen_string_literal: true
8
+
9
+ begin
10
+ require "rbs_actionmailer/rake_task"
11
+
12
+ RbsActionmailer::RakeTask.new
13
+ rescue LoadError
14
+ # failed to load rbs_actionmailer. Skip to load rbs_actionmailer tasks.
15
+ end
16
+ RUBY
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rbs"
4
+ require "active_support/core_ext/module"
5
+
6
+ module RbsActionmailer
7
+ class Generator
8
+ attr_reader :klass #: singleton(ActionMailer::Base)
9
+ attr_reader :klass_name #: String
10
+ attr_reader :decl #: RBS::Inline::AST::Declarations::ClassDecl | RBS::Inline::AST::Declarations::ModuleDecl | nil
11
+
12
+ # @rbs klass: singleton(ActionMailer::Base)
13
+ def initialize(klass) #: void
14
+ @klass = klass
15
+ @klass_name = klass.name || ""
16
+ end
17
+
18
+ def generate #: String
19
+ @decl = Parser.parse(klass_name)
20
+
21
+ format <<~RBS
22
+ #{header}
23
+ #{methods}
24
+ #{footer}
25
+ RBS
26
+ end
27
+
28
+ private
29
+
30
+ # @rbs rbs: String
31
+ def format(rbs) #: String
32
+ parsed = RBS::Parser.parse_signature(rbs)
33
+ StringIO.new.tap do |out|
34
+ RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
35
+ end.string
36
+ end
37
+
38
+ def header #: String
39
+ namespace = +""
40
+ klass_name.split("::").map do |mod_name|
41
+ namespace += "::#{mod_name}"
42
+ mod_object = Object.const_get(namespace)
43
+ case mod_object
44
+ when Class
45
+ # @type var superclass: Class
46
+ superclass = _ = mod_object.superclass
47
+ superclass_name = superclass.name || "Object"
48
+
49
+ "class #{mod_name} < ::#{superclass_name}"
50
+ when Module
51
+ "module #{mod_name}"
52
+ else
53
+ raise "unreachable"
54
+ end
55
+ end.join("\n")
56
+ end
57
+
58
+ def methods #: String
59
+ klass.action_methods.sort.map do |method_name|
60
+ arg_types = arguments_for(method_name)
61
+ singleton_method_types = arg_types.map { |args| "(#{args}) -> ActionMailer::MessageDelivery" }.join(" | ")
62
+ instance_method_types = arg_types.map { |args| "(#{args}) -> Mail::Message" }.join(" | ")
63
+ <<~RBS
64
+ def self.#{method_name}: #{singleton_method_types}
65
+ def #{method_name}: #{instance_method_types}
66
+ RBS
67
+ end.join("\n")
68
+ end
69
+
70
+ # @rbs method_name: String
71
+ def arguments_for(method_name) #: Array[String]
72
+ return ["*untyped"] unless decl
73
+
74
+ member = decl.members.find do |m|
75
+ case m
76
+ when RBS::Inline::AST::Members::RubyDef
77
+ m.node.name.to_s == method_name
78
+ end
79
+ end #: RBS::Inline::AST::Members::RubyDef?
80
+
81
+ return ["*untyped"] unless member
82
+
83
+ member.method_overloads.map { |overload| overload.method_type.type.param_to_s }
84
+ end
85
+
86
+ def footer #: String
87
+ "end\n" * klass.module_parents.size
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "prism"
4
+ require "rbs/inline"
5
+
6
+ module RbsActionmailer
7
+ class Parser
8
+ # @rbs! type t = RBS::Inline::AST::Declarations::ClassDecl | RBS::Inline::AST::Declarations::ModuleDecl
9
+
10
+ # @rbs klass_name: String
11
+ def self.parse(klass_name) #: t?
12
+ parser = new
13
+ parser.parse(klass_name)
14
+ end
15
+
16
+ # @rbs klass_name: String
17
+ def parse(klass_name) #: t?
18
+ decls = load(klass_name)
19
+ return unless decls
20
+
21
+ names = klass_name.split("::").map(&:to_sym)
22
+ dig(decls, *names)
23
+ end
24
+
25
+ private
26
+
27
+ # @rbs klass_name: String
28
+ def load(klass_name) #: Array[RBS::Inline::AST::Declarations::t]?
29
+ filename, = Object.const_source_location(klass_name) #: String?
30
+ return unless filename && File.exist?(filename)
31
+
32
+ parse_result = Prism.parse(File.read(filename))
33
+ _, decls, = RBS::Inline::Parser.parse(parse_result, opt_in: false)
34
+ decls
35
+ end
36
+
37
+ # @rbs decls: Array[RBS::Inline::AST::Declarations::t | RBS::Inline::AST::Members::t]
38
+ # @rbs name: Symbol
39
+ # @rbs *remains: Symbol
40
+ def dig(decls, name, *remains) #: t?
41
+ decls.each do |decl|
42
+ case decl
43
+ when RBS::Inline::AST::Declarations::ClassDecl, RBS::Inline::AST::Declarations::ModuleDecl
44
+ if decl.node.name == name
45
+ return decl if remains.empty?
46
+
47
+ return dig(decl.members, *remains)
48
+ end
49
+ end
50
+ end
51
+
52
+ nil
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "rake/task"
5
+
6
+ module RbsActionmailer
7
+ class RakeTask < Rake::TaskLib
8
+ attr_accessor :name #: Symbol
9
+ attr_accessor :signature_root_dir #: Pathname
10
+
11
+ # @rbs name: Symbol
12
+ # @rbs &block: ?(self) -> void
13
+ def initialize(name = :'rbs:actionmailer', &block) #: void
14
+ super()
15
+
16
+ @name = name
17
+ @signature_root_dir = Rails.root / "sig/actionmailer"
18
+
19
+ block&.call(self)
20
+
21
+ define_clean_task
22
+ define_generate_task
23
+ define_setup_task
24
+ end
25
+
26
+ def define_setup_task #: void
27
+ deps = [:"#{name}:clean", :"#{name}:generate"]
28
+
29
+ desc "Run all tasks of rbs_actionmailer"
30
+ task("#{name}:setup" => deps)
31
+ end
32
+
33
+ def define_clean_task #: void
34
+ desc "Clean up generated RBS files"
35
+ task("#{name}:clean": :environment) do
36
+ sh "rm", "-rf", signature_root_dir.to_s
37
+ end
38
+ end
39
+
40
+ def define_generate_task #: void
41
+ desc "Generate RBS files for ActionMailer classes"
42
+ task("#{name}:generate": :environment) do
43
+ require "rbs_actionmailer" # load RbsActionMailer lazily
44
+
45
+ Rails.application.eager_load!
46
+
47
+ ActionMailer::Base.descendants.each do |klass|
48
+ path = signature_root_dir / "app/mailers/#{klass.name.underscore}.rbs"
49
+ path.dirname.mkpath
50
+ rbs = RbsActionmailer::Generator.new(klass).generate
51
+ path.write rbs if rbs
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RbsActionmailer
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rbs_actionmailer/generator"
4
+ require_relative "rbs_actionmailer/parser"
5
+ require_relative "rbs_actionmailer/version"
6
+
7
+ module RbsActionmailer
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
@@ -0,0 +1,328 @@
1
+ ---
2
+ path: ".gem_rbs_collection"
3
+ gems:
4
+ - name: actionmailer
5
+ version: '7.0'
6
+ source:
7
+ type: git
8
+ name: ruby/gem_rbs_collection
9
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
10
+ remote: https://github.com/ruby/gem_rbs_collection.git
11
+ repo_dir: gems
12
+ - name: actionpack
13
+ version: '7.2'
14
+ source:
15
+ type: git
16
+ name: ruby/gem_rbs_collection
17
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
18
+ remote: https://github.com/ruby/gem_rbs_collection.git
19
+ repo_dir: gems
20
+ - name: actionview
21
+ version: '6.0'
22
+ source:
23
+ type: git
24
+ name: ruby/gem_rbs_collection
25
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
26
+ remote: https://github.com/ruby/gem_rbs_collection.git
27
+ repo_dir: gems
28
+ - name: activejob
29
+ version: '6.0'
30
+ source:
31
+ type: git
32
+ name: ruby/gem_rbs_collection
33
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
34
+ remote: https://github.com/ruby/gem_rbs_collection.git
35
+ repo_dir: gems
36
+ - name: activesupport
37
+ version: '7.0'
38
+ source:
39
+ type: git
40
+ name: ruby/gem_rbs_collection
41
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
42
+ remote: https://github.com/ruby/gem_rbs_collection.git
43
+ repo_dir: gems
44
+ - name: ast
45
+ version: '2.4'
46
+ source:
47
+ type: git
48
+ name: ruby/gem_rbs_collection
49
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
50
+ remote: https://github.com/ruby/gem_rbs_collection.git
51
+ repo_dir: gems
52
+ - name: base64
53
+ version: '0'
54
+ source:
55
+ type: stdlib
56
+ - name: bigdecimal
57
+ version: '0'
58
+ source:
59
+ type: stdlib
60
+ - name: cgi
61
+ version: '0'
62
+ source:
63
+ type: stdlib
64
+ - name: concurrent-ruby
65
+ version: '1.1'
66
+ source:
67
+ type: git
68
+ name: ruby/gem_rbs_collection
69
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
70
+ remote: https://github.com/ruby/gem_rbs_collection.git
71
+ repo_dir: gems
72
+ - name: connection_pool
73
+ version: '2.4'
74
+ source:
75
+ type: git
76
+ name: ruby/gem_rbs_collection
77
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
78
+ remote: https://github.com/ruby/gem_rbs_collection.git
79
+ repo_dir: gems
80
+ - name: date
81
+ version: '0'
82
+ source:
83
+ type: stdlib
84
+ - name: dbm
85
+ version: '0'
86
+ source:
87
+ type: stdlib
88
+ - name: erb
89
+ version: '0'
90
+ source:
91
+ type: stdlib
92
+ - name: fileutils
93
+ version: '0'
94
+ source:
95
+ type: stdlib
96
+ - name: globalid
97
+ version: '1.1'
98
+ source:
99
+ type: git
100
+ name: ruby/gem_rbs_collection
101
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
102
+ remote: https://github.com/ruby/gem_rbs_collection.git
103
+ repo_dir: gems
104
+ - name: i18n
105
+ version: '1.10'
106
+ source:
107
+ type: git
108
+ name: ruby/gem_rbs_collection
109
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
110
+ remote: https://github.com/ruby/gem_rbs_collection.git
111
+ repo_dir: gems
112
+ - name: io-console
113
+ version: '0'
114
+ source:
115
+ type: stdlib
116
+ - name: json
117
+ version: '0'
118
+ source:
119
+ type: stdlib
120
+ - name: logger
121
+ version: '0'
122
+ source:
123
+ type: stdlib
124
+ - name: mail
125
+ version: '2.8'
126
+ source:
127
+ type: git
128
+ name: ruby/gem_rbs_collection
129
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
130
+ remote: https://github.com/ruby/gem_rbs_collection.git
131
+ repo_dir: gems
132
+ - name: mini_mime
133
+ version: '0.1'
134
+ source:
135
+ type: git
136
+ name: ruby/gem_rbs_collection
137
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
138
+ remote: https://github.com/ruby/gem_rbs_collection.git
139
+ repo_dir: gems
140
+ - name: minitest
141
+ version: '0'
142
+ source:
143
+ type: stdlib
144
+ - name: monitor
145
+ version: '0'
146
+ source:
147
+ type: stdlib
148
+ - name: mutex_m
149
+ version: '0'
150
+ source:
151
+ type: stdlib
152
+ - name: net-protocol
153
+ version: '0'
154
+ source:
155
+ type: stdlib
156
+ - name: net-smtp
157
+ version: '0'
158
+ source:
159
+ type: stdlib
160
+ - name: nokogiri
161
+ version: '1.11'
162
+ source:
163
+ type: git
164
+ name: ruby/gem_rbs_collection
165
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
166
+ remote: https://github.com/ruby/gem_rbs_collection.git
167
+ repo_dir: gems
168
+ - name: optparse
169
+ version: '0'
170
+ source:
171
+ type: stdlib
172
+ - name: parallel
173
+ version: '1.20'
174
+ source:
175
+ type: git
176
+ name: ruby/gem_rbs_collection
177
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
178
+ remote: https://github.com/ruby/gem_rbs_collection.git
179
+ repo_dir: gems
180
+ - name: parser
181
+ version: '3.2'
182
+ source:
183
+ type: git
184
+ name: ruby/gem_rbs_collection
185
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
186
+ remote: https://github.com/ruby/gem_rbs_collection.git
187
+ repo_dir: gems
188
+ - name: pathname
189
+ version: '0'
190
+ source:
191
+ type: stdlib
192
+ - name: prism
193
+ version: 1.0.0
194
+ source:
195
+ type: rubygems
196
+ - name: pstore
197
+ version: '0'
198
+ source:
199
+ type: stdlib
200
+ - name: psych
201
+ version: '0'
202
+ source:
203
+ type: stdlib
204
+ - name: rack
205
+ version: '2.2'
206
+ source:
207
+ type: git
208
+ name: ruby/gem_rbs_collection
209
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
210
+ remote: https://github.com/ruby/gem_rbs_collection.git
211
+ repo_dir: gems
212
+ - name: rails-dom-testing
213
+ version: '2.0'
214
+ source:
215
+ type: git
216
+ name: ruby/gem_rbs_collection
217
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
218
+ remote: https://github.com/ruby/gem_rbs_collection.git
219
+ repo_dir: gems
220
+ - name: railties
221
+ version: '6.0'
222
+ source:
223
+ type: git
224
+ name: ruby/gem_rbs_collection
225
+ revision: 218cf130d31f63e110e350efc3fa265311b0f238
226
+ remote: https://github.com/ruby/gem_rbs_collection.git
227
+ repo_dir: gems
228
+ - name: rainbow
229
+ version: '3.0'
230
+ source:
231
+ type: git
232
+ name: ruby/gem_rbs_collection
233
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
234
+ remote: https://github.com/ruby/gem_rbs_collection.git
235
+ repo_dir: gems
236
+ - name: rake
237
+ version: '13.0'
238
+ source:
239
+ type: git
240
+ name: ruby/gem_rbs_collection
241
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
242
+ remote: https://github.com/ruby/gem_rbs_collection.git
243
+ repo_dir: gems
244
+ - name: rbs
245
+ version: 3.6.1
246
+ source:
247
+ type: rubygems
248
+ - name: rbs-inline
249
+ version: 0.9.0
250
+ source:
251
+ type: rubygems
252
+ - name: rdoc
253
+ version: '0'
254
+ source:
255
+ type: stdlib
256
+ - name: regexp_parser
257
+ version: '2.8'
258
+ source:
259
+ type: git
260
+ name: ruby/gem_rbs_collection
261
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
262
+ remote: https://github.com/ruby/gem_rbs_collection.git
263
+ repo_dir: gems
264
+ - name: rubocop
265
+ version: '1.57'
266
+ source:
267
+ type: git
268
+ name: ruby/gem_rbs_collection
269
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
270
+ remote: https://github.com/ruby/gem_rbs_collection.git
271
+ repo_dir: gems
272
+ - name: rubocop-ast
273
+ version: '1.30'
274
+ source:
275
+ type: git
276
+ name: ruby/gem_rbs_collection
277
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
278
+ remote: https://github.com/ruby/gem_rbs_collection.git
279
+ repo_dir: gems
280
+ - name: securerandom
281
+ version: '0'
282
+ source:
283
+ type: stdlib
284
+ - name: singleton
285
+ version: '0'
286
+ source:
287
+ type: stdlib
288
+ - name: strscan
289
+ version: '0'
290
+ source:
291
+ type: stdlib
292
+ - name: tempfile
293
+ version: '0'
294
+ source:
295
+ type: stdlib
296
+ - name: thor
297
+ version: '1.2'
298
+ source:
299
+ type: git
300
+ name: ruby/gem_rbs_collection
301
+ revision: 218cf130d31f63e110e350efc3fa265311b0f238
302
+ remote: https://github.com/ruby/gem_rbs_collection.git
303
+ repo_dir: gems
304
+ - name: time
305
+ version: '0'
306
+ source:
307
+ type: stdlib
308
+ - name: timeout
309
+ version: '0'
310
+ source:
311
+ type: stdlib
312
+ - name: tsort
313
+ version: '0'
314
+ source:
315
+ type: stdlib
316
+ - name: tzinfo
317
+ version: '2.0'
318
+ source:
319
+ type: git
320
+ name: ruby/gem_rbs_collection
321
+ revision: 704f7e6b395fca717cc25c562598ca86015ed545
322
+ remote: https://github.com/ruby/gem_rbs_collection.git
323
+ repo_dir: gems
324
+ - name: uri
325
+ version: '0'
326
+ source:
327
+ type: stdlib
328
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,17 @@
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: strscan
@@ -0,0 +1,7 @@
1
+ # Generated from lib/generators/rbs_actionmailer/install_generator.rb with RBS::Inline
2
+
3
+ module RbsActionmailer
4
+ class InstallGenerator < Rails::Generators::Base
5
+ def create_raketask: () -> untyped
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ # Generated from lib/rbs_actionmailer/generator.rb with RBS::Inline
2
+
3
+ module RbsActionmailer
4
+ class Generator
5
+ attr_reader klass: singleton(ActionMailer::Base)
6
+
7
+ attr_reader klass_name: String
8
+
9
+ attr_reader decl: RBS::Inline::AST::Declarations::ClassDecl | RBS::Inline::AST::Declarations::ModuleDecl | nil
10
+
11
+ # @rbs klass: singleton(ActionMailer::Base)
12
+ def initialize: (singleton(ActionMailer::Base) klass) -> void
13
+
14
+ def generate: () -> String
15
+
16
+ private
17
+
18
+ # @rbs rbs: String
19
+ def format: (String rbs) -> String
20
+
21
+ def header: () -> String
22
+
23
+ def methods: () -> String
24
+
25
+ # @rbs method_name: String
26
+ def arguments_for: (String method_name) -> Array[String]
27
+
28
+ def footer: () -> String
29
+ end
30
+ end
@@ -0,0 +1,23 @@
1
+ # Generated from lib/rbs_actionmailer/parser.rb with RBS::Inline
2
+
3
+ module RbsActionmailer
4
+ class Parser
5
+ type t = RBS::Inline::AST::Declarations::ClassDecl | RBS::Inline::AST::Declarations::ModuleDecl
6
+
7
+ # @rbs klass_name: String
8
+ def self.parse: (String klass_name) -> t?
9
+
10
+ # @rbs klass_name: String
11
+ def parse: (String klass_name) -> t?
12
+
13
+ private
14
+
15
+ # @rbs klass_name: String
16
+ def load: (String klass_name) -> Array[RBS::Inline::AST::Declarations::t]?
17
+
18
+ # @rbs decls: Array[RBS::Inline::AST::Declarations::t | RBS::Inline::AST::Members::t]
19
+ # @rbs name: Symbol
20
+ # @rbs *remains: Symbol
21
+ def dig: (Array[RBS::Inline::AST::Declarations::t | RBS::Inline::AST::Members::t] decls, Symbol name, *Symbol remains) -> t?
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # Generated from lib/rbs_actionmailer/rake_task.rb with RBS::Inline
2
+
3
+ module RbsActionmailer
4
+ class RakeTask < Rake::TaskLib
5
+ attr_accessor name: Symbol
6
+
7
+ attr_accessor signature_root_dir: Pathname
8
+
9
+ # @rbs name: Symbol
10
+ # @rbs &block: ?(self) -> void
11
+ def initialize: (?Symbol name) ?{ (self) -> void } -> void
12
+
13
+ def define_setup_task: () -> void
14
+
15
+ def define_clean_task: () -> void
16
+
17
+ def define_generate_task: () -> void
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ # Generated from lib/rbs_actionmailer/version.rb with RBS::Inline
2
+
3
+ module RbsActionmailer
4
+ VERSION: ::String
5
+ end
@@ -0,0 +1,6 @@
1
+ # Generated from lib/rbs_actionmailer.rb with RBS::Inline
2
+
3
+ module RbsActionmailer
4
+ class Error < StandardError
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbs_actionmailer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Takeshi KOMIYA
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionmailer
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: activesupport
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: railties
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
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rbs
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rbs-inline
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: A RBS files generator for ActionMailer
98
+ email:
99
+ - i.tkomiya@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".rubocop.yml"
105
+ - ".vscode/extensions.json"
106
+ - ".vscode/settings.json"
107
+ - CODE_OF_CONDUCT.md
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - Steepfile
112
+ - lib/generators/rbs_actionmailer/install_generator.rb
113
+ - lib/rbs_actionmailer.rb
114
+ - lib/rbs_actionmailer/generator.rb
115
+ - lib/rbs_actionmailer/parser.rb
116
+ - lib/rbs_actionmailer/rake_task.rb
117
+ - lib/rbs_actionmailer/version.rb
118
+ - rbs_collection.lock.yaml
119
+ - rbs_collection.yaml
120
+ - sig/generators/rbs_actionmailer/install_generator.rbs
121
+ - sig/rbs_actionmailer.rbs
122
+ - sig/rbs_actionmailer/generator.rbs
123
+ - sig/rbs_actionmailer/parser.rbs
124
+ - sig/rbs_actionmailer/rake_task.rbs
125
+ - sig/rbs_actionmailer/version.rbs
126
+ homepage: https://github.com/tk0miya/rbs_actionmailer
127
+ licenses:
128
+ - MIT
129
+ metadata:
130
+ homepage_uri: https://github.com/tk0miya/rbs_actionmailer
131
+ source_code_uri: https://github.com/tk0miya/rbs_actionmailer
132
+ changelog_uri: https://github.com/tk0miya/rbs_actionmailer
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 2.7.0
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.5.16
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: A RBS files generator for ActionMailer
152
+ test_files: []