hiiro 0.1.314 → 0.1.316

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: 6fd4ee6b28c10a3203f70a472a4e65bae62c1636f24dceb4a1b21fe48c96c3ff
4
- data.tar.gz: 1ddaded4e27043098e685c7af4445e042119ff2bdee80a47ac25a29d4f05ba2d
3
+ metadata.gz: 2e4ea40a79adf7ef11a6e26db39af44e4f32e41edf12a2e537b96de961b2b0b2
4
+ data.tar.gz: 4b6377307feeff3fa975a1301a56efd54fba59a93a1540c197bbc1254f91c862
5
5
  SHA512:
6
- metadata.gz: 7ff30eb7284958c439bc087bad2e1a74a805c6955a9482d8f4a0b6198f0fc6e35181742537102b7f8d0abeb5fc1ea8bce38a595042a5df2cf1470470a239ee52
7
- data.tar.gz: 68d4ab840a4535a86f99faf26d910cc2fee354b35fd5a2fdcdec22e8fa4bc4b962a9cca0a18c56250076dd28db28102fe76b798621bd5b7084d516314a54182a
6
+ metadata.gz: 898deb3331965a47b97a02e2e3e50039d43578f3e5721dd26816328d8a9cd69bd8b46ccf6b38f2f5914ad90e2233c19bcd6bf1fa7543861828c79791302d4862
7
+ data.tar.gz: eb877f97cd8989252398254a803cd372b203c490d2a52940a8923e3a5dafd23bcd604e98e8c52b013be0be1bb8b3d854b315b2f1e5776f94f8959309a5f82d1d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.316] - 2026-04-01
4
+
5
+ ### Added
6
+ - Parallelize hiiro gem updates across Ruby versions with thread pool for faster multi-version updates
7
+ - Optional `dir:` parameter to `Hiiro::Background.run` for working directory support
8
+
9
+ ### Changed
10
+ - Improve gem version regex pattern in publish script for more reliable version matching
11
+
12
+ ### Fixed
13
+ - Bypass rubygems local cache with `--clear-sources --source https://rubygems.org` flags in `install_gem` to ensure fresh gem installation
14
+ - Add debug output for version polling in publish script
15
+ - Convert `sa` symlink from absolute to relative path
16
+
17
+ ## [0.1.315] - 2026-04-01
18
+
19
+ ### Fixed
20
+ - Remove redundant `exit 0` statement from publish script
21
+
3
22
  ## [0.1.314] - 2026-04-01
4
23
 
5
24
  ### Fixed
data/exe/h CHANGED
@@ -36,15 +36,22 @@ Hiiro.run(*ARGV, cwd: Dir.pwd, tasks: true) do
36
36
  }.parse!(ARGV)
37
37
 
38
38
  if opts.all
39
- Hiiro::Rbenv.versions.each do |ver|
40
- shell_cmd = [
41
- "(RBENV_VERSION=#{ver.shellescape} rbenv exec gem update hiiro #{opts.pre ? '--pre' : ''}",
42
- "|| RBENV_VERSION=#{ver.shellescape} rbenv exec gem install hiiro #{opts.pre ? '--pre' : ''})",
43
- "&& RBENV_VERSION=#{ver.shellescape} rbenv exec h setup",
44
- ].join(' ')
45
- puts "Queuing update for Ruby #{ver}..."
46
- Hiiro::Background.run('sh', '-c', shell_cmd)
39
+ versions = Hiiro::Rbenv.versions
40
+ puts "Updating hiiro across #{versions.size} Ruby version(s)...\n\n"
41
+ mu = Mutex.new
42
+
43
+ threads = versions.map do |ver|
44
+ Thread.new do
45
+ Hiiro::Rbenv.install_gem('hiiro', pre: opts.pre, version: ver)
46
+ Hiiro::Rbenv.run('h', 'setup', version: ver)
47
+ hiiro_ver = Hiiro::Rbenv.capture('gem', 'list', 'hiiro', '--exact', version: ver)
48
+ .match(/hiiro \(([^)]+)\)/)&.[](1) || '?'
49
+ mu.synchronize { puts " ruby #{ver} → hiiro #{hiiro_ver}" }
50
+ end
47
51
  end
52
+
53
+ threads.each(&:join)
54
+ puts "\nDone."
48
55
  else
49
56
  update_hiiro(pre: opts.pre)
50
57
  end
@@ -5,12 +5,17 @@ class Hiiro
5
5
  # Run cmd asynchronously. Inside tmux, spins up a hidden window in the
6
6
  # h-bg session so you can attach and inspect if needed. Outside tmux,
7
7
  # falls back to a detached spawn.
8
- def self.run(*cmd)
8
+ #
9
+ # dir: optional directory to cd into before running the command.
10
+ def self.run(*cmd, dir: nil)
9
11
  if inside_tmux?
10
12
  ensure_session
11
- system('tmux', 'new-window', '-d', '-t', "#{SESSION}:", '-n', cmd.first.to_s, cmd.shelljoin)
13
+ tmux_args = ['tmux', 'new-window', '-d', '-t', "#{SESSION}:", '-n', cmd.first.to_s]
14
+ tmux_args += ['-c', dir] if dir
15
+ system(*tmux_args, cmd.shelljoin)
12
16
  else
