ttscoff / hookapp

MIT License
89 stars 4 forks source link

hook select crashes #7

Closed Hanspe-3019 closed 2 years ago

Hanspe-3019 commented 2 years ago

Running on Intel Core i5:

% hook select https://www.nachdenkseiten.de       
sh: line 2: /Library/Ruby/Gems/2.6.0/gems/hookapp-2.0.8/lib/hook/../helpers/fuzzyfilefinder: Bad CPU type in executable
hookapp-2.0.8/lib/helpers % file fuzzyfilefinder 
fuzzyfilefinder: Mach-O 64-bit executable arm64

Can to provide a universal file?

ttscoff commented 2 years ago

Ah, I ran into this issue with my doing project as well. The solution I came up with was to build the fzf binary at runtime, so I'll need to work that functionality into the hook CLI. In the meantime, if you run brew install fzf and copy the fzf binary to /Library/Ruby/Gems/2.6.0/gems/hookapp-2.0.8/lib/helpers/fuzzyfilefinder (renaming to fuzzyfilefinder) it should allow the command to run for you.

ttscoff commented 2 years ago

Finally got around to updating this with a more robust fzf handler. Please install 2.0.9 (gem install hookapp should get the latest version) and run hook select FILENAME to see if it works for you. If all goes well, it will either find a local version (e.g. /usr/local/bin/fzf) or install a platform-appropriate version inside its own helper directory.

Hanspe-3019 commented 2 years ago

Did install 2.0.9. Got error when executing hook:

/usr/local/bin/hook:23:in `load': cannot load such file -- /Library/Ruby/Gems/2.6.0/gems/hookapp-2.0.9/bin/hook (LoadError)
    from /usr/local/bin/hook:23:in `<main>'

Cause: File mode in hookapp-2.0.9/** not set for group and other. Run sudo chmod +r ...

Now hook-cli seems to work. Because fzf is already in my path, I did not test installation helper for fzf. I inspected the files in hookapp-2.0.9: The directory helpers is missing, so the install should not succeed anyway.

ttscoff commented 2 years ago

I think I've fixed the permissions issues in 2.0.10. I ran into a similar problem with another one of my gems, I think the switch to a new Mac changed some local permissions without me realizing it.

The helpers directory would be at $GEM_PATH/gems/hookapp-2.0.10/lib/helpers, but is only be created if it actually needs to install fzf. If it finds it locally, it should just use your native copy. Does hook select FILENAME work for you now, or still crashing?

-Brett

On 28 May 2022, at 2:03, Hanspe-3019 wrote:

Did install 2.0.9. Got error when executing hook:

/usr/local/bin/hook:23:in `load': cannot load such file -- 
/Library/Ruby/Gems/2.6.0/gems/hookapp-2.0.9/bin/hook (LoadError)
    from /usr/local/bin/hook:23:in `<main>'

Cause: File mode in hookapp-2.0.9/** not set for group and other. Run sudo chmod +r ...

Now hook-cli seems to work. Because fzf is already in my path, I did not test installation helper for fzf. I inspected the files in hookapp-2.0.9: The directory helpers is missing, so the install should not succeed anyway.

-- Reply to this email directly or view it on GitHub: https://github.com/ttscoff/hookapp/issues/7#issuecomment-1140190314 You are receiving this because you commented.

Message ID: @.***>

Hanspe-3019 commented 2 years ago

2.0.10 fixes the permissions issues. hook select FILENAME works using my local fzf (mac ports).