Sha256: 0bd5c075dd546c08d058de9af39c44642eb5c5ce80c0c701ec1c3219e21b1b3b

Contents?: true

Size: 1.2 KB

Versions: 14

Compression:

Stored size: 1.2 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.server}:#{source_path} #{destination_path}"
    puts
    puts "Dumped the #{stage.upcase} database to: #{File.basename config.root}/tmp/#{stage}.dump"

    # source dump if option was given
    if ARGV.include?("-s")
      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

14 entries across 14 versions & 1 rubygems

Version Path
geordi-0.16.2 bin/dump-for
geordi-0.16.1 bin/dump-for
geordi-0.16.0 bin/dump-for
geordi-0.15.7 bin/dump-for
geordi-0.15.6 bin/dump-for
geordi-0.15.5 bin/dump-for
geordi-0.15.4 bin/dump-for
geordi-0.15.3 bin/dump-for
geordi-0.15.2 bin/dump-for
geordi-0.15.1 bin/dump-for
geordi-0.15.0 bin/dump-for
geordi-0.14.9 bin/dump-for
geordi-0.14.8 bin/dump-for
geordi-0.14.7 bin/dump-for