lib/backhoe/load.rb in backhoe-0.9.0 vs lib/backhoe/load.rb in backhoe-0.10.0

- old
+ new

@@ -1,9 +1,9 @@ require "rake" module Backhoe - class Load < Struct.new(:database, :file_path, :drop_and_create) + class Load < Struct.new(:database, :path, :drop_and_create) include Rake::DSL def call case database.adapter when "mysql2", "trilogy" @@ -16,28 +16,28 @@ end private def mysql_command - cmd = "#{cat} #{file_path} | " + cmd = "#{cat} #{path} | " cmd += if drop_and_create "#{pipe} | #{mysql} #{database.to_mysql_options}" else "#{mysql} #{database.to_mysql_options} #{database.name}" end end def psql_command - cmd = "#{cat} #{file_path} | " + cmd = "#{cat} #{path} | " if drop_and_create cmd = "dropdb -f #{database.name}; createdb #{database.name}; #{cmd}" end cmd += "#{psql} -P pager=off -q -d#{database.name}" cmd end def cat - file_path =~ /\.gz$/ ? "zcat" : "cat" + path =~ /\.gz$/ ? "zcat" : "cat" end def pipe if drop_and_create "(echo -n '#{<<~SQL}' && cat)"