hiiro 0.1.316 → 0.1.317

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: 2e4ea40a79adf7ef11a6e26db39af44e4f32e41edf12a2e537b96de961b2b0b2
4
- data.tar.gz: 4b6377307feeff3fa975a1301a56efd54fba59a93a1540c197bbc1254f91c862
3
+ metadata.gz: 40fb2f5a3860a728d6f9a39ae41a6444caac0c04234d8e1a77ca2358eada9918
4
+ data.tar.gz: 3d794ed032025dd96e062ca2c3cdfed49bc2bf036a19f120f7c32364048dc7b5
5
5
  SHA512:
6
- metadata.gz: 898deb3331965a47b97a02e2e3e50039d43578f3e5721dd26816328d8a9cd69bd8b46ccf6b38f2f5914ad90e2233c19bcd6bf1fa7543861828c79791302d4862
7
- data.tar.gz: eb877f97cd8989252398254a803cd372b203c490d2a52940a8923e3a5dafd23bcd604e98e8c52b013be0be1bb8b3d854b315b2f1e5776f94f8959309a5f82d1d
6
+ metadata.gz: a440caaacfcdeb5d39bca4ebb3b584766eb33a7e59df02ba7285107501654c931a26ed02590b9f1102e153112c8731f44f0d4e8d6fb5cc46cb49e6ce952e57c0
7
+ data.tar.gz: e62b2ca724d4584f5b6e8962daf4de24fdd7b303c535fd7f4e1cc4ca5fdbe2aba61a203b7f80c70edcda205e87626396990a6565594fcc0e25202437235e9237
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.317] - 2026-04-01
4
+
5
+ ### Changed
6
+ - Parallelize gem installation across all rbenv Ruby versions using thread pool for faster multi-version deployment
7
+ - Refactor publish script to install/update hiiro gem across all Ruby versions instead of just current version
8
+
9
+ ### Fixed
10
+ - Handle both gem install and update cases based on existing installation state
11
+ - Run `h setup` after installation in each Ruby version to initialize version-specific configuration
12
+ - Suppress gem installation output to reduce log noise during parallel installs
13
+
3
14
  ## [0.1.316] - 2026-04-01
4
15
 
5
16
  ### Added
