Skip to content

Commit

Permalink
add Sequel support to Heroku plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewyea authored and achiurizo committed Oct 6, 2010
1 parent 73af8ba commit d949f72
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugins/heroku_plugin.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
##
# Prepare app for deployment to Heroku by configuring production database,
# adding required gem dependencies and adding a Rakefile with Padrino tasks.
#
Expand Down Expand Up @@ -28,13 +27,18 @@

orm = fetch_component_choice(:orm)

adapter = case orm
when 'activerecord' then 'pg'
when 'datamapper' then 'dm-postgres-adapter'
end

append_file("Gemfile", "\n# Heroku\ngem '#{adapter}', :group => :production") if adapter

case orm
when 'datamapper'
gsub_file "config/database.rb", /\"sqlite3.*production.+/, "ENV['DATABASE_URL'])"
append_file "Gemfile", "\n# Heroku\ngem 'dm-postgres-adapter', :group => :production"
when 'datamapper', 'sequel'
gsub_file "config/database.rb", /\"sqlite.*production.*/, "ENV['DATABASE_URL'])"
when 'activerecord'
gsub_file "config/database.rb", /^.+production.*\{(\n\s+\:.*){2}\n\s\}/, AR_CONFIG
append_file "Gemfile", "\n# Heroku\ngem 'pg', :group => :production"
else
say "Remember to configure your production database, if necessary.", :yellow
end
end

0 comments on commit d949f72

Please sign in to comment.