boltops-tools / terraspace

Terraspace: The Terraform Framework
https://terraspace.cloud
Apache License 2.0
678 stars 46 forks source link

Add checks around plugin_gem_name in project Gemfile template #349

Closed smasset-orange closed 5 months ago

smasset-orange commented 7 months ago

This is a 🐞 bug fix.

Summary

When creating a project with no plugin (i.e. using terraspace new project --plugin none infra) the Gemfile for the project contains a line with no name for the gem which makes it unparsable and stops the build process.

This PR wraps the plugin line with ERB if/end statements to avoid inserting the line if there is no plugin or if it wasn't found on the system.

Context

How to Test

Run terraspace new project --plugin none infra and check that infra/Gemfile doesn't contain a line with just gem I couldn't build a local version to test this myself before creating this PR. But I'll happily include a testcase to check the fix with some guidance as I haven't written a lot of Ruby.

Version Changes