kaze 2.2.0 → 2.2.1
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/CHANGELOG.md +18 -1
- data/README.md +8 -0
- data/lib/kaze/commands/app/base_stack.rb +23 -3
- data/lib/kaze/commands/app/hotwire_stack.rb +1 -2
- data/lib/kaze/commands/app/inertia_react_stack.rb +1 -2
- data/lib/kaze/commands/app/inertia_vue_stack.rb +1 -2
- data/lib/kaze/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab4d236e7d08529caaafe2924edaab3a90cb9742fe5dcf916cb6e188bf453d38
|
|
4
|
+
data.tar.gz: 57eb011f2173bf00a346195b91d0620777f173be7acf22d97b97cf94b803e6bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af68391e4cce4dace60eb32e614b55c6ea4fe3fc6cd52f7a1c3ff614a4e9b2b5c295d31dada55c57f001ddb850f5cdfc4251c337de4176425162532f941343c2
|
|
7
|
+
data.tar.gz: 0611eeedb28e33537e0d09f85dfdbb1010caad5ef3409ca9bd84ee7b1fddf69197343ffa416c2ca003ddd496849e606bdb76632cf0f909d0dd023dd86a9fecf1
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.2.1] - 2026-10-27
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- The install now says what to do next: `Run bin/rails db:prepare to apply the migrations Kaze installed.` A new application reaches its migrations through `bin/setup`, but an upgrade has no such step, so 2.2.0 handed existing applications the two factor settings page and login challenge while their database still had none of the columns behind them. The `## Upgrading` section of the README says it too.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- `kaze install` and `kaze upgrade` no longer empty files. `replace_in_file` wrote the result of `String#gsub!` back to disk, and the bang form returns `nil` when it matched nothing — so `File.write` truncated the file to nothing. Every call site passes a pattern that can legitimately be absent, either because an earlier install already applied it or because the application edited it out, and each of those was a file silently destroyed. It is `gsub` now, which returns the string unchanged when it matches nothing.
|
|
18
|
+
|
|
19
|
+
Two files were reachable this way. An application's own migrations were emptied on the **first** upgrade: the rewrite that stamps the Rails version into Kaze's migrations walked the whole of `db/migrate`, and the pattern it uses only fits the ones Kaze ships, since a generated migration already carries its `[8.1]` suffix. `rails db:migrate` did not complain, because the version was already recorded and Rails never read the file again — the loss surfaced later, as `NameError: uninitialized constant` on a rollback, or as a schema that could no longer be rebuilt from its migrations. This dates from 2024-07-01 and has been in every release since; it took an application with a migration of its own to show, which is why neither the test suite nor the 1.4.0 upgrade test caught it. The rewrite is now scoped to the files Kaze copied.
|
|
20
|
+
|
|
21
|
+
`config/environments/test.rb` was emptied on the **second** upgrade, and on any upgrade of an application already on 2.2.0. `enable_test_cache_store` rewrites `:null_store` to `:memory_store`, so a second run found nothing to match and truncated the file; the suite then came apart with 15 failures and 31 errors. That one was introduced in 2.2.0, a few hours before this fix.
|
|
22
|
+
|
|
23
|
+
- `install_migrations` no longer crashes if `bin/rails version` prints something unexpected, for the same reason: it called `gsub!` on the output and then `split` on the result.
|
|
24
|
+
|
|
9
25
|
## [2.2.0] - 2026-10-27
|
|
10
26
|
|
|
11
27
|
### Added
|
|
@@ -261,7 +277,8 @@ Together these take a freshly scaffolded Inertia application from seven npm advi
|
|
|
261
277
|
|
|
262
278
|
Releases before 1.0.0 are not catalogued here. See the [tags](https://github.com/cuonggt/kaze/tags) for their history.
|
|
263
279
|
|
|
264
|
-
[Unreleased]: https://github.com/cuonggt/kaze/compare/v2.2.
|
|
280
|
+
[Unreleased]: https://github.com/cuonggt/kaze/compare/v2.2.1...HEAD
|
|
281
|
+
[2.2.1]: https://github.com/cuonggt/kaze/compare/v2.2.0...v2.2.1
|
|
265
282
|
[2.2.0]: https://github.com/cuonggt/kaze/compare/v2.1.1...v2.2.0
|
|
266
283
|
[2.1.1]: https://github.com/cuonggt/kaze/compare/v2.1.0...v2.1.1
|
|
267
284
|
[2.1.0]: https://github.com/cuonggt/kaze/compare/v2.0.1...v2.1.0
|
data/README.md
CHANGED
|
@@ -126,4 +126,12 @@ kaze upgrade react
|
|
|
126
126
|
|
|
127
127
|
It lists the files an earlier Kaze installed that this version no longer ships, waits for you to agree, removes them, and then runs the normal install. Only files Kaze itself shipped are ever listed — anything you added alongside them is untouched, and a directory is removed only once it is empty. Pass `--dry-run` to see the list and stop, or `--force` to skip the prompt in a script.
|
|
128
128
|
|
|
129
|
+
An upgrade can bring migrations with it, so run them afterwards:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
bin/rails db:prepare
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Upgrading to 2.2 in particular adds the columns two factor authentication needs. Until they are applied, the settings page and the login challenge are reading columns the database does not have.
|
|
136
|
+
|
|
129
137
|
Upgrading from 1.x to 2.x matters on the React stack in particular: `tsc` typechecks every file under `app/javascript`, so the old `Pages/Profile/Edit.tsx` fails the build until it is gone.
|
|
@@ -74,12 +74,17 @@ class Kaze::Commands::App::BaseStack
|
|
|
74
74
|
|
|
75
75
|
def install_migrations
|
|
76
76
|
stdin, _ = Open3.capture3("#{Dir.pwd}/bin/rails version")
|
|
77
|
-
versions = stdin.gsub
|
|
77
|
+
versions = stdin.gsub('Rails ', '').split('.')
|
|
78
78
|
railsVersion = [ versions[0], versions[1] ].join('.')
|
|
79
79
|
|
|
80
80
|
ensure_directory_exists("#{Dir.pwd}/db/migrate")
|
|
81
|
+
|
|
82
|
+
# Only the migrations Kaze ships get the version written into them. The
|
|
83
|
+
# application's own already carry one, and are none of our business.
|
|
84
|
+
migrations = Dir.children("#{stubs_path}/default/db/migrate")
|
|
85
|
+
|
|
81
86
|
FileUtils.copy_entry("#{stubs_path}/default/db/migrate", "#{Dir.pwd}/db/migrate")
|
|
82
|
-
|
|
87
|
+
migrations.each { |file| replace_in_file(/ActiveRecord::Migration$/, "ActiveRecord::Migration[#{railsVersion}]", "#{Dir.pwd}/db/migrate/#{file}") }
|
|
83
88
|
end
|
|
84
89
|
|
|
85
90
|
# Rate limiting counts attempts in the cache, and a generated application uses
|
|
@@ -108,8 +113,23 @@ class Kaze::Commands::App::BaseStack
|
|
|
108
113
|
FileUtils.mkdir_p(path) unless File.directory?(path)
|
|
109
114
|
end
|
|
110
115
|
|
|
116
|
+
# Kaze ships migrations, and an install that adds one leaves the application
|
|
117
|
+
# holding code for columns the database does not have yet. A new application
|
|
118
|
+
# reaches them through `bin/setup`, but an upgrade of an existing one has no
|
|
119
|
+
# such step, so say it here where the person is already looking.
|
|
120
|
+
def say_installed_successfully
|
|
121
|
+
say ''
|
|
122
|
+
say 'Kaze scaffolding installed successfully.', :green
|
|
123
|
+
say ''
|
|
124
|
+
say 'Run `bin/rails db:prepare` to apply the migrations Kaze installed.', :yellow
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# NOTE: `gsub`, not `gsub!`. The bang form returns nil when it matched
|
|
128
|
+
# nothing, and writing that back truncates the file to nothing -- so a
|
|
129
|
+
# pattern that had already been applied, or that an application had edited
|
|
130
|
+
# out, silently emptied the file instead of leaving it alone.
|
|
111
131
|
def replace_in_file(search, replace, path)
|
|
112
|
-
File.write(path, File.read(path).gsub
|
|
132
|
+
File.write(path, File.read(path).gsub(search, replace))
|
|
113
133
|
end
|
|
114
134
|
|
|
115
135
|
def run_command(command)
|
|
@@ -79,8 +79,7 @@ class Kaze::Commands::App::HotwireStack < Kaze::Commands::App::BaseStack
|
|
|
79
79
|
FileUtils.copy_file("#{stubs_path}/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
|
|
80
80
|
return unless run_command("#{Dir.pwd}/bin/rails tailwindcss:build").success?
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
say 'Kaze scaffolding installed successfully.', :green
|
|
82
|
+
say_installed_successfully
|
|
84
83
|
|
|
85
84
|
true
|
|
86
85
|
end
|
|
@@ -108,8 +108,7 @@ class Kaze::Commands::App::InertiaReactStack < Kaze::Commands::App::BaseStack
|
|
|
108
108
|
|
|
109
109
|
return unless node_dependencies_installed
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
say 'Kaze scaffolding installed successfully.', :green
|
|
111
|
+
say_installed_successfully
|
|
113
112
|
|
|
114
113
|
true
|
|
115
114
|
end
|
|
@@ -109,8 +109,7 @@ class Kaze::Commands::App::InertiaVueStack < Kaze::Commands::App::BaseStack
|
|
|
109
109
|
|
|
110
110
|
return unless node_dependencies_installed
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
say 'Kaze scaffolding installed successfully.', :green
|
|
112
|
+
say_installed_successfully
|
|
114
113
|
|
|
115
114
|
true
|
|
116
115
|
end
|
data/lib/kaze/version.rb
CHANGED