Skip to content

Commit

Permalink
Adds optional Postgres setup for test database
Browse files Browse the repository at this point in the history
Our CircleCI orb gives us the ENV variables this setup uses.
  • Loading branch information
rotated8 authored and jeremyf committed Jul 15, 2020
1 parent 8868532 commit cd4c970
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/test_app_templates/lib/generators/test_app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ def install_engine
generate 'hyrax:install', '-f'
end

def allow_postgresql
gsub_file 'config/database.yml',
"test:\n <<: *default\n database: db/test.sqlite3\n",
<<-EOS.strip_heredoc
test:
<<: *default
adapter: <%= ENV["POSTGRES_DB"].nil? ? "sqlite3" : "postgresql" %>
database: <%= ENV["POSTGRES_DB"].nil? ? "db/test.sqlite3" : ENV["POSTGRES_DB"] %>
<%= "host: "+ENV["POSTGRES_HOST"] unless ENV["POSTGRES_HOST"].nil? %>
<%= "username: "+ENV["POSTGRES_USER"] unless ENV["POSTGRES_USER"].nil? %>
EOS
end

def browse_everything_install
generate "browse_everything:install --skip-assets"
end
Expand Down

0 comments on commit cd4c970

Please sign in to comment.