Sha256: 58e3a62a6ebafabdfcbb10583725483a42c181934fadbd359acd660c1fdfb15a

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby
require File.dirname(__FILE__) + "/../lib/geordi"
include Geordi

catching_errors do
  retrieve_data!
  
  command = %(ssh #{user}@#{server} -t "cd #{path} && dumple #{env} --for_download")
  success = system command
  
  if success
    source_path = "~/dumps/dump_for_download.dump"
    destination_path = "#{root}/tmp/#{env}.dump"

    puts "Downloading dump_for_download..."
    system "scp #{user}@#{server}:#{source_path} #{destination_path}"
    puts
    puts "Dumped the #{env.upcase} database to: #{File.basename root}/tmp/#{env}.dump"

    # source dump if option was given
    if ARGV.include?("-s")
      puts "Sourcing dump into development database..."
      if File.exists?("script/dbconsole")
        `script/dbconsole -p < #{destination_path}`
      else
        `rails dbconsole -p < #{destination_path}`
      end

      if $?.to_i == 0
        puts "Your database is now sourced with a fresh #{env} dump."
      else
        puts "Could not source the downloaded #{env} dump."
      end
    end
  else
    raise "An error occurred. Aborting..."
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geordi-0.13.0 bin/dump-for
geordi-0.12.8 bin/dump-for
geordi-0.12.7 bin/dump-for
geordi-0.12.6 bin/dump-for
geordi-0.12.5 bin/dump-for
geordi-0.12.4 bin/dump-for
geordi-0.12.3 bin/dump-for
geordi-0.12.2 bin/dump-for