Repository navigation
Take in Path, ruby and command calling from ProUtils - #3
Merged
Merged
Conversation
Path is a Pathname that keeps to its shell's mode, so the paths a shell gives out no longer ignore noop and trace. Shell#ruby runs the present Ruby, Shell#cmd runs any method called on it as a command, and the optional Commands module does the same on the shell itself for programs found on the PATH. The core extensions take ProUtils' later versions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On Ruby 3.1 a child process can print a warning about duplicate default gems, which is nothing to do with what is tested. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was worth keeping from ProUtils (a 2014 reworking of Ratch's utilities, being retired), fitted to Ratch's per-shell modes instead of ProUtils' global variables.
Ratch::Path
A Pathname that keeps to its shell's mode.
Shell#path,#file,#dir,#work,#parent,#homeand#rootnow return one.Before this,
shell.path('tmp').rmtreedeleted the directory even in a dry run, because the shell handed out plain Pathnames. Now the writing methods (mkpath,rmtree,rename,chmod,write,deleteand so on) do nothing in noop mode and are reported when tracing. Paths derived from one (+,parent,children, ...) keep the same shell. A Path is still equal to the Pathname of the same path. Files opened for writing withopenare not covered.Commands
Shell#rubyruns a command with the present Ruby.Shell#cmdruns any method called on it as a command:shell.cmd.git 'status'. Several arguments are passed as they are, a final Hash becomes options, and a single String is a command line.Ratch::Commandsis the optional form of the same on the shell itself:shell.git 'status'. A shell has it with the:commandsoption (--commandsfor theratchcommand) or by including the module. Only a program found on the PATH is taken as a command, so a misspelt method is still a NoMethodError.Smaller things
ratchcommand takes options before the script's name as well as after.Array#to_listdrops nils;Object#to_yamlfraghandles tagged documents and the end mark;FileTest.bin?no longer raises without a PATH.🤖 Generated with Claude Code