better_auth-rails 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 752aa9b17208fc8152307184bb45d4e36e910ac73d2fee25bfdab567a2eae552
4
+ data.tar.gz: e5cd67d1e60e41e950beef732238129a840adf596a4d9e70a5e1c44153119bf5
5
+ SHA512:
6
+ metadata.gz: ffe3a3fe1c2f7fdeb761532155dd984c0126008928fa79c3e90177be8289805967cdf0a6c370b8b0aff55af997477f7d81769fec0e752a245e6e4baeb7f07e91
7
+ data.tar.gz: 513fbba0f325cdb0c54c12d790f87018a6bbe7979ade4d91b222fa69ab42c83e2668dd2d0c2a86ed06ea0fe8c67f6042e4b7d30ea20b42a6e07e46367d0f923d
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.2] - 2026-03-22
11
+
12
+ ### Fixed
13
+
14
+ - Fixed gemspec files list to use `Dir.glob` instead of `git ls-files` for better CI compatibility
15
+ - Fixed dependency constraints for railties and activesupport (now `>= 6.0, < 9`)
16
+ - Fixed better_auth_rails compatibility gem dependency version
17
+
18
+ ## [0.1.1] - 2026-03-17
19
+
20
+ ### Added
21
+
22
+ - Initial Rails adapter setup
23
+ - Basic gem structure
24
+
25
+ ## [0.1.0] - 2026-03-17
26
+
27
+ ### Added
28
+
29
+ - Initial project setup
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ The MIT License (MIT)
4
+ Copyright (c) 2024 - present
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # Better Auth Rails
2
+
3
+ Rails adapter for Better Auth Ruby. Provides seamless integration with Ruby on Rails applications including middleware, controller helpers, and generators.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'better_auth-rails'
11
+ ```
12
+
13
+ ### Defensive alias package
14
+
15
+ `better_auth_rails` is published only as a defensive alias package.
16
+
17
+ WARNING: This gem is an alias. Use `better_auth-rails`.
18
+
19
+ And then execute:
20
+
21
+ ```bash
22
+ bundle install
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Basic Setup
28
+
29
+ Add to your `config/application.rb`:
30
+
31
+ ```ruby
32
+ require 'better_auth/rails'
33
+ ```
34
+
35
+ Compatibility require is also supported:
36
+
37
+ ```ruby
38
+ require 'better_auth_rails'
39
+ ```
40
+
41
+ Or in your Gemfile:
42
+
43
+ ```ruby
44
+ gem 'better_auth-rails', require: 'better_auth/rails'
45
+ ```
46
+
47
+ ### Controller Helpers
48
+
49
+ Include the controller helpers in your ApplicationController:
50
+
51
+ ```ruby
52
+ class ApplicationController < ActionController::Base
53
+ include BetterAuth::Rails::ControllerHelpers
54
+ end
55
+ ```
56
+
57
+ Now you have access to authentication methods:
58
+
59
+ ```ruby
60
+ class PostsController < ApplicationController
61
+ before_action :authenticate_user!
62
+
63
+ def index
64
+ @posts = current_user.posts
65
+ end
66
+
67
+ def create
68
+ @post = current_user.posts.build(post_params)
69
+ # ...
70
+ end
71
+ end
72
+ ```
73
+
74
+ ### Available Methods
75
+
76
+ - `current_user` - Returns the currently authenticated user
77
+ - `authenticate_user!` - Redirects to login if not authenticated
78
+ - `user_signed_in?` - Returns true if user is authenticated
79
+ - `sign_in(user)` - Signs in a user
80
+ - `sign_out` - Signs out the current user
81
+
82
+ ### Configuration
83
+
84
+ Create an initializer `config/initializers/better_auth.rb`:
85
+
86
+ ```ruby
87
+ BetterAuth.configure do |config|
88
+ config.secret_key = Rails.application.credentials.secret_key_base
89
+ config.database_url = Rails.application.credentials.database_url
90
+
91
+ # Optional: Configure session store
92
+ config.session_store = :redis
93
+ config.session_options = {
94
+ url: ENV['REDIS_URL']
95
+ }
96
+ end
97
+ ```
98
+
99
+ ### Routes
100
+
101
+ Mount the Better Auth engine in your routes:
102
+
103
+ ```ruby
104
+ Rails.application.routes.draw do
105
+ mount BetterAuth::Rails::Engine => '/auth'
106
+
107
+ # Your routes...
108
+ end
109
+ ```
110
+
111
+ ## Development
112
+
113
+ ### Setup
114
+
115
+ ```bash
116
+ # Clone the monorepo
117
+ git clone --recursive https://github.com/sebasxsala/better-auth.git
118
+ cd better-auth/packages/better_auth-rails
119
+
120
+ # Install dependencies
121
+ bundle install
122
+ ```
123
+
124
+ ### Running Tests
125
+
126
+ ```bash
127
+ # Run all tests
128
+ bundle exec rspec
129
+
130
+ # Run with coverage
131
+ COVERAGE=true bundle exec rspec
132
+
133
+ # Run specific test
134
+ bundle exec rspec spec/better_auth/rails/controller_helpers_spec.rb
135
+ ```
136
+
137
+ ### Code Style
138
+
139
+ We use StandardRB for linting:
140
+
141
+ ```bash
142
+ # Check style
143
+ bundle exec standardrb
144
+
145
+ # Auto-fix issues
146
+ bundle exec standardrb --fix
147
+ ```
148
+
149
+ ## Contributing
150
+
151
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sebasxsala/better-auth.
152
+
153
+ When contributing:
154
+ 1. Fork the repository
155
+ 2. Create your feature branch (`git checkout -b feat/amazing-feature`)
156
+ 3. Make sure tests pass (`bundle exec rspec`)
157
+ 4. Ensure code style passes (`bundle exec standardrb`)
158
+ 5. Commit your changes (`git commit -m 'feat: add amazing feature'`)
159
+ 6. Push to the branch (`git push origin feat/amazing-feature`)
160
+ 7. Open a Pull Request towards the `canary` branch
161
+
162
+ ## License
163
+
164
+ The gem is available as open source under the terms of the MIT License.
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterAuth
4
+ module Rails
5
+ VERSION = "0.1.2"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rails/version"
4
+
5
+ module BetterAuth
6
+ module Rails
7
+ # Rails-specific authentication adapters
8
+ # Provides middleware, controller helpers, and generators
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "better_auth/rails"
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: better_auth-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Sebastian Sala
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: better_auth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '9'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '6.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '9'
47
+ - !ruby/object:Gem::Dependency
48
+ name: activesupport
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '6.0'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '9'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '6.0'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '9'
67
+ - !ruby/object:Gem::Dependency
68
+ name: bundler
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '2.5'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '2.5'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '3.13'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '3.13'
95
+ - !ruby/object:Gem::Dependency
96
+ name: standardrb
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '1.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: rake
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '13.2'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '13.2'
123
+ - !ruby/object:Gem::Dependency
124
+ name: simplecov
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '0.22'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '0.22'
137
+ description: Rails integration for Better Auth Ruby. Provides middleware, controller
138
+ helpers, and generators.
139
+ email:
140
+ - sebastian.sala.tech@gmail.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - CHANGELOG.md
146
+ - LICENSE.md
147
+ - README.md
148
+ - lib/better_auth/rails.rb
149
+ - lib/better_auth/rails/version.rb
150
+ - lib/better_auth_rails.rb
151
+ homepage: https://github.com/sebasxsala/better-auth
152
+ licenses:
153
+ - MIT
154
+ metadata:
155
+ homepage_uri: https://github.com/sebasxsala/better-auth
156
+ source_code_uri: https://github.com/sebasxsala/better-auth
157
+ changelog_uri: https://github.com/sebasxsala/better-auth/blob/main/packages/better_auth-rails/CHANGELOG.md
158
+ bug_tracker_uri: https://github.com/sebasxsala/better-auth/issues
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: 3.2.0
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubygems_version: 3.5.22
175
+ signing_key:
176
+ specification_version: 4
177
+ summary: Rails adapter for Better Auth
178
+ test_files: []