Make bundler optional

For some projects I don't have bundler as part of the Gemfile but run it
as an external tool. With this kind of setup it would be nice to be able
to opt out of `bundle exec` even if you have a Gemfile and are using
bundler for the rest of the project.
This commit is contained in:
Terje Larsen
2018-10-09 18:22:26 +02:00
parent 43ffa9d9c3
commit efeae0c046

View File

@@ -58,6 +58,11 @@
:type 'string
:group 'rubocopfmt)
(defcustom rubocopfmt-use-bundler-when-possible t
"When t and Gemfile is present, run rubocop with 'bundle exec'."
:type 'boolean
:group 'rubocopfmt)
(defcustom rubocopfmt-disabled-cops
'("Lint/Debugger" ; Don't remove debugger calls.
"Lint/UnusedBlockArgument" ; Don't rename unused block arguments.
@@ -237,7 +242,8 @@ If FILE is not found in DIRECTORY, the parent of DIRECTORY will be searched."
"--auto-correct"
"--format" "emacs")))
(if (rubocopfmt--bundled-path-p src-dir)
(if (and rubocopfmt-use-bundler-when-possible
(rubocopfmt--bundled-path-p src-dir))
(setq fmt-command "bundle"
fmt-args (append (list "exec" rubocopfmt-rubocop-command)
fmt-args)))