chrisbarrett / skeletor.el

Powerful project skeletons for Emacs
GNU General Public License v3.0
126 stars 17 forks source link

Creating a ruby project hangs #45

Closed mohkale closed 3 years ago

mohkale commented 3 years ago

I'm not sure whether this package is still actively maintained or not, regardless I've found the skeleton expansion for the builtin ruby project hangs indefinitely once you call bundle gem <project-name>.

Here's the transcript.

Creating gem 'mohkale'...
Do you want to generate tests with your gem?
Type 'rspec' or 'minitest' to generate those test files now and in the future. rspec/minitest/(none):

It seems to be because bundle expects you to specify a testing framework, either through the command line or interactively, but skeletor doesn't seem to be able to handle interactive input while running.

Reproduction Instructions

  1. Run emacs -q
  2. Copy the following to your scratch buffer and cance
    
    (require 'cl-lib)

(let ((archives '(("melpa" "https://melpa.org/packages/") ("gnu" "http://elpa.gnu.org/packages/")))) (setq package-archives (cl-loop for (name source) in archives collect (cons name source))) )


3. Run `M-x package-refresh-contents` `M-x package-install skeletor`.
4. Run `M-x skeletor-create-project` and choose the ruby project skeleton

## Fixes
The nicest suggestion would be simply removing the read-only restriction from the skeletor buffer and sending any input to it straight to any active subprocess. Barring that adjusting the definition of the ruby skeleton to supply a testing framework will also work.
chrisbarrett commented 3 years ago

Thanks for the report! This project isn't actively maintained (I don't need to use it anymore so I the initial period of furious yak shaving is over). But I'd be happy to review any PRs that improve it or fix bugs, especially as integration with language-specific tooling bit-rots.

mohkale commented 3 years ago

@chrisbarrett

I redefined the template like so because the gem executable now takes care of a lot of the stuff it used to do manually. Would you like a PR?

(skeletor-define-constructor "Ruby Gem"                                                       
  :requires-executables '(("bundle" . "http://bundler.io"))                                   
  :no-license? t                                                                              
  :no-license? t                                                                              
  :initialise                                                                                 
  (lambda (spec)                                                                                   
    (let-alist spec                                                                           
      (let ((flags (list                                                                      
                    "--no-coc" ;; code of conduct                                             
                    (concat "--test=" (shell-quote-argument                                   
                                       (funcall skeletor-completing-read-function             
                                                "Testing framework: " '("minitest" "rspec"))))
                    (concat "--" (unless (yes-or-no-p "Apply an MIT License") "no-") "mit"))))
        (skeletor-shell-command (format "bundle gem %s %s"                                    
                                        (string-truncate-right!                               
                                         (cl-loop for f in flags concat f concat " "))        
                                        (shell-quote-argument .project-name))                 
                                .project-dir)))))