kaze 0.10.0 → 0.11.0
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 +4 -4
- data/README.md +23 -11
- data/lib/kaze/commands/install_command.rb +13 -15
- data/lib/kaze/commands/installs_inertia_stacks.rb +2 -2
- data/lib/kaze/version.rb +1 -1
- data/stubs/default/app/models/concerns/must_verify_email.rb +0 -2
- data/stubs/default/db/migrate/20240101000000_create_users.rb +7 -5
- data/stubs/hotwire/app/components/modal_component.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 801eeb176444975c22103b1c30236940bc4f039cbd78247f0dd953adceb14e2a
|
4
|
+
data.tar.gz: 7a0023977ffddbcdc64c30969fcbfe7f467df905636196433eb39f0adc65dda0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e69b526a0219cb6bad9268ccf6f312fe81a020f6925988eb4eb4d7733f5264bd02167c9b4f13c96daf1dcb0bece48eef41c2fa68a27b80b2b9ad8f917f37d8a
|
7
|
+
data.tar.gz: d683e46426ef76a6356343ade5d5e6026c5a05020daa3fc599e4279e73c31c09d1b18eae029bb9d8324f89fc429c4368beedf1089d273173e74c567ee76a412e
|
data/README.md
CHANGED
@@ -2,29 +2,41 @@
|
|
2
2
|
|
3
3
|
# Kaze
|
4
4
|
|
5
|
-
Heavily inspired by [Laravel Breeze](https://github.com/laravel/breeze), this gem offers authentication and application starter kits to give you a head start building your new Rails application. These kits automatically scaffold your application with the routes, controllers, and views you need to register and authenticate your application's users.
|
5
|
+
Heavily inspired by [Laravel Breeze](https://github.com/laravel/breeze), this gem offers authentication and application starter kits to give you a head start building your new [Rails](https://rubyonrails.org) application. These kits automatically scaffold your application with the routes, controllers, and views you need to register and authenticate your application's users.
|
6
6
|
|
7
|
-
[Kaze](https://github.com/gtkvn/kaze) is a minimal, simple implementation of all
|
7
|
+
[Kaze](https://github.com/gtkvn/kaze) is a opinionated minimal, simple implementation of all authentication features that a modern web application should have, including login, registration, password reset, email verification. In addition, Kaze includes a simple "profile" page where the user may update their name, email address, and password.
|
8
8
|
|
9
9
|
Kaze provides scaffolding options based on [Hotwire](https://hotwired.dev) or [Inertia](https://inertiajs.com), with the choice of using Vue or React for the Inertia-based scaffolding.
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
13
|
-
|
13
|
+
Before creating your first project powered by Kaze, make sure that your local machine has Ruby installed. Ruby can be installed in minutes via [mise](https://mise.jdx.dev).
|
14
14
|
|
15
|
-
|
15
|
+
```
|
16
|
+
mise use -g ruby@3.3
|
17
|
+
```
|
18
|
+
|
19
|
+
After you have installed Ruby, you may install `rails` and `kaze` gems globally:
|
16
20
|
|
17
21
|
```
|
22
|
+
gem install rails
|
18
23
|
gem install kaze
|
19
24
|
```
|
20
25
|
|
21
|
-
|
26
|
+
Then, you may create a new Rails application:
|
27
|
+
|
28
|
+
```
|
29
|
+
rails new kaze-example-app
|
30
|
+
cd kaze-example-app
|
31
|
+
```
|
32
|
+
|
33
|
+
Once the project has been created, you may scaffold your application using one of the Kaze "stacks" discussed in the documentation below.
|
22
34
|
|
23
|
-
## Kaze
|
35
|
+
## Kaze and Hotwire
|
24
36
|
|
25
37
|
The default Kaze "stack" is the Hotwire stack. Hotwire is a powerful way to building dynamic, reactive, front-end UIs primarily using Ruby and ERB templates without using much JavaScript by sending HTML instead of JSON over the wire.
|
26
38
|
|
27
|
-
The Hotwire stack may be installed by invoking the `install` command with no other additional arguments inside your app directory.
|
39
|
+
The Hotwire stack may be installed by invoking the `kaze install` command with no other additional arguments inside your app directory. This command publishes the authentication, views, routes, controllers, and other resources to your application.
|
28
40
|
|
29
41
|
```
|
30
42
|
kaze install
|
@@ -37,13 +49,13 @@ bin/setup
|
|
37
49
|
bin/dev
|
38
50
|
```
|
39
51
|
|
40
|
-
Next, you may navigate to your application's `/login` or `/register` URLs in your web browser.
|
52
|
+
Next, you may navigate to your application's `/login` or `/register` URLs in your web browser. All of Kaze's routes are defined within the `config/routes.rb` file.
|
41
53
|
|
42
|
-
## Kaze
|
54
|
+
## Kaze and React / Vue
|
43
55
|
|
44
56
|
Kaze offers React and Vue scaffolding via an Inertia frontend implementation. Inertia allows you to build modern, single-page React and Vue applications using classic server-side routing and controllers.
|
45
57
|
|
46
|
-
Inertia lets you enjoy the frontend power of React and Vue combined with the incredible backend productivity of Rails and lightning-fast Vite compilation. To use an Inertia stack, specify `react` or `vue` as your desired stack when executing the `install` command
|
58
|
+
Inertia lets you enjoy the frontend power of React and Vue combined with the incredible backend productivity of Rails and lightning-fast Vite compilation. To use an Inertia stack, specify `react` or `vue` as your desired stack when executing the `kaze install` command:
|
47
59
|
|
48
60
|
```
|
49
61
|
kaze install react
|
@@ -60,4 +72,4 @@ bin/setup
|
|
60
72
|
bin/dev
|
61
73
|
```
|
62
74
|
|
63
|
-
Next, you may navigate to your application's `/login` or `/register` URLs in your web browser.
|
75
|
+
Next, you may navigate to your application's `/login` or `/register` URLs in your web browser. All of Kaze's routes are defined within the `config/routes.rb` file.
|
@@ -11,17 +11,11 @@ class Kaze::Commands::InstallCommand < Thor
|
|
11
11
|
def install(stack = 'hotwire')
|
12
12
|
return say 'Kaze must be run in a new Rails application.', :red unless File.exist?("#{Dir.pwd}/bin/rails")
|
13
13
|
|
14
|
-
if stack == 'hotwire'
|
15
|
-
return install_hotwire_stack
|
16
|
-
end
|
14
|
+
return install_hotwire_stack if stack == 'hotwire'
|
17
15
|
|
18
|
-
if stack == 'react'
|
19
|
-
return install_inertia_react_stack
|
20
|
-
end
|
16
|
+
return install_inertia_react_stack if stack == 'react'
|
21
17
|
|
22
|
-
if stack == 'vue'
|
23
|
-
return install_inertia_vue_stack
|
24
|
-
end
|
18
|
+
return install_inertia_vue_stack if stack == 'vue'
|
25
19
|
|
26
20
|
say 'Invalid stack. Supported stacks are [hotwire], [react], [vue].', :red
|
27
21
|
end
|
@@ -53,14 +47,14 @@ class Kaze::Commands::InstallCommand < Thor
|
|
53
47
|
end
|
54
48
|
|
55
49
|
def install_migrations
|
56
|
-
ensure_directory_exists("#{Dir.pwd}/db/migrate")
|
57
|
-
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/db/migrate", "#{Dir.pwd}/db/migrate")
|
58
50
|
stdin, _ = Open3.capture3("#{Dir.pwd}/bin/rails version")
|
59
51
|
versions = stdin.gsub!('Rails ', '').split('.')
|
60
52
|
railsVersion = [ versions[0], versions[1] ].join('.')
|
53
|
+
|
54
|
+
ensure_directory_exists("#{Dir.pwd}/db/migrate")
|
55
|
+
FileUtils.copy_entry("#{File.dirname(__FILE__)}/../../../stubs/default/db/migrate", "#{Dir.pwd}/db/migrate")
|
61
56
|
Dir.children("#{Dir.pwd}/db/migrate").each do |file|
|
62
|
-
|
63
|
-
File.write(path, File.read(path).gsub!(/ActiveRecord::Migration$/, "ActiveRecord::Migration[#{railsVersion}]"))
|
57
|
+
replace_in_file(/ActiveRecord::Migration$/, "ActiveRecord::Migration[#{railsVersion}]", "#{Dir.pwd}/db/migrate/#{file}")
|
64
58
|
end
|
65
59
|
end
|
66
60
|
|
@@ -76,15 +70,19 @@ class Kaze::Commands::InstallCommand < Thor
|
|
76
70
|
FileUtils.mkdir_p(path) unless File.directory?(path)
|
77
71
|
end
|
78
72
|
|
73
|
+
def replace_in_file(search, replace, path)
|
74
|
+
File.write(path, File.read(path).gsub!(search, replace))
|
75
|
+
end
|
76
|
+
|
79
77
|
def run_command(command)
|
80
78
|
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
|
81
79
|
stdout_thread = Thread.new do
|
82
|
-
while
|
80
|
+
while line = stdout.gets do
|
83
81
|
say line
|
84
82
|
end
|
85
83
|
end
|
86
84
|
stderr_thread = Thread.new do
|
87
|
-
while
|
85
|
+
while line = stderr.gets do
|
88
86
|
say line, :red
|
89
87
|
end
|
90
88
|
end
|
@@ -60,7 +60,7 @@ module Kaze::Commands::InstallsInertiaStacks
|
|
60
60
|
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
61
61
|
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/bin/vite", "#{Dir.pwd}/bin/vite")
|
62
62
|
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
63
|
-
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite:
|
63
|
+
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite: bin/vite dev\n")
|
64
64
|
run_command("#{Dir.pwd}/bin/rails generate js_routes:middleware")
|
65
65
|
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
66
66
|
|
@@ -140,7 +140,7 @@ module Kaze::Commands::InstallsInertiaStacks
|
|
140
140
|
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/bin/dev", "#{Dir.pwd}/bin/dev")
|
141
141
|
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/inertia-common/bin/vite", "#{Dir.pwd}/bin/vite")
|
142
142
|
FileUtils.copy_file("#{File.dirname(__FILE__)}/../../../stubs/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
143
|
-
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite:
|
143
|
+
File.write("#{Dir.pwd}/Procfile.dev", "#{File.read("#{Dir.pwd}/Procfile.dev")}\nvite: bin/vite dev\n")
|
144
144
|
run_command("#{Dir.pwd}/bin/rails generate js_routes:middleware")
|
145
145
|
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
|
146
146
|
|
data/lib/kaze/version.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :users do |table|
|
4
|
-
table.string :name
|
5
|
-
table.string :email
|
6
|
-
table.timestamp :email_verified_at
|
7
|
-
table.string :password_digest
|
8
|
-
table.string :remember_token
|
4
|
+
table.string :name, null: false
|
5
|
+
table.string :email, null: false
|
6
|
+
table.timestamp :email_verified_at
|
7
|
+
table.string :password_digest, null: false
|
8
|
+
table.string :remember_token
|
9
|
+
table.integer :current_team_id
|
10
|
+
table.string :profile_photo_path, limit: 2048
|
9
11
|
table.timestamps
|
10
12
|
end
|
11
13
|
end
|
@@ -8,7 +8,7 @@ class ModalComponent < ViewComponent::Base
|
|
8
8
|
lg: 'sm:max-w-lg',
|
9
9
|
xl: 'sm:max-w-xl',
|
10
10
|
'2xl': 'sm:max-w-2xl'
|
11
|
-
}[attributes[:max_width] || '2xl']
|
11
|
+
}[(attributes[:max_width] || '2xl').to_sym]
|
12
12
|
@attributes = attributes.without(:name, :show, :max_width)
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cuong Giang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -260,7 +260,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
260
260
|
requirements:
|
261
261
|
- - ">="
|
262
262
|
- !ruby/object:Gem::Version
|
263
|
-
version:
|
263
|
+
version: 3.1.0
|
264
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
265
|
requirements:
|
266
266
|
- - ">="
|