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

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

[nongnu] elpa/inf-ruby b767d52caf 066/265: inf-ruby-console-gem: Pass -r


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby b767d52caf 066/265: inf-ruby-console-gem: Pass -r arguments in the bundle exec case, too
Date: Sat, 9 Jul 2022 21:59:14 -0400 (EDT)

branch: elpa/inf-ruby
commit b767d52cafa8b1883934dc1fb53b7862e52d2105
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    inf-ruby-console-gem: Pass -r arguments in the bundle exec case, too
    
    dgutov/robe#8
---
 inf-ruby.el | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index fbe3510905..e8590fb93d 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -499,24 +499,25 @@ and the directory to run it from."
 The main module should be loaded automatically. If DIR contains a
 Gemfile, it should use the `gemspec' instruction."
   (interactive "D")
-  (let ((default-directory dir))
-    (if (file-exists-p "Gemfile")
-        (run-ruby "bundle exec irb" "gem")
-      (unless (file-exists-p "lib")
-        (error "The directory must contain a 'lib' subdirectory"))
-      (let (files)
-        (dolist (item (directory-files "lib"))
-          (unless (file-directory-p item)
-            (setq files (cons item files))))
-        (run-ruby (concat "irb -I lib"
-                          ;; If there are several files under 'lib'
-                          ;; (unlikely), load them all.
-                          (mapconcat
-                           (lambda (file)
-                             (concat " -r " (file-name-sans-extension file)))
-                           files
-                           ""))
-                  "gem")))))
+  (let* ((default-directory dir)
+         (base-command (if (file-exists-p "Gemfile")
+                           "bundle exec irb"
+                         "irb -I lib"))
+         files)
+    (unless (file-exists-p "lib")
+      (error "The directory must contain a 'lib' subdirectory"))
+    (dolist (item (directory-files "lib"))
+      (unless (file-directory-p item)
+        (setq files (cons item files))))
+    (run-ruby (concat base-command " "
+                      ;; If there are several files under 'lib'
+                      ;; (unlikely), load them all.
+                      (mapconcat
+                       (lambda (file)
+                         (concat " -r " (file-name-sans-extension file)))
+                       files
+                       ""))
+              "gem")))
 
 ;;;###autoload
 (defun inf-ruby-console-default (dir)



reply via email to

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