13
- Process.detach(spawn(*cmd))
17
+ spawn_opts = dir ? { chdir: dir } : {}
18
+ Process.detach(spawn(*cmd, **spawn_opts))
14
19
  end
15
20
  rescue
16
21
  nil
data/lib/hiiro/rbenv.rb CHANGED
@@ -69,12 +69,14 @@ class Hiiro
69
69
  end
70
70
 
71
71
  # Install or update a gem in the given version.
72
+ # Passes --clear-sources --source rubygems.org to bypass the local index cache.
72
73
  def install_gem(gem_name, version: current_version, pre: false)
73
- pre_flag = pre ? ['--pre'] : []
74
+ source_flags = ['--clear-sources', '--source', 'https://rubygems.org']
75
+ pre_flag = pre ? ['--pre'] : []
74
76
  if gem_installed?(gem_name, version: version)
75
- run('gem', 'update', gem_name, *pre_flag, version: version)
77
+ run('gem', 'update', gem_name, *source_flags, *pre_flag, version: version)
76
78
  else
77
- run('gem', 'install', gem_name, *pre_flag, version: version)
79
+ run('gem', 'install', gem_name, *source_flags, *pre_flag, version: version)
78
80
  end
79
81
  end
80
82
 
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.314"
2
+ VERSION = "0.1.316"
3
3
  end
data/sa ADDED
@@ -0,0 +1 @@
1
+ script/available
data/script/available ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "pry"
6
+
7
+ # ─── RubyGems API ────────────────────────────────────────────────────────────
8
+
9
+ class RubyGems
10
+ def self.published_versions(gem_name)
11
+ uri = URI("https://rubygems.org/api/v1/versions/#{gem_name}.json")
12
+ json_version = JSON.parse(Net::HTTP.get(uri)).map { |v| v["number"] }
13
+ rescue => e
14
+ puts "Warning: could not fetch versions from RubyGems (#{e.message}), falling back to local"
15
+ require "hiiro"
16
+ [Hiiro::VERSION]
17
+ end
18
+
19
+ def self.wait_for(gem_name, version, max_attempts: 40)
20
+ attempts = 0
21
+ loop do
22
+ sleep(attempts == 0 ? 5 : 15)
23
+ attempts += 1
24
+ versions = published_versions(gem_name)
25
+ return true if versions.include?(version)
26
+ puts "Waiting for v#{version} on RubyGems (attempt #{attempts}/#{max_attempts})..."
27
+ return false if attempts >= max_attempts
28
+ end
29
+ rescue => e
30
+ puts "RubyGems poll error: #{e.message}"
31
+ false
32
+ end
33
+ end
34
+
35
+ class HiiroSetup
36
+ def self.latest_version1 = RubyGems.published_versions('hiiro').first
37
+ def self.latest_version2 = `gem search -r hiiro`.lines.map(&:strip).select{|ln| ln.match?(/\d\.\d/) }.first[/\d+\.\d+[^)]+/]
38
+ end
39
+
40
+ json_version = HiiroSetup.latest_version1
41
+ cli_version = HiiroSetup.latest_version2
42
+
43
+ puts
44
+ puts(json_version:,cli_version:)
45
+ puts
46
+
47
+ puts 'done'
48
+
data/script/publish CHANGED
@@ -14,6 +14,7 @@ class RubyGems
14
14
  require "hiiro"
15
15
  [Hiiro::VERSION]
16
16
  end
17
+ def self.cli_version = `gem search -r hiiro`.lines.map(&:strip).select{|ln| ln.match?(/\d\.\d/) }.first&.[](/\d+\.\d+[^)]+/)
17
18
 
18
19
  def self.wait_for(gem_name, version, max_attempts: 40)
19
20
  attempts = 0
@@ -21,7 +22,8 @@ class RubyGems
21
22
  sleep(attempts == 0 ? 5 : 15)
22
23
  attempts += 1
23
24
  versions = published_versions(gem_name)
24
- return true if versions.include?(version)
25
+ puts(latest_json_version: versions.first, cli_version: cli_version)
26
+ return true if versions.include?(version) && cli_version && cli_version == version
25
27
  puts "Waiting for v#{version} on RubyGems (attempt #{attempts}/#{max_attempts})..."
26
28
  return false if attempts >= max_attempts
27
29
  end
@@ -216,7 +218,6 @@ if pending_before
216
218
  end
217
219
 
218
220
  File.write("CHANGELOG.md", release.changelog) if release.changelog && !release.changelog.strip.empty?
219
-
220
221
  File.write("lib/hiiro/version.rb", "class Hiiro\n VERSION = #{new_version.inspect}\nend\n")
221
222
 
222
223
  RubyGem.build(new_version)
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.314
4
+ version: 0.1.316
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -342,6 +342,8 @@ files:
342
342
  - plugins/pins.rb
343
343
  - plugins/project.rb
344
344
  - record-demo.sh
345
+ - sa
346
+ - script/available
345
347
  - script/compare
346
348
  - script/diff
347
349
  - script/diffhome