data/bin/h-registry ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hiiro'
4
+ require 'hiiro/registry'
5
+
6
+ Hiiro.run(*ARGV, tasks: true) do
7
+
8
+ # h registry ls [type]
9
+ add_subcmd(:ls, :list) do |type = nil|
10
+ entries = type ? Hiiro::RegistryEntry.of_type(type) : Hiiro::RegistryEntry.all_ordered
11
+ if entries.empty?
12
+ puts type ? "No entries for type '#{type}'." : "Registry is empty."
13
+ next
14
+ end
15
+
16
+ current_type = nil
17
+ entries.each do |e|
18
+ if e.resource_type != current_type
19
+ current_type = e.resource_type
20
+ puts "\n#{current_type}"
21
+ puts '─' * 40
22
+ end
23
+ alias_col = e.short_name ? "[#{e.short_name}]".ljust(18) : ' ' * 18
24
+ desc_col = e.description ? " # #{e.description}" : ''
25
+ puts " #{alias_col} #{e.name}#{desc_col}"
26
+ end
27
+ puts
28
+ end
29
+
30
+ # h registry types
31
+ add_subcmd(:types) do
32
+ types = Hiiro::RegistryEntry.known_types
33
+ puts types.empty? ? "No types registered yet." : types.join("\n")
34
+ end
35
+
36
+ # h registry add <type> <name> [--alias <short>] [--desc <description>]
37
+ add_subcmd(:add) do |type, name, *rest|
38
+ unless type && name
39
+ puts "Usage: h registry add <type> <name> [--alias <short>] [--desc <text>]"
40
+ next
41
+ end
42
+ opts = Hiiro::Options.setup {
43
+ option(:alias, short: :a, desc: 'Short alias')
44
+ option(:desc, short: :d, desc: 'Description')
45
+ }.parse(rest)
46
+
47
+ existing = Hiiro::RegistryEntry.find_by_ref(name, type: type)
48
+ if existing
49
+ puts "Already registered: #{existing.display}"
50
+ next
51
+ end
52
+
53
+ entry = Hiiro::RegistryEntry.create(
54
+ resource_type: type,
55
+ name: name,
56
+ short_name: opts.alias,
57
+ description: opts.desc,
58
+ created_at: Time.now.iso8601
59
+ )
60
+ puts "Added:\n#{entry.display}"
61
+ end
62
+
63
+ # h registry rm <name_or_alias> [type]
64
+ add_subcmd(:rm, :remove) do |ref, type = nil|
65
+ unless ref
66
+ puts "Usage: h registry rm <name_or_alias> [type]"
67
+ next
68
+ end
69
+ entry = Hiiro::RegistryEntry.find_by_ref(ref, type: type ? type.to_s : nil)
70
+ unless entry
71
+ puts "Not found: #{ref}#{type ? " (type: #{type})" : ''}"
72
+ next
73
+ end
74
+ puts "Removing: #{entry.display}"
75
+ entry.destroy
76
+ puts "Done."
77
+ end
78
+
79
+ # h registry get <name_or_alias> [type] — prints canonical name (scriptable)
80
+ add_subcmd(:get) do |ref, type = nil|
81
+ unless ref
82
+ puts "Usage: h registry get <name_or_alias> [type]"
83
+ next
84
+ end
85
+ entry = Hiiro::RegistryEntry.find_by_ref(ref, type: type ? type.to_s : nil)
86
+ entry ? puts(entry.name) : exit(1)
87
+ end
88
+
89
+ # h registry show <name_or_alias> [type] — human-readable detail
90
+ add_subcmd(:show) do |ref, type = nil|
91
+ unless ref
92
+ puts "Usage: h registry show <name_or_alias> [type]"
93
+ next
94
+ end
95
+ entry = Hiiro::RegistryEntry.find_by_ref(ref, type: type ? type.to_s : nil)
96
+ entry ? puts(entry.display) : (puts "Not found: #{ref}"; exit 1)
97
+ end
98
+
99
+ # h registry select [type] — fuzzyfinder, prints canonical name
100
+ add_subcmd(:select) do |type = nil|
101
+ lines = Hiiro::RegistryEntry.fuzzy_lines(type: type)
102
+ if lines.empty?
103
+ puts type ? "No entries for type '#{type}'." : "Registry is empty."
104
+ next
105
+ end
106
+ chosen = fuzzyfind(lines)
107
+ next unless chosen
108
+ # Extract name from "type short name # desc" — name is the 3rd word
109
+ name = chosen.strip.split(/\s{2,}/)[2]
110
+ puts name
111
+ end
112
+
113
+ # h registry set-alias <name_or_alias> <new_alias> [type]
114
+ add_subcmd(:'set-alias') do |ref, new_alias, type = nil|
115
+ unless ref && new_alias
116
+ puts "Usage: h registry set-alias <name_or_alias> <new_alias> [type]"
117
+ next
118
+ end
119
+ entry = Hiiro::RegistryEntry.find_by_ref(ref, type: type ? type.to_s : nil)
120
+ unless entry
121
+ puts "Not found: #{ref}"
122
+ next
123
+ end
124
+ entry.update(short_name: new_alias)
125
+ puts entry.display
126
+ end
127
+
128
+ end
@@ -0,0 +1,66 @@
1
+ require 'sequel'
2
+
3
+ class Hiiro
4
+ class RegistryEntry < Sequel::Model(:registry_entries)
5
+ Hiiro::DB.register(self)
6
+
7
+ def self.create_table!(db)
8
+ db.create_table?(:registry_entries) do
9
+ primary_key :id
10
+ String :resource_type, null: false # e.g. "service", "queue", "worker"
11
+ String :name, null: false # canonical identifier
12
+ String :short_name # alias / shorthand
13
+ String :description
14
+ String :meta_json # arbitrary JSON for extra fields
15
+ String :created_at
16
+ unique [:resource_type, :name]
17
+ unique [:resource_type, :short_name], where: Sequel[short_name: nil].~
18
+ end
19
+ end
20
+
21
+ # ── Finders ──────────────────────────────────────────────────────────────
22
+
23
+ def self.of_type(type) = where(resource_type: type.to_s).order(:name).all
24
+ def self.all_ordered = order(:resource_type, :name).all
25
+ def self.known_types = distinct.select_map(:resource_type).sort
26
+
27
+ # Resolve by exact name or short_name within a type (or globally).
28
+ def self.find_by_ref(ref, type: nil)
29
+ scope = type ? where(resource_type: type.to_s) : self
30
+ scope.where(name: ref).first || scope.where(short_name: ref).first
31
+ end
32
+
33
+ # Fuzzy-finder display lines: "type short name description"
34
+ def self.fuzzy_lines(type: nil)
35
+ entries = type ? of_type(type) : all_ordered
36
+ entries.map(&:fuzzy_line)
37
+ end
38
+
39
+ # ── Instance helpers ─────────────────────────────────────────────────────
40
+
41
+ def meta
42
+ return {} unless meta_json
43
+ Hiiro::DB::JSON.load(meta_json) || {}
44
+ rescue
45
+ {}
46
+ end
47
+
48
+ def meta=(h)
49
+ self.meta_json = Hiiro::DB::JSON.dump(h)
50
+ end
51
+
52
+ def fuzzy_line
53
+ parts = [resource_type.ljust(14), short_name&.ljust(16) || ' ' * 16, name]
54
+ parts << " # #{description}" if description && !description.empty?
55
+ parts.join(' ').strip
56
+ end
57
+
58
+ def display
59
+ lines = ["#{resource_type} / #{name}"]
60
+ lines << " alias: #{short_name}" if short_name
61
+ lines << " desc: #{description}" if description
62
+ meta.each { |k, v| lines << " #{k}: #{v}" } unless meta.empty?
63
+ lines.join("\n")
64
+ end
65
+ end
66
+ end
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.316"
2
+ VERSION = "0.1.317"
3
3
  end
data/script/publish CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "net/http"
4
4
  require "json"
5
+ require "open3"
6
+ require "shellwords"
5
7
 
6
8
  # ─── RubyGems API ────────────────────────────────────────────────────────────
7
9
 
@@ -231,11 +233,36 @@ Git.tag(new_version)
231
233
  Git.push
232
234
 
233
235
  puts "\nWaiting for v#{new_version} to appear on RubyGems..."
234
- if RubyGems.wait_for("hiiro", new_version)
235
- puts "v#{new_version} available — running h update -a"
236
- update_args = ["update", "-a"]
237
- update_args << "--pre" if pre_release
238
- system("h", *update_args)
239
- else
236
+ unless RubyGems.wait_for("hiiro", new_version)
240
237
  puts "WARNING: timed out waiting for v#{new_version} on RubyGems — run `h update -a` manually"
238
+ exit 1
241
239
  end
240
+
241
+ puts "v#{new_version} available — installing across all Ruby versions...\n\n"
242
+ source_flags = ["--clear-sources", "--source", "https://rubygems.org"]
243
+ pre_flag = pre_release ? ["--pre"] : []
244
+ mu = Mutex.new
245
+
246
+ rbenv_versions = `rbenv versions --bare`.lines(chomp: true)
247
+ threads = rbenv_versions.map do |ver|
248
+ Thread.new do
249
+ env = { "RBENV_VERSION" => ver }
250
+
251
+ # update or install
252
+ installed = !`RBENV_VERSION=#{ver.shellescape} rbenv exec gem list hiiro --exact 2>/dev/null`.strip.empty?
253
+ cmd = installed ? ["gem", "update", "hiiro", *source_flags, *pre_flag]
254
+ : ["gem", "install", "hiiro", *source_flags, *pre_flag]
255
+ system(env, "rbenv", "exec", *cmd, out: File::NULL, err: File::NULL)
256
+
257
+ # run setup for the new version
258
+ system(env, "rbenv", "exec", "h", "setup", out: File::NULL, err: File::NULL)
259
+
260
+ # report installed version
261
+ hiiro_ver = `RBENV_VERSION=#{ver.shellescape} rbenv exec gem list hiiro --exact 2>/dev/null`
262
+ .match(/hiiro \(([^)]+)\)/)&.[](1) || "?"
263
+ mu.synchronize { puts " ruby #{ver} → hiiro #{hiiro_ver}" }
264
+ end
265
+ end
266
+
267
+ threads.each(&:join)
268
+ puts "\nDone."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.316
4
+ version: 0.1.317
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -146,6 +146,7 @@ files:
146
146
  - bin/h-pr
147
147
  - bin/h-pr-monitor
148
148
  - bin/h-project
149
+ - bin/h-registry
149
150
  - bin/h-session
150
151
  - bin/h-sha
151
152
  - bin/h-sparse
@@ -317,6 +318,7 @@ files:
317
318
  - lib/hiiro/projects.rb
318
319
  - lib/hiiro/queue.rb
319
320
  - lib/hiiro/rbenv.rb
321
+ - lib/hiiro/registry.rb
320
322
  - lib/hiiro/reminder.rb
321
323
  - lib/hiiro/runner_tool.rb
322
324
  - lib/hiiro/service_manager.rb