ruby-shell 3.6.10 → 3.6.11

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rsh +15 -26
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76a48b3b13e6a1eb7fed0d68be6934d03182b8a176960d81b3c680367cd1d72e
4
- data.tar.gz: 4491a5c43703b4ad519df7e51ec3804a80bd9e6f45c84e8c53745453ec695b94
3
+ metadata.gz: bc237db0d5ce57180ac174417e467c0c56514acb38e2513734ae0461bab02a42
4
+ data.tar.gz: 601a94aa508e4b36060533b81039b33dcf69bdee82fdb4d9d38ac3b3cc857c44
5
5
  SHA512:
6
- metadata.gz: 9b502692bbb3d9471e24c97f8475c117381795ed431f002744a7774e98161ab2e9721e86e303c4e70e3b4685dbc07df30dd875bba8b178d180097a5a58ffedb0
7
- data.tar.gz: 14c7824dcfcb688d3f63fbbe7fa621c06f3d41e7a9680376315c018ab4198defa22b47c74ef0644bcf046326bd4610502c7ef3ace49f05a5a8258f2c4af6d3ea
6
+ metadata.gz: 108f628485a2a6d62902e68e6ead540c870b08ac2670d3beeacf1f176ea18b5a1ccee5eab5c4a9f7e59c18f5bf5a76862e73a88971dab10f8b08f4f5614a01cf
7
+ data.tar.gz: 73c30f2461c7c45055485998756e7dc350b175f426a84eda6bd6d9d59f318b8f173357eea02d786778ebe5ab0de41de6ebf168494427fa26fd36f3b58cdbaf37
data/bin/rsh CHANGED
@@ -8,7 +8,7 @@
8
8
  # Web_site: http://isene.com/
9
9
  # Github: https://github.com/isene/rsh
10
10
  # License: Public domain
11
- @version = "3.6.10" # OSC 7: Report cwd to terminal (for wezterm etc.)
11
+ @version = "3.6.11" # Fix auto-heal destroying .rshrc on load errors
12
12
 
13
13
  # MODULES, CLASSES AND EXTENSIONS
14
14
  class String # Add coloring to strings (with escaping for Readline)
@@ -1495,6 +1495,7 @@ def cmd_check(str) # Check if each element on the readline matches commands, nic
1495
1495
  end
1496
1496
  end
1497
1497
  def rshrc # Write user configuration to .rshrc (portable between machines)
1498
+ return if @rshrc_load_failed # Never overwrite .rshrc if we couldn't parse it
1498
1499
  hist_clean # Clean history before saving
1499
1500
  if File.exist?(Dir.home+'/.rshrc')
1500
1501
  conf = File.read(Dir.home+'/.rshrc')
@@ -3349,13 +3350,15 @@ def load_rshrc_safe
3349
3350
  load_defaults
3350
3351
  end
3351
3352
  else
3352
- puts "\033[31mAuto-heal failed. Loading with defaults.\033[0m"
3353
+ puts "\033[31mAuto-heal failed. Loading with defaults (your .rshrc is preserved).\033[0m"
3354
+ @rshrc_load_failed = true
3353
3355
  load_defaults
3354
3356
  end
3355
3357
 
3356
3358
  rescue => e
3357
3359
  puts "\n\033[31mERROR loading .rshrc: #{e.message}\033[0m"
3358
- puts "\033[33mLoading with defaults...\033[0m\n"
3360
+ puts "\033[33mLoading with defaults (your .rshrc is preserved)...\033[0m\n"
3361
+ @rshrc_load_failed = true
3359
3362
  load_defaults
3360
3363
  end
3361
3364
  end
@@ -3399,31 +3402,17 @@ def auto_heal_rshrc
3399
3402
  end
3400
3403
 
3401
3404
  # Validate Ruby syntax of the healed content
3405
+ # Only check syntax - never strip unknown lines, as user configs
3406
+ # may contain ENV settings, if/else blocks, method calls, etc.
3402
3407
  begin
3403
- # Try to parse the content
3404
- eval("BEGIN {return true}\n" + content)
3408
+ RubyVM::InstructionSequence.compile(content)
3405
3409
  rescue SyntaxError => e
3406
- # If still has syntax errors, extract only valid parts
3407
- new_content = ""
3408
-
3409
- # Extract valid variable assignments
3410
- content.each_line do |line|
3411
- if line =~ /^(@\w+|\w+)\s*=\s*.+$/
3412
- begin
3413
- eval(line)
3414
- new_content += line
3415
- rescue
3416
- # Skip invalid lines
3417
- end
3418
- elsif line =~ /^(def|class|module|end|if|else|elsif|when|case|begin|rescue)/
3419
- new_content += line
3420
- elsif line.strip.start_with?('#') || line.strip.empty?
3421
- new_content += line
3422
- end
3423
- end
3424
-
3425
- content = new_content
3426
- healed = true
3410
+ # Log the error but do NOT destructively rewrite the file.
3411
+ # Stripping "invalid" lines destroys legitimate config like
3412
+ # ENV assignments, prompt logic, and File.read() calls.
3413
+ puts "Warning: .rshrc has syntax error: #{e.message}"
3414
+ puts "Please fix manually. Your config was NOT modified."
3415
+ return false
3427
3416
  end
3428
3417
 
3429
3418
  if healed && content != original_content
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.10
4
+ version: 3.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-18 00:00:00.000000000 Z
11
+ date: 2026-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'A shell written in Ruby with extensive tab completions, aliases/nicks,
14
14
  history, syntax highlighting, theming, auto-cd, auto-opening files and more. UPDATE
15
- v3.6.10: OSC 7 support - reports cwd to terminal for wezterm/kitty spawn-in-same-dir.'
15
+ v3.6.11: Fix auto-heal destroying .rshrc - never strip user config on load errors.'
16
16
  email: g@isene.com
17
17
  executables:
18
18
  - rsh