Crash when generating projects with `-`
Jcambass opened this issue · comments
Generating a project with a -
in its name crashes the project generation.
It seems this happens since we're looking for the file my-project/spec/my-project_spec.rb
but generated the file my-project/spec/my/project_spec.rb
.
› runbook generate project my-project
run bundle gem my-project --test rspec --ci github --rubocop --no-changelog --no-coc --no-mit from "."
Creating gem 'my-project'...
rspec is already configured, ignoring --test flag.
github is already configured, ignoring --ci flag.
RuboCop enabled in config
Initializing git repo in /Users/jcambass/my-project
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
create my-project/Gemfile
create my-project/lib/my/project.rb
create my-project/lib/my/project/version.rb
create my-project/sig/my/project.rbs
create my-project/my-project.gemspec
create my-project/Rakefile
create my-project/README.md
create my-project/bin/console
create my-project/bin/setup
create my-project/.gitignore
create my-project/.rspec
create my-project/spec/spec_helper.rb
create my-project/spec/my/project_spec.rb
create my-project/.github/workflows/main.yml
create my-project/.rubocop.yml
Gem 'my-project' was successfully created. For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html
remove my-project/my-project.gemspec
remove my-project/README.md
remove my-project/Gemfile
remove my-project/lib/my-project.rb
remove my-project/lib/my-project/version.rb
Where should shared runbook code live?
jectslib/my-project` for runbook-only pro
Use `lib/my-project/runbook` for projects used for non-runbook tasks
d runbook code path: lib/my-project
create my-project/README.md
create my-project/Gemfile
create my-project/lib/my-project.rb
create my-project/.ruby-version
create my-project/.ruby-gemset
create my-project/Runbookfile
create my-project/runbooks
create my-project/lib/runbook/extensions
create my-project/lib/runbook/generators
create my-project/lib/my-project
Traceback (most recent call last):
23: from /Users/jcambass/.asdf/installs/ruby/2.7.6/bin/runbook:23:in `<main>'
22: from /Users/jcambass/.asdf/installs/ruby/2.7.6/bin/runbook:23:in `load'
21: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/runbook-1.1.0/exe/runbook:5:in `<top (required)>'
20: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
19: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
18: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
17: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
16: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
15: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
14: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
13: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
12: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
11: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/runbook-1.1.0/lib/runbook/generator.rb:34:in `block (2 levels) in <class:Generator>'
10: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
9: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/group.rb:232:in `dispatch'
8: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `invoke_all'
7: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `map'
6: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `each'
5: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `block in invoke_all'
4: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
3: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
2: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/runbook-1.1.0/lib/runbook/generators/project/project.rb:275:in `remove_bad_test'
1: from /Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:272:in `gsub_file'
/Users/jcambass/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:272:in `binread': No such file or directory @ rb_sysopen - /Users/jcambass/my-project/spec/my-project_spec.rb (Errno::ENOENT)