emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rubocop f493961 03/64: Check for the presence of the ruboc


From: ELPA Syncer
Subject: [nongnu] elpa/rubocop f493961 03/64: Check for the presence of the rubocop binary
Date: Wed, 11 Aug 2021 10:07:53 -0400 (EDT)

branch: elpa/rubocop
commit f493961312bbbf05c6d9319bacf724137a7da3e6
Author: Bozhidar Batsov <bozhidar@tradeo.com>
Commit: Bozhidar Batsov <bozhidar@tradeo.com>

    Check for the presence of the rubocop binary
---
 rubocop.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rubocop.el b/rubocop.el
index 4472b61..1b0fd3d 100644
--- a/rubocop.el
+++ b/rubocop.el
@@ -65,6 +65,7 @@ The current directory is assumed to be the project's root 
otherwise."
 (defun rubocop-run-on-project ()
   "Run on current project."
   (interactive)
+  (rubocop-ensure-installed)
   (compilation-start
    (concat "rubocop -es " (rubocop-project-root))
    'compilation-mode
@@ -73,6 +74,7 @@ The current directory is assumed to be the project's root 
otherwise."
 (defun rubocop-run-on-current-file ()
   "Run on current file."
   (interactive)
+  (rubocop-ensure-installed)
   (let ((file-name (buffer-file-name (current-buffer))))
     (if file-name
         (compilation-start
@@ -81,6 +83,11 @@ The current directory is assumed to be the project's root 
otherwise."
          (lambda (arg) (rubocop-buffer-name file-name)))
       (error "Buffer is not visiting a file"))))
 
+(defun rubocop-ensure-installed ()
+  "Check if RuboCop is installed."
+  (unless (executable-find "rubocop")
+    (error "RuboCop is not installed")))
+
 (provide 'rubocop)
 
 ;;; rubocop.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]