Skip to content

Commit

Permalink
Merge pull request #1279 from Ortuna/issue-1264
Browse files Browse the repository at this point in the history
dm:create and dm:drop did not pass the arguments to the #system correctly
  • Loading branch information
Darío Javier Cravero committed May 16, 2013
2 parents db941c8 + d05df49 commit cef1cbc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions padrino-gen/lib/padrino-gen/padrino-tasks/datamapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@
puts "=> Creating database '#{database}'"
case config[:adapter]
when 'postgres'
system("createdb", "-E", charset, "-h", host, "-U", user, database)
arguments = []
arguments << "--encoding=#{charset}" if charset
arguments << "--host=#{host}" if host
arguments << "--username=#{user}" if user
arguments << database
system("createdb", *arguments)
puts "<= dm:create executed"
when 'mysql'
arguments = ["--user=#{user}"]
Expand Down Expand Up @@ -88,7 +93,11 @@
puts "=> Dropping database '#{database}'"
case config[:adapter]
when 'postgres'
system("dropdb", "-h", host, "-U", user, database)
arguments = []
arguments << "--host=#{host}" if host
arguments << "--username=#{user}" if user
arguments << database
system("dropdb", *arguments)
puts "<= dm:drop executed"
when 'mysql'
arguments = ["--user=#{user}"]
Expand Down

0 comments on commit cef1cbc

Please sign in to comment.