<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/astrails/safe/pgdump.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,3 +4,4 @@ coverage
 rdoc
 pkg
 tmp
+*~
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 astrails-safe
 =============
 
-Simple mysql and filesystem backups with S3 support (with optional encryption)
+Simple database and filesystem backups with S3 support (with optional encryption)
 
 Motivation
 ----------
@@ -12,6 +12,7 @@ We needed a backup solution that will satisfy the following requirements:
 * simple to install and configure
 * support for simple &#8216;tar&#8217; backups of directories (with includes/excludes)
 * support for simple mysqldump of mysql databases
+* support for simple pg_dump of PostgreSQL databases
 * support for symmetric or public key encryption
 * support for local filesystem and Amazon S3 for storage
 * support for backup rotation. we don&#8217;t want backups filling all the diskspace or cost a fortune on S3
@@ -62,7 +63,7 @@ The procedure to create and transfer the key is as follows:
 
 4. import public key on the remote system:
 &lt;pre&gt;
-   $ gpg --import test@example.com.pub 
+   $ gpg --import test@example.com.pub
    gpg: key 45CA9403: public key &quot;Test Backup &lt;test@example.com&gt;&quot; imported
    gpg: Total number processed: 1
    gpg:               imported: 1
@@ -83,7 +84,7 @@ The procedure to create and transfer the key is as follows:
      4 = I trust fully
      5 = I trust ultimately
      m = back to the main menu
-     
+
      Your decision? 5
      ...
      Command&gt; quit
@@ -136,6 +137,16 @@ Example configuration
 
     end
 
+    pgdump do
+      options &quot;-i -x -O&quot;   # -i =&gt; ignore version, -x =&gt; do not dump privileges (grant/revoke), -O =&gt; skip restoration of object ownership in plain text format
+
+      user &quot;username&quot;
+      password &quot;............&quot;  # shouldn't be used, instead setup ident.  Current functionality exports a password env to the shell which pg_dump uses - untested!
+
+      database :blog
+      database :stateofflux_com
+    end
+
     tar do
       archive &quot;git-repositories&quot;, :files =&gt; &quot;/home/git/repositories&quot;
       archive &quot;dot-configs&quot;,      :files =&gt; &quot;/home/*/.[^.]*&quot;</diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -5,11 +5,11 @@ begin
   require 'jeweler'
   Jeweler::Tasks.new do |gem|
     gem.name = &quot;safe&quot;
-    gem.summary = %Q{Backup filesystem and MySQL to Amazon S3 (with encryption)}
-    gem.description = &quot;Simple tool to backup MySQL databases and filesystem locally or to Amazon S3 (with optional encryption)&quot;
+    gem.summary = %Q{Backup filesystem and databases (MySQL and PostgreSQL) to Amazon S3 (with encryption)}
+    gem.description = &quot;Simple tool to backup databases (MySQL and PostgreSQL) and filesystem locally or to Amazon S3 (with optional encryption)&quot;
     gem.email = &quot;we@astrails.com&quot;
     gem.homepage = &quot;http://github.com/astrails/safe&quot;
-    gem.authors  = [&quot;Astrails Ltd.&quot;]
+    gem.authors  = [&quot;Astrails Ltd.&quot;, &quot;Mark Mansour&quot;]
     gem.files = FileList[&quot;[A-Z]*.*&quot;, &quot;{bin,examples,generators,lib,rails,spec,test,templates}/**/*&quot;, 'Rakefile', 'LICENSE*']
 
     gem.add_dependency(&quot;aws-s3&quot;)</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
---- 
+---
 :major: 0
 :minor: 1
-:patch: 6
+:patch: 7</diff>
      <filename>VERSION.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,55 @@
 require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
 
 describe Astrails::Safe::Config do
+  it &quot;pgdump&quot; do
+    config = Astrails::Safe::Config::Node.new do
+      local do
+        path &quot;path&quot;
+      end
+
+      pgdump do
+        # `pg_dump -U &quot;#{abcs[RAILS_ENV][&quot;username&quot;]}&quot; -i -x -O  #{abcs[RAILS_ENV][&quot;database&quot;]} -f db/#{filename}`
+        options &quot;-i -x -O&quot;
+
+        user &quot;astrails&quot;
+        password &quot;&quot;
+        host &quot;localhost&quot;
+        port 5432
+
+        database :blog
+
+        database :production do
+          keep :local =&gt; 3
+
+          skip_tables [:logger_exceptions, :request_logs]
+        end
+
+      end
+    end
+
+    expected = {
+      &quot;local&quot; =&gt; {&quot;path&quot; =&gt; &quot;path&quot;},
+
+      &quot;pgdump&quot; =&gt; {
+        &quot;options&quot; =&gt; &quot;-i -x -O&quot;,
+        &quot;user&quot; =&gt; &quot;astrails&quot;,
+        &quot;password&quot; =&gt; &quot;&quot;,
+        &quot;host&quot; =&gt; &quot;localhost&quot;,
+        &quot;port&quot; =&gt; 5432,
+
+        &quot;databases&quot; =&gt; {
+          &quot;blog&quot; =&gt; {},
+          &quot;production&quot; =&gt; {
+           &quot;keep&quot; =&gt; {&quot;local&quot; =&gt; 3},
+            &quot;skip_tables&quot; =&gt; [&quot;logger_exceptions&quot;, &quot;request_logs&quot;],
+          },
+        },
+      }
+    }
+
+    config.to_hash.should == expected
+  end
+
   it &quot;foo&quot; do
     config = Astrails::Safe::Config::Node.new do
       local do</diff>
      <filename>examples/unit/config_example.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,7 @@ require 'astrails/safe/stream'
 
 require 'astrails/safe/source'
 require 'astrails/safe/mysqldump'
+require 'astrails/safe/pgdump'
 require 'astrails/safe/archive'
 
 require 'astrails/safe/pipe'
@@ -32,6 +33,7 @@ module Astrails
       #config.dump
 
       Astrails::Safe::Mysqldump.run(config[:mysqldump, :databases])
+      Astrails::Safe::Pgdump.run(config[:pgdump, :databases])
       Astrails::Safe::Archive.run(config[:tar, :archives])
 
       Astrails::Safe::TmpFile.cleanup</diff>
      <filename>lib/astrails/safe.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ module Astrails
     module Config
       class Builder
         COLLECTIONS = %w/database archive/
-        ITEMS = %w/s3 key secret bucket path gpg password keep local mysqldump options
+        ITEMS = %w/s3 key secret bucket path gpg password keep local mysqldump pgdump options
         user host port socket skip_tables tar files exclude filename/
         NAMES = COLLECTIONS + ITEMS
         def initialize(node)</diff>
      <filename>lib/astrails/safe/config/builder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,13 +2,13 @@
 
 Gem::Specification.new do |s|
   s.name = %q{safe}
-  s.version = &quot;0.1.6&quot;
+  s.version = &quot;0.1.7&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
-  s.authors = [&quot;Astrails Ltd.&quot;]
-  s.date = %q{2009-04-16}
+  s.authors = [&quot;Astrails Ltd.&quot;, &quot;Mark Mansour&quot;]
+  s.date = %q{2009-04-24}
   s.default_executable = %q{astrails-safe}
-  s.description = %q{Simple tool to backup MySQL databases and filesystem locally or to Amazon S3 (with optional encryption)}
+  s.description = %q{Simple tool to backup MySQL and PostgreSQL databases and filesystem locally or to Amazon S3 (with optional encryption)}
   s.email = %q{we@astrails.com}
   s.executables = [&quot;astrails-safe&quot;]
   s.extra_rdoc_files = [&quot;README.markdown&quot;, &quot;LICENSE&quot;]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
   s.rdoc_options = [&quot;--inline-source&quot;, &quot;--charset=UTF-8&quot;]
   s.require_paths = [&quot;lib&quot;]
   s.rubygems_version = %q{1.3.1}
-  s.summary = %q{Backup filesystem and MySQL to Amazon S3 (with encryption)}
+  s.summary = %q{Backup filesystem and database (MySQL and PostgreSQL) to Amazon S3 (with encryption)}
 
   if s.respond_to? :specification_version then
     current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION</diff>
      <filename>safe.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -72,6 +72,19 @@ safe do
 
   end
 
+  # # uncomment to enable
+  # # backup PostgreSQL databases with pg_dump
+  # pgdump do
+  #   option &quot;-i -x -O&quot;
+  #
+  #   user &quot;markmansour&quot;
+  #   # password &quot;&quot; - leave this out if you have ident setup
+  #
+  #   # database is a 'collection' element. it must have a hash or block parameter
+  #   # it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
+  #   database :blog
+  #   database :production
+  # end
 
   tar do
     # 'archive' is a collection item, just like 'database'</diff>
      <filename>templates/script.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>80cac2bf99ce4512c206ad77d54bf9a36684f97e</id>
    </parent>
  </parents>
  <author>
    <name>Mark Mansour</name>
    <email>mark@stateofflux.com</email>
  </author>
  <url>http://github.com/astrails/safe/commit/e0097c8fc15ad7cb78790dea2485b84b691754a7</url>
  <id>e0097c8fc15ad7cb78790dea2485b84b691754a7</id>
  <committed-date>2009-04-24T18:54:57-07:00</committed-date>
  <authored-date>2009-04-24T18:54:57-07:00</authored-date>
  <message>added PostgreSQL support</message>
  <tree>aa60e138c15d00f1a5b124bbd4af29fb9fa7c266</tree>
  <committer>
    <name>Mark Mansour</name>
    <email>mark@stateofflux.com</email>
  </committer>
</commit>
