Sha256: 7229dec1ceec9a6ad16f1ef730ef3f4a4207a903851bb3eb80944d2af3f6d05f

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 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_directory = "#{root}/tmp"
    system "mkdir -p #{destination_directory}" # Ensure the destination directory exists
    destination_path = "#{destination_directory}/#{stage}.dump"

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

    # source dump if option was given
    if ARGV.include?("-s")
      puts "Sourcing dump into development database..."
      puts `load-dump #{destination_path}`
      if $?.to_i == 0
        puts "Your database is now sourced with a fresh #{stage} dump."
      else
        $stderr.puts "Could not source the downloaded #{stage} dump."
      end
    end
  else
    raise "An error occurred. Aborting..."
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geordi-0.14.6 bin/dump-for
geordi-0.14.5 bin/dump-for
geordi-0.14.4 bin/dump-for
geordi-0.14.3 bin/dump-for