rubyatscale / packs

packs are a specification for an extensible packaging system to help modularize Ruby applications.
MIT License
82 stars 17 forks source link

Proposal: when moving a pack, rename all references #120

Closed professor closed 11 months ago

professor commented 1 year ago

When moving a pack to be inside another pack, the code currently searches and replaces for the pack name change inside files that this tooling controls (all the packs package.yml files).

However, when moving pack, we want all references to the old pack name updated including code references to files in the old pack.

I'm proposing we do something like:

`rg 'packs/#{pack}' -l --hidden | xargs sed -i '' 's,packs/#{old_pack_name},packs/#{new_pack_name},g'`

I realize that not all systems will have ripgrep installed.

tstannard commented 12 months ago

options:

Add per_file_processors (similar to the codeowners one) that would run the find/replace on every file in the pack after move files here

Add line to readme

professor commented 12 months ago

Here's the time output for ripgrep vs grep

time rg 'packs/X' -l --hidden
0.91s user 8.30s system 218% cpu 4.207 total

time ag 'packs/x' .  
1.14s user 7.37s system 178% cpu 4.756 total

time grep -r 'packs/X' .
93.78s user 33.24s system 14% cpu 14:25.44 total