Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow bundler-audit to switch directory to ruby project path #39

Open
dstull opened this issue Feb 18, 2019 · 0 comments
Open

allow bundler-audit to switch directory to ruby project path #39

dstull opened this issue Feb 18, 2019 · 0 comments

Comments

@dstull
Copy link

dstull commented Feb 18, 2019

currently when running bundler-audit, it must be ran inside the directory where .bundle directory and the Gemfile.lock file exists - see this issue for enhancement on that package: rubysec/bundler-audit#178 and code which is currently unreachable in that gem from the command line where it is set on the PWD: https://github.com/rubysec/bundler-audit/blob/master/lib/bundler/audit/scanner.rb#L42

until this is resolved, I need the ability to run this check and not assume the current working directory has the .bundle and Gemfile.lock

see this run from one directory above www (where the Gemfile.lock exists)

12:27 $ pre-commit run bundler-audit --all-files --verbose
[bundler-audit] Patch-level verification for bundler.......................Failed
hookid: bundler-audit

args: --update

Updating ruby-advisory-db ...
From https://github.com/rubysec/ruby-advisory-db
 * branch            master     -> FETCH_HEAD
Already up to date.
Updated ruby-advisory-db
ruby-advisory-db: 331 advisories
/Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-audit-0.6.0/lib/bundler/audit/scanner.rb:43:in `read': No such file or directory @ rb_sysopen - /Users/dstull/rails/configbuilder/Gemfile.lock (Errno::ENOENT)
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-audit-0.6.0/lib/bundler/audit/scanner.rb:43:in `initialize'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-audit-0.6.0/lib/bundler/audit/cli.rb:41:in `new'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-audit-0.6.0/lib/bundler/audit/cli.rb:41:in `check'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	from /Users/dstull/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-audit-0.6.0/bin/bundle-audit:10:in `<top (required)>'
	from /Users/dstull/.rbenv/versions/2.3.1/bin/bundle-audit:23:in `load'
	from /Users/dstull/.rbenv/versions/2.3.1/bin/bundle-audit:23:in `<main>'

it would be nice if the run here accepted an argument that would be the directory that those files exist in, change directory, run check, then come back to original directory after the hook has ran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant