senren-ui 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99b7430e710e44023cbc886c862b4d237d06bb489a4a00f5e30685b59768f6dc
4
- data.tar.gz: 6ead04eac8e4e518cbf7129c65dfb63ad683db3dfb44b13a794366eee8be37dd
3
+ metadata.gz: 0af2c6143260dc7e068bb79237a99b7e58d6ea0523c7863ab328ff7773d4148e
4
+ data.tar.gz: 31b1bd8c86eb92ba5caf578ed314ebd857aac247b6fb214007a145acfe7dc76f
5
5
  SHA512:
6
- metadata.gz: 7cf42a8f5992b7de9bc4135c7d6bea7c44987ca3844de06b575876957877efd773711cdfcb9cd54d2ddc1ca878f38842d4df082b0fb7451b5b63613c9bb5f056
7
- data.tar.gz: e3c329bc7eb8ef0c7b90af18971c92f24dfdea4822e17a9e43faff3b1e94a6815ed4b6c18cff30a2e65932cd8bf96d88b2e64153671d72e2a52c8ffe2d759c76
6
+ metadata.gz: 292220303c382a0b84f7e59cd4b1c0806f901f3fe4cb27a85d70eaddad304f501c1412e6df19d49bcf5546cf050cdf60937b9f2233d191f660bbb6f0e0f1f3c5
7
+ data.tar.gz: 88efe90a4fac627f9fc103d1c811738f63b03f7413f83040c5d4c7d893188f47587284d89fe249b2c902025f82fb9ba46a53f0dce7fa595eef8b4ba2644cff2d
data/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
  v0.x is a pre-stable line: minor bumps may break things; patch bumps are
8
8
  bug fixes only.
9
9
 
10
+ ## [0.4.1] — 2026-10-08
11
+
12
+ ### Fixed
13
+
14
+ - `bin/rails senren:locales vi`, as the README, `docs/i18n.md` and the install
15
+ generator write it, failed with `Unrecognized command "vi"`: the task was a
16
+ rake task only, so Rails passed `vi` to rake as a second task name, and the
17
+ one spelling that worked was `bin/rails 'senren:locales[vi]'`. It is now a
18
+ Rails command, like `senren:add`, so `bin/rails senren:locales vi`,
19
+ `senren:locales en vi` and `senren:locales vi --force` work as documented.
20
+ - `bin/rails senren:doctor` reported `✗ ViewComponent gem available` and exited
21
+ 1 on a healthy app. It checked only whether the `ViewComponent` constant was
22
+ loaded, and a host's Gemfile lists `senren-ui`, not `view_component`, so
23
+ nothing loads it until the first component renders. The check now also asks
24
+ whether the gem is installed, as the Turbo check already did.
25
+ - `bin/rails senren:add` and `senren:locales` given a name they do not know (or
26
+ `senren:add` given none) printed a Thor backtrace with the useful line at the
27
+ top of it. They now print the message alone and exit 1, as the rake tasks
28
+ always did.
29
+
10
30
  ## [0.4.0] — 2026-10-08
11
31
 
12
32
  ### Added
@@ -22,7 +22,10 @@ module Senren
22
22
  force: options[:force]
23
23
  )
24
24
  rescue ArgumentError => e
25
- raise ::Rails::Command::Base::Error, e.message
25
+ # The message alone, as the rake task prints it. Rails does not rescue
26
+ # an error raised from a command, so raising printed a Thor backtrace
27
+ # with the one line that says what to type buried at the top of it.
28
+ abort e.message
26
29
  end
27
30
 
28
31
  private
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/command'
4
+ require 'senren/rails'
5
+ require 'senren/rails/locale_installer'
6
+
7
+ module Senren
8
+ module Command
9
+ # `bin/rails senren:locales vi` as the docs write it. As a rake task only,
10
+ # Rails handed `vi` to rake as a second task name and failed with
11
+ # `Unrecognized command "vi"`; the only spelling that worked was
12
+ # `bin/rails 'senren:locales[vi]'`. A Rails command receives the words after
13
+ # it as arguments, the same way senren:add does.
14
+ class LocalesCommand < ::Rails::Command::Base
15
+ class_option :force, type: :boolean, default: false,
16
+ desc: 'Replace a locale file that already exists with the shipped one.'
17
+
18
+ desc 'locales LOCALE [LOCALE...]',
19
+ 'Copy shipped Senren translations into config/locales.'
20
+ def perform(*names)
21
+ require_application!
22
+
23
+ locale_installer.install(locales: names.flat_map { |name| name.split(',') }, force: options[:force])
24
+ rescue ArgumentError => e
25
+ # The message alone, as the rake task prints it. Rails does not rescue
26
+ # an error raised from a command, so raising printed a Thor backtrace
27
+ # with the one line that says what to type buried at the top of it.
28
+ abort e.message
29
+ end
30
+
31
+ private
32
+
33
+ def locale_installer
34
+ Senren::Rails::LocaleInstaller.new
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,4 +1,4 @@
1
1
  # This file is the ledger of Senren components installed in this app.
2
- # It is updated by `bin/rails senren:add` and `bin/rails senren:install`.
2
+ # It is updated by `bin/rails senren:add` and `bin/rails generate senren:install`.
3
3
  # Do not edit by hand unless you know what you are doing.
4
4
  installed: []
@@ -50,7 +50,11 @@ module Senren
50
50
 
51
51
  def runtime_checks
52
52
  [
53
- check('ViewComponent gem available') { defined?(::ViewComponent) },
53
+ # Not just defined?(::ViewComponent): a host's Gemfile lists senren-ui,
54
+ # not view_component, so Bundler.require never loads it, and nothing
55
+ # does until BaseComponent is autoloaded on the first render. A healthy
56
+ # app booted for this task failed the check.
57
+ check('ViewComponent gem available') { defined?(::ViewComponent) || gem_loadable?('view_component') },
54
58
  check('TailwindCSS stylesheet present') { paths.stylesheet_path.exist? },
55
59
  check('Stimulus directory present') { paths.stimulus_dir.directory? },
56
60
  check('Turbo gem available') { defined?(::Turbo) || gem_loadable?('turbo-rails') }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Senren
4
4
  module Rails
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: senren-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vutt
@@ -59,6 +59,7 @@ files:
59
59
  - docs/performance_testing.md
60
60
  - docs/visual_style.md
61
61
  - lib/commands/senren/add/add_command.rb
62
+ - lib/commands/senren/locales/locales_command.rb
62
63
  - lib/generators/senren/component/component_generator.rb
63
64
  - lib/generators/senren/component/templates/component.html.erb.tt
64
65
  - lib/generators/senren/component/templates/component.rb.tt