braintree / runbook

A framework for gradual system automation
MIT License
734 stars 43 forks source link

runbook project generator fails graceless on invalid gem names #12

Closed fwolfst closed 5 years ago

fwolfst commented 5 years ago

When providing a project name that cannot be used as gem name (e.g. starting with numbers), the project generator will print an error but continue to request user input, until it finally fails

runbook generate project 7l
         run  bundle gem 7l --test rspec --no-coc --no-mit from "."
Creating gem '7l'...
Invalid gem name 7l Please give a name which does not start with numbers.
      remove  7l/7l.gemspec
      remove  7l/README.md
      remove  7l/Gemfile
      remove  7l/lib/7l.rb
      remove  7l/lib/7l/version.rb
Where should shared runbook code live?
Use `lib/7l` for runbook-only projects
Use `lib/7l/runbook` for projects used for non-runbook tasks
Shared runbook code path: lib/7l/runbook
      create  7l/README.md
      create  7l/Gemfile
      create  7l/lib/7l.rb
Traceback (most recent call last):
# ...
 1: from /home/void/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:272:in `gsub_file'
/home/void/rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:272:in `binread': No such file or directory @ rb_sysopen - /home/void/projects/7l/other/tasks/7l/Rakefile (Errno::ENOENT)

User experience would be improved, if the program fails (statuscode != 0) directly when gem creation fails.

pblesi commented 5 years ago

Thanks for the callout @fwolfst.

I've added the following fixes:

These changes will be included in the next release.