Commit graph

47 commits

Author SHA1 Message Date
4f4e97475b
[ruby] Modernize Ruby shell parsing and expansion, add C compat test mode (#4)
Replace Ruby's old wordexp-like command splitting with a tokenizer and
parser that understands ; and && while honoring quotes and nesting.

Implement richer expansions for command substitution, arithmetic,
parameter defaults (${var:-...}), brace expansion, and escaped
dollar/backtick behavior via shared quote-state handling.

Expand the test suite with parser/expansion edge cases, escaping
parity checks, builtin usage validation, and job-control refresh tests.

Keep C green by adding a compat test profile for c/Makefile test and
by returning nonzero on builtin failures in -c mode, including clearer
`bg` usage output.
2026-02-07 15:18:41 -08:00
79ba26c76b
Ditch wordexp and modify Shellwords code to make it work 2026-01-02 15:47:09 -08:00
bec3f4a1f3
Add guard gem 2026-01-02 14:50:38 -08:00
f261ce9cb8
Add tests for more wordexp features 2026-01-02 14:36:31 -08:00
2aa05219e2
Add a readme 2026-01-02 13:37:40 -08:00
3ab4f4c3f1
Simplify GitHub Actions workflow (#3) 2026-01-02 13:31:21 -08:00
0e19e57734
Merge pull request #2 from samsonjs/ruby-4
Update to Ruby 4 and add GitHub workflow
2026-01-02 13:14:51 -08:00
f63dcf4375
Run C tests too 2026-01-02 13:14:04 -08:00
2f4b5d904d
Fix tests on Ubuntu on GitHub Actions 2026-01-02 13:09:17 -08:00
7cb5697809
Make ruby -w shebang portable 2026-01-02 12:55:33 -08:00
5774ea89fb
Add GitHub workflow to run ruby tests 2026-01-02 12:53:42 -08:00
f9e7dfe144
Add x86_64-linux to Gemfile.lock platforms 2026-01-02 12:52:27 -08:00
f72ddf7f32
Update to Ruby 4, update gems, s/rubocop/standard/ 2026-01-02 12:40:38 -08:00
71a7c7d6ed
Update to wordexp 0.2.2 2026-01-02 12:39:52 -08:00
03fc5c512f Update to Ruby 3.2.2 and wordexp 0.2.0 2023-10-05 14:48:38 -07:00
996feaf62c
Update gems and add .ruby-version 2023-02-13 23:26:44 -08:00
1072088493
Add a bootstrap make target 2022-01-22 18:04:02 -08:00
91bda119f9
Add a way to run tests in all languages 2022-01-22 17:59:45 -08:00
6cf858fbfc
[c] Make tests pass and get rid of queue_message 2022-01-22 17:08:13 -08:00
32a4f6b894
[c] Make wordexp fail on undefined variables 2022-01-22 16:29:37 -08:00
cd864989ce
[c] Remove debugging output 2022-01-22 16:28:54 -08:00
62b2bd19e2
[c] Add support for -c <command> for testing 2022-01-22 16:27:41 -08:00
5a9cf1a0ab
[c] Format code 2022-01-22 16:08:32 -08:00
94ca5e6024
[ruby] Require the command argument after -c 2022-01-22 15:42:03 -08:00
c01e3a5fe6
Add a rake clean task 2022-01-22 15:37:04 -08:00
f16bd5f814
Allow overriding test executable with env var A1_PATH 2022-01-22 15:35:58 -08:00
b4a1f28a11
Fix tests and add rake task 2022-01-21 20:26:05 -08:00
58f1e48cd2
[ruby] Implement clear and actually use builtin pwd instead of /bin/pwd 2022-01-21 17:43:04 -08:00
5bb03eb2a2
[ruby] Implement bglist and bgkill 2022-01-21 17:39:52 -08:00
e7b73fa309 Add a few tests 2022-01-17 21:30:37 -08:00
9f0eb1378b Extract remaining code from main.rb 2022-01-17 21:30:30 -08:00
ec8baa2e1c Fix colour methods and use them 2022-01-17 19:17:42 -08:00
34150d64cb Extract job control to a separate class 2022-01-17 18:54:52 -08:00
97c597d628
Make ECHILD a verbose log instead, since it's not broken 2022-01-17 00:52:11 -08:00
ae89630e69
Add rubocop 2022-01-17 00:44:50 -08:00
ba8bf8088f
Use fork and exec and implement bg builtin 2022-01-17 00:42:19 -08:00
0d0bb73114
Use wordexp to support super fancy expansions
- Expands environment variables, e.g. $HOME -> /home/tina

- Expands tildes, e.g. ~/bin -> /home/queso/bin

- Performs command substitution, e.g. `date +%F` -> 2022-01-16
                                  or $(date +%F) -> 2022-01-16
2022-01-16 23:11:40 -08:00
9faa33fbf2
Perform proper shell word splitting and improve logging 2022-01-16 16:31:45 -08:00
01b0983f79
Use readline for proper editing and history 2022-01-16 15:05:54 -08:00
69f1639128
Fix executing built-in commands 2022-01-16 15:04:10 -08:00
88339bdf37
Move C implementation into its own subdirectory 2022-01-16 15:03:44 -08:00
6e0b36fd21
Move built-ins to a separate class 2022-01-16 14:55:58 -08:00
b141d95b44 Add ruby/a1 entry point script 2022-01-16 14:55:23 -08:00
635f345017 Start working on a Ruby port 2022-01-16 14:08:01 -08:00
fe3e6cc099 Make dependency-dir work with sh 2022-01-16 00:27:04 -08:00
421f3f981e Improve portability of Makefile 2022-01-16 00:24:26 -08:00
7f95910a9c First commit 2022-01-16 00:00:02 -08:00