Skip to content

Commit

Permalink
Fix sqlite3 gsub in Refinery::CmsGenerator (#3530)
Browse files Browse the repository at this point in the history
I noticed when running `rails new -m https://www.refinerycms.com/t/edge`
that it was mangling the `Gemfile` when the `sqlite3` line looked like:

```ruby
  gem 'sqlite3', '~> 1.4'
```

Instead of the expected:

```ruby
  gem 'sqlite3'
```

Our `gsub_file` instruction now captures the entire line and inserts it
inside the `group :development, :test do` block.
  • Loading branch information
parndt committed May 22, 2023
1 parent 1d3222b commit 04f07c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/lib/generators/refinery/cms/cms_generator.rb
Expand Up @@ -62,8 +62,8 @@ def append_asset_pipeline!
def append_gemfile!
if destination_path.join('Gemfile').file? &&
destination_path.join('Gemfile').read !~ %r{group :development, :test do\n.+?gem 'sqlite3'\nend}m
gsub_file 'Gemfile', %q{gem 'sqlite3'}, %q{group :development, :test do
gem 'sqlite3'
gsub_file 'Gemfile', /(gem\ ['|"]sqlite3['|"].*)$/, %q{group :development, :test do
\1
end} end
end

Expand Down

0 comments on commit 04f07c1

Please sign in to comment.