Sha256: 4bf3f7fc3b1fdff2db416327329a3f0ef59c968161b492d3348c3cfb7519e2ee

Contents?: true

Size: 973 Bytes

Versions: 3

Compression:

Stored size: 973 Bytes

Contents

if defined?(Capistrano)
  Capistrano::Configuration.instance.load do
    namespace :porter do
      CONFIG    = YAML::load_file('config/porter_config.yml')
      DATABASES = YAML::load_file('config/database.yml')
      STAGES    = DATABASES.keys - %w(development test) # you don't need data out of these
      STAGES.each do |stage|
        # task names for each of your other stages: production, staging, etc.
        # cap porter:production, cap porter:staging, etc.
        task stage do
          src_db = DATABASES[stage]
          db     = src_db['database']
          user   = src_db['username']
          pass   = src_db['password']
        
          domain = CONFIG[stage]['domain']
          server domain, :porter
        
          run "mysqldump --user=#{user} --password=#{pass} #{db} | gzip > ~/#{db}.sql.gz", :roles => :porter
          system "rake porter:#{stage}:db"
          system "rake porter:#{stage}:assets"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
porter-1.0.2 lib/porter/recipes/porter.rb
porter-1.0.1 lib/porter/recipes/porter.rb
porter-1.0.0 lib/porter/recipes/porter.rb