<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/db2s3/tasks.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -2,7 +2,7 @@
 
 Gem::Specification.new do |s|
   s.name = %q{db2s3}
-  s.version = &quot;0.2&quot;
+  s.version = &quot;0.2.1&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Xavier Shay&quot;]
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
     init.rb
     lib
     lib/db2s3.rb
+    lib/db2s3/tasks.rb
     rails
     rails/init.rb
     spec</diff>
      <filename>db2s3.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -23,14 +23,16 @@ class DB2S3
     transfer_dollars_per_byte_per_month = 0.10 / 1024.0 / 1024.0 / 1024.0
     full_dumps_per_month = 30
 
-    storage_cost = dump_file.size * storage_dollars_per_byte_per_month
-    transfer_cost = dump_file.size * full_dumps_per_month * transfer_dollars_per_byte_per_month
+    storage_cost = (dump_file.size * storage_dollars_per_byte_per_month * 100).ceil / 100.0
+    transfer_cost = (dump_file.size * full_dumps_per_month * transfer_dollars_per_byte_per_month * 100).ceil / 100.0
+    requests_cost = 0.02 # TODO: Actually calculate this, with incremental backups could be more
 
     {
       :db_size       =&gt; dump_file.size,
       :storage_cost  =&gt; storage_cost,
       :transfer_cost =&gt; transfer_cost,
-      :total_cost    =&gt; storage_cost + transfer_cost,
+      :total_cost    =&gt; storage_cost + transfer_cost + requests_cost,
+      :requests_cost =&gt; requests_cost,
       :full_backups_per_month =&gt; full_dumps_per_month
     }
   end</diff>
      <filename>lib/db2s3.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-require File.expand_path(File.dirname(__FILE__) + '/lib/db2s3')
+require File.expand_path(File.dirname(__FILE__) + '/../lib/db2s3')</diff>
      <filename>rails/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,11 +28,21 @@ describe 'db2s3' do
     db2s3.stub!(:dump_db).and_return(stub(&quot;dump file&quot;, :size =&gt; 1024 * 1024 * 1024))
     metrics = db2s3.metrics
     metrics.should == {
-      :storage_cost =&gt; 0.15, # 15c/GB-Month, we're only storing one backup
+      :storage_cost =&gt; 0.15, # 15c/GB-Month rounded up to nearest cent, we're only storing one backup
       :transfer_cost =&gt; 3.0, # 10c/GB-Month * 30 backups
       :db_size       =&gt; 1024 * 1024 * 1024, # 1 GB
-      :total_cost    =&gt; 3.15,
+      :total_cost    =&gt; 3.17,
+      :requests_cost =&gt; 0.02,
       :full_backups_per_month =&gt; 30 # Default 1 backup/day
     }
   end
+
+  it 'rounds transfer cost metric up to nearest cent' do
+    db2s3 = DB2S3.new
+    # 1 KB DB
+    db2s3.stub!(:dump_db).and_return(stub(&quot;dump file&quot;, :size =&gt; 1024))
+    metrics = db2s3.metrics
+    metrics[:storage_cost].should == 0.01
+    metrics[:transfer_cost].should == 0.01
+  end
 end</diff>
      <filename>spec/db2s3_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,15 +15,20 @@ namespace :db2s3 do
       s.sub(/\.?0*$/, units[e])
     end
 
+    def format_cost(cost)
+      &quot;%.2f&quot; % [cost]
+    end
+
     metrics = DB2S3.new.metrics
     puts &lt;&lt;-EOS
 Estimates only, does not take into account metadata overhead 
 
 DB Size:            #{format_size(metrics[:db_size])}
 Full backups/month: #{metrics[:full_backups_per_month]}
-Storage Cost $US:   #{metrics[:storage_cost]}
-Transfer Cost $US:  #{metrics[:transfer_cost]}
-Total Cost $US:     #{metrics[:total_cost]}
+Storage Cost $US:   #{format_cost(metrics[:storage_cost])}
+Transfer Cost $US:  #{format_cost(metrics[:transfer_cost])}
+Requests Cost $US:  #{format_cost(metrics[:requests_cost])}
+Total Cost $US:     #{format_cost(metrics[:total_cost])}
     EOS
   end
 end</diff>
      <filename>tasks/tasks.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>96b6af36ec3a6288e8796b24c672150cbaeb5c4d</id>
    </parent>
  </parents>
  <author>
    <name>Xavier Shay</name>
    <email>xavier@rhnh.net</email>
  </author>
  <url>http://github.com/xaviershay/db2s3/commit/ad30c3a07ae2cc0cfe13f48e24a822fecb459347</url>
  <id>ad30c3a07ae2cc0cfe13f48e24a822fecb459347</id>
  <committed-date>2009-03-07T17:46:50-08:00</committed-date>
  <authored-date>2009-03-07T17:46:50-08:00</authored-date>
  <message>More accurate metrics</message>
  <tree>79bba7e3cda9c21b1cdae3ccdeaa2e7d9d90cf8d</tree>
  <committer>
    <name>Xavier Shay</name>
    <email>xavier@rhnh.net</email>
  </committer>
</commit>
