Sha256: acb5f57101345a7c4b63a9b7ee3cb9207c1744d39a19a95844864888ebe82f97

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

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

catching_errors do
  self.stage = ARGV.shift
  
  success = shell_for("dumple #{config.env} --for_download", :exec => false)
  
  if success
    source_path = "~/dumps/dump_for_download.dump"
    destination_directory = "#{config.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 #{config.user}@#{config.primary_server}:#{source_path} #{destination_path}"
    puts "Dumped the #{stage.upcase} database to RAILS_ROOT/tmp/#{stage}.dump"

    # source dump if option was given
    if ARGV.include?("-s")
      puts
      puts "Sourcing dump into development database..."
      success = DumpLoader.new([destination_path]).execute
      if success
        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.18.0 bin/dump-for
geordi-0.17.4 bin/dump-for
geordi-0.17.3 bin/dump-for
geordi-0.16.3 bin/dump-for