rbs_devise 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: '08dd691a8f038f811f0fa85d1e99a38a4be3729d60df0dc78cd7455aec78ece2'
4
+ data.tar.gz: fa226445dcf0f97cde9598499b17bef02509bb77c0bb3780aa71a834d069bee6
5
+ SHA512:
6
+ metadata.gz: 40198fea0e5ec6605ef1e4d95aab2a55cda76988dea498a6f589791ac061da9f14790730beba28727be82655223bc50c7f195f5234a1094ee038bfe10fa8bb30
7
+ data.tar.gz: 7b9e361dd480bd18d0c29c6540d67822279448fcd3510a040bb159384c25d9641a43164fecfbbeba1145d235c1153e4fde659e95d4fcfb45c35f93689f670647
data/.rubocop.yml ADDED
@@ -0,0 +1,23 @@
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/BlockLength:
16
+ Exclude:
17
+ - 'spec/**/*_spec.rb'
18
+
19
+ Layout/LineLength:
20
+ Max: 120
21
+
22
+ Layout/MethodLength:
23
+ 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,47 @@
1
+ # rbs_devise
2
+
3
+ rbs_devise is a RBS generator for [devise](https://github.com/heartcombo/devise).
4
+
5
+ ## Installation
6
+
7
+ Add a new entry to your Gemfile and run `bundle install`:
8
+
9
+ group :development do
10
+ gem 'rbs_devise', require: false
11
+ end
12
+
13
+ After the installation, please run rake task generator:
14
+
15
+ bundle exec rails g rbs_devise:install
16
+
17
+ ## Usage
18
+
19
+ Run `rbs:devise:setup` task:
20
+
21
+ bundle exec rake rbs:devise:setup
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. You can also
26
+ run `bin/console` for an interactive prompt that will allow you to experiment.
27
+
28
+ To install this gem onto your local machine, run `bundle exec rake install`.
29
+
30
+ To release a new version, update the version number in `version.rb`, and then put
31
+ a git tag (ex. `git tag v1.0.0`) and push it to the GitHub. Then GitHub Actions
32
+ will release a new package to [rubygems.org](https://rubygems.org) automatically.
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tk0miya/rbs_devise.
37
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are
38
+ expected to adhere to the [code of conduct](https://github.com/tk0miya/rbs_devise/blob/main/CODE_OF_CONDUCT.md).
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
43
+
44
+ ## Code of Conduct
45
+
46
+ Everyone interacting in the RbsDevise project's codebases, issue trackers is expected to
47
+ follow the [code of conduct](https://github.com/tk0miya/rbs_devise/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,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+
5
+ module RbsDevise
6
+ class InstallGenerator < ::Rails::Generators::Base
7
+ def create_raketask
8
+ create_file "lib/tasks/rbs_devise.rake", <<~RUBY
9
+ begin
10
+ require "rbs_devise/rake_task"
11
+ RbsDevise::RakeTask.new
12
+ rescue LoadError
13
+ # failed to load rbs_devise. Skip to load rbs_devise tasks.
14
+ end
15
+ RUBY
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "devise"
4
+ require "rbs"
5
+ require "rbs_rails"
6
+
7
+ module RbsDevise
8
+ module Devise
9
+ def self.available?
10
+ ::Devise.mappings.any?
11
+ end
12
+
13
+ def self.generate
14
+ raise unless available?
15
+
16
+ Generator.new.generate
17
+ end
18
+
19
+ class Generator
20
+ def generate
21
+ RbsRails::Util.format_rbs klass_decl
22
+ end
23
+
24
+ private
25
+
26
+ def klass_decl
27
+ <<~RBS
28
+ module Devise
29
+ #{devise_controllers_signinout_decl}
30
+ #{device_helpers_decl}
31
+ #{devise_sessions_controller_decl}
32
+ end
33
+
34
+ #{devise_controller_decl}
35
+ #{actioncontroller_base_decl}
36
+ RBS
37
+ end
38
+
39
+ def devise_controllers_signinout_decl
40
+ resource_type = resource_classes.join(" | ")
41
+ <<~RBS
42
+ module Controllers
43
+ module SignInOut
44
+ def signed_in?: (#{resource_type} | nil scope) -> bool
45
+ def sign_in: (Symbol scope) -> void
46
+ | (#{resource_type} resource, **untyped options) -> void
47
+ def bypass_sign_in: (#{resource_type} resource, ?scope: Symbol?) -> void
48
+ def sign_out: (Symbol scope) -> bool
49
+ | (#{resource_type} resource) -> bool
50
+ def sign_out_all_scopes: (?bool lock) -> bool
51
+ end
52
+ end
53
+ RBS
54
+ end
55
+
56
+ def device_helpers_decl
57
+ <<~RBS
58
+ module Helpers
59
+ include Devise::Controllers::SignInOut
60
+
61
+ #{device_helpers_methods}
62
+ end
63
+ RBS
64
+ end
65
+
66
+ def device_helpers_methods
67
+ resource_classes.map do |klass_name|
68
+ resource = klass_name.underscore
69
+ <<~RBS.strip
70
+ def authenticate_#{resource}!: (?Hash[untyped, untyped] opts) -> void
71
+ def #{resource}_signed_in?: () -> bool
72
+ def current_#{resource}: () -> #{klass_name}
73
+ def #{resource}_session: () -> untyped
74
+ RBS
75
+ end.join("\n")
76
+ end
77
+
78
+ def devise_sessions_controller_decl
79
+ <<~RBS
80
+ class SessionsController < DeviseController
81
+ def sign_in_params: () -> Hash[untyped, untyped]
82
+ end
83
+ RBS
84
+ end
85
+
86
+ def devise_controller_decl
87
+ <<~RBS
88
+ class DeviseController < #{parent_controller}
89
+ def find_message: (String | Symbol kind, ?Hash[untyped, untyped] options) -> String
90
+ def navigational_formats: () -> Array[Mime::Type]
91
+ def resource: () -> #{resource_classes.join(" | ")}
92
+ def resource=: #{resource_classes.map { |klass| "(#{klass}) -> #{klass}" }.join(" | ")}
93
+ def resource_class: () -> #{resource_classes.map { |klass| "singleton(#{klass})" }.join(" | ")}
94
+ def resource_name: () -> Symbol
95
+ end
96
+ RBS
97
+ end
98
+
99
+ def actioncontroller_base_decl
100
+ <<~RBS
101
+ class ActionController::Base
102
+ include Devise::Helpers
103
+ end
104
+ RBS
105
+ end
106
+
107
+ def parent_controller
108
+ ::Devise.parent_controller
109
+ end
110
+
111
+ def resource_classes
112
+ ::Devise.mappings.keys.map(&:to_s).map(&:camelcase)
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/tasklib"
4
+
5
+ module RbsDevise
6
+ class RakeTask < Rake::TaskLib
7
+ attr_accessor :name, :signature_root_dir
8
+
9
+ def initialize(name = :"rbs:devise", &block)
10
+ super()
11
+
12
+ @name = name
13
+ @signature_root_dir = Rails.root / "sig/devise"
14
+
15
+ block&.call(self)
16
+
17
+ define_generate_task
18
+ define_setup_task
19
+ end
20
+
21
+ def define_setup_task
22
+ desc "Run all tasks of rbs_devise"
23
+
24
+ deps = [:"#{name}:generate"]
25
+ task("#{name}:setup" => deps)
26
+ end
27
+
28
+ def define_generate_task
29
+ desc "Generate a RBS file for Devise"
30
+ task("#{name}:generate": :environment) do
31
+ require "rbs_devise" # load RbsDevise lazily
32
+
33
+ next unless RbsDevise::Devise.available?
34
+
35
+ signature_root_dir.mkpath
36
+ (signature_root_dir / "devise.rbs").write RbsDevise::Devise.generate
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RbsDevise
4
+ VERSION = "0.1.0"
5
+ end
data/lib/rbs_devise.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rbs_devise/devise"
4
+ require_relative "rbs_devise/version"
5
+
6
+ module RbsDevise
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,238 @@
1
+ ---
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
6
+ remote: https://github.com/ruby/gem_rbs_collection.git
7
+ repo_dir: gems
8
+ path: ".gem_rbs_collection"
9
+ gems:
10
+ - name: actionmailer
11
+ version: '7.0'
12
+ source:
13
+ type: git
14
+ name: ruby/gem_rbs_collection
15
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
16
+ remote: https://github.com/ruby/gem_rbs_collection.git
17
+ repo_dir: gems
18
+ - name: actionpack
19
+ version: '6.0'
20
+ source:
21
+ type: git
22
+ name: ruby/gem_rbs_collection
23
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
24
+ remote: https://github.com/ruby/gem_rbs_collection.git
25
+ repo_dir: gems
26
+ - name: actionview
27
+ version: '6.0'
28
+ source:
29
+ type: git
30
+ name: ruby/gem_rbs_collection
31
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
32
+ remote: https://github.com/ruby/gem_rbs_collection.git
33
+ repo_dir: gems
34
+ - name: activejob
35
+ version: '6.0'
36
+ source:
37
+ type: git
38
+ name: ruby/gem_rbs_collection
39
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
40
+ remote: https://github.com/ruby/gem_rbs_collection.git
41
+ repo_dir: gems
42
+ - name: activemodel
43
+ version: '7.0'
44
+ source:
45
+ type: git
46
+ name: ruby/gem_rbs_collection
47
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
48
+ remote: https://github.com/ruby/gem_rbs_collection.git
49
+ repo_dir: gems
50
+ - name: activerecord
51
+ version: '7.0'
52
+ source:
53
+ type: git
54
+ name: ruby/gem_rbs_collection
55
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
56
+ remote: https://github.com/ruby/gem_rbs_collection.git
57
+ repo_dir: gems
58
+ - name: activestorage
59
+ version: '6.1'
60
+ source:
61
+ type: git
62
+ name: ruby/gem_rbs_collection
63
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
64
+ remote: https://github.com/ruby/gem_rbs_collection.git
65
+ repo_dir: gems
66
+ - name: activesupport
67
+ version: '7.0'
68
+ source:
69
+ type: git
70
+ name: ruby/gem_rbs_collection
71
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
72
+ remote: https://github.com/ruby/gem_rbs_collection.git
73
+ repo_dir: gems
74
+ - name: ast
75
+ version: '2.4'
76
+ source:
77
+ type: git
78
+ name: ruby/gem_rbs_collection
79
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
80
+ remote: https://github.com/ruby/gem_rbs_collection.git
81
+ repo_dir: gems
82
+ - name: base64
83
+ version: '0'
84
+ source:
85
+ type: stdlib
86
+ - name: bcrypt
87
+ version: '3.1'
88
+ source:
89
+ type: git
90
+ name: ruby/gem_rbs_collection
91
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
92
+ remote: https://github.com/ruby/gem_rbs_collection.git
93
+ repo_dir: gems
94
+ - name: cgi
95
+ version: '0'
96
+ source:
97
+ type: stdlib
98
+ - name: concurrent-ruby
99
+ version: '1.1'
100
+ source:
101
+ type: git
102
+ name: ruby/gem_rbs_collection
103
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
104
+ remote: https://github.com/ruby/gem_rbs_collection.git
105
+ repo_dir: gems
106
+ - name: date
107
+ version: '0'
108
+ source:
109
+ type: stdlib
110
+ - name: globalid
111
+ version: '1.1'
112
+ source:
113
+ type: git
114
+ name: ruby/gem_rbs_collection
115
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
116
+ remote: https://github.com/ruby/gem_rbs_collection.git
117
+ repo_dir: gems
118
+ - name: i18n
119
+ version: '1.10'
120
+ source:
121
+ type: git
122
+ name: ruby/gem_rbs_collection
123
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
124
+ remote: https://github.com/ruby/gem_rbs_collection.git
125
+ repo_dir: gems
126
+ - name: json
127
+ version: '0'
128
+ source:
129
+ type: stdlib
130
+ - name: logger
131
+ version: '0'
132
+ source:
133
+ type: stdlib
134
+ - name: mail
135
+ version: '2.8'
136
+ source:
137
+ type: git
138
+ name: ruby/gem_rbs_collection
139
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
140
+ remote: https://github.com/ruby/gem_rbs_collection.git
141
+ repo_dir: gems
142
+ - name: minitest
143
+ version: '0'
144
+ source:
145
+ type: stdlib
146
+ - name: monitor
147
+ version: '0'
148
+ source:
149
+ type: stdlib
150
+ - name: mutex_m
151
+ version: '0'
152
+ source:
153
+ type: stdlib
154
+ - name: nokogiri
155
+ version: '1.11'
156
+ source:
157
+ type: git
158
+ name: ruby/gem_rbs_collection
159
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
160
+ remote: https://github.com/ruby/gem_rbs_collection.git
161
+ repo_dir: gems
162
+ - name: openssl
163
+ version: '0'
164
+ source:
165
+ type: stdlib
166
+ - name: parallel
167
+ version: '1.20'
168
+ source:
169
+ type: git
170
+ name: ruby/gem_rbs_collection
171
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
172
+ remote: https://github.com/ruby/gem_rbs_collection.git
173
+ repo_dir: gems
174
+ - name: rack
175
+ version: '2.2'
176
+ source:
177
+ type: git
178
+ name: ruby/gem_rbs_collection
179
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
180
+ remote: https://github.com/ruby/gem_rbs_collection.git
181
+ repo_dir: gems
182
+ - name: rails-dom-testing
183
+ version: '2.0'
184
+ source:
185
+ type: git
186
+ name: ruby/gem_rbs_collection
187
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
188
+ remote: https://github.com/ruby/gem_rbs_collection.git
189
+ repo_dir: gems
190
+ - name: railties
191
+ version: '6.0'
192
+ source:
193
+ type: git
194
+ name: ruby/gem_rbs_collection
195
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
196
+ remote: https://github.com/ruby/gem_rbs_collection.git
197
+ repo_dir: gems
198
+ - name: rainbow
199
+ version: '3.0'
200
+ source:
201
+ type: git
202
+ name: ruby/gem_rbs_collection
203
+ revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
204
+ remote: https://github.com/ruby/gem_rbs_collection.git
205
+ repo_dir: gems
206
+ - name: securerandom
207
+ version: '0'
208
+ source:
209
+ type: stdlib
210
+ - name: singleton
211
+ version: '0'
212
+ source:
213
+ type: stdlib
214
+ - name: socket
215
+ version: '0'
216
+ source:
217
+ type: stdlib
218
+ - name: tempfile
219
+ version: '0'
220
+ source:
221
+ type: stdlib
222
+ - name: time
223
+ version: '0'
224
+ source:
225
+ type: stdlib
226
+ - name: timeout
227
+ version: '0'
228
+ source:
229
+ type: stdlib
230
+ - name: tsort
231
+ version: '0'
232
+ source:
233
+ type: stdlib
234
+ - name: uri
235
+ version: '0'
236
+ source:
237
+ type: stdlib
238
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,18 @@
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
+ # Skip loading rbs gem's RBS.
18
+ # It's unnecessary if you don't use rbs as a library.
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rbs_devise/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rbs_devise"
7
+ spec.version = RbsDevise::VERSION
8
+ spec.authors = ["Takeshi KOMIYA"]
9
+ spec.email = ["i.tkomiya@gmail.com"]
10
+
11
+ spec.summary = "A RBS files generator for discard gem"
12
+ spec.description = "A RBS files generator for discard gem"
13
+ spec.homepage = "https://github.com/tk0miya/rbs_devise"
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 "devise"
32
+ spec.add_dependency "rails"
33
+ spec.add_dependency "rbs_rails"
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,43 @@
1
+ module Devise
2
+ class SessionsController < DeviseController
3
+ def sign_in_params: () -> Hash[untyped, untyped]
4
+ end
5
+ end
6
+
7
+ class DeviseController < ApplicationController # Devise.parent_controller で差し替え可能
8
+ def find_message: (String | Symbol kind, ?Hash[untyped, untyped] options) -> String
9
+ def navigational_formats: () -> Array[Mime::Type]
10
+ def resource: () -> Staff
11
+ def resource=: (Staff) -> Staff
12
+ def resource_class: () -> singleton(Staff)
13
+ def resource_name: () -> Symbol
14
+ end
15
+
16
+ module Devise
17
+ module Controllers
18
+ module SignInOut
19
+ def signed_in?: (?Symbol scope) -> bool
20
+ def sign_in: (Symbol scope) -> void
21
+ | (Staff resource, **untyped options) -> void
22
+ def bypass_sign_in: (Staff resource, ?scope: Symbol?) -> void
23
+ def sign_out: (Symbol scope) -> bool
24
+ | (Staff resource) -> bool
25
+ def sign_out_all_scopes: (?bool lock) -> bool
26
+ end
27
+ end
28
+ end
29
+
30
+ module Devise
31
+ module Helpers
32
+ include Devise::Controllers::SignInOut
33
+
34
+ def authenticate_staff!: (?Hash[untyped, untyped] opts) -> void
35
+ def staff_signed_in?: () -> bool
36
+ def current_staff: () -> Staff
37
+ def staff_session: () -> untyped
38
+ end
39
+ end
40
+
41
+ class ActionController::Base
42
+ include Devise::Helpers
43
+ end
@@ -0,0 +1,5 @@
1
+ module RbsDevise
2
+ class InstallGenerator < ::Rails::Generators::Base
3
+ def create_raketask: () -> void
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ module RbsDevise
2
+ module Devise
3
+ def self.available?: () -> bool
4
+ def self.generate: () -> String
5
+
6
+ class Generator
7
+ def generate: () -> String
8
+
9
+ private
10
+
11
+ def klass_decl: () -> String
12
+ def sessions_controller_decl: () -> String
13
+ def devise_controllers_signinout_decl: () -> String
14
+ def device_helpers_decl: () -> String
15
+ def device_helpers_methods: () -> String
16
+ def devise_controller_decl: () -> String
17
+ def actioncontroller_base_decl: () -> String
18
+ def parent_controller: () -> String
19
+ def resource_classes: () -> Array[String]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,10 @@
1
+ module RbsDevise
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_generate_task: () -> void
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module RbsDevise
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_devise
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-08-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: devise
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: rails
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: rbs_rails
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 discard 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_devise/install_generator.rb
71
+ - lib/rbs_devise.rb
72
+ - lib/rbs_devise/devise.rb
73
+ - lib/rbs_devise/rake_task.rb
74
+ - lib/rbs_devise/version.rb
75
+ - rbs_collection.lock.yaml
76
+ - rbs_collection.yaml
77
+ - rbs_devise.gemspec
78
+ - sessions_controller.rbs
79
+ - sig/generators/rbs_devise/install_generator.rbs
80
+ - sig/rbs_devise.rbs
81
+ - sig/rbs_devise/devise.rbs
82
+ - sig/rbs_devise/rake_task.rbs
83
+ - sig/shims/rake.rbs
84
+ homepage: https://github.com/tk0miya/rbs_devise
85
+ licenses:
86
+ - MIT
87
+ metadata:
88
+ homepage_uri: https://github.com/tk0miya/rbs_devise
89
+ source_code_uri: https://github.com/tk0miya/rbs_devise
90
+ changelog_uri: https://github.com/tk0miya/rbs_devise
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 discard gem
110
+ test_files: []