pgbackups-archive 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +1 -4
- data/Gemfile.lock +60 -43
- data/Guardfile +16 -3
- data/README.md +9 -4
- data/lib/pgbackups-archive/heroku/client/pgbackups_archive.rb +5 -1
- data/lib/pgbackups-archive/railtie.rb +0 -1
- data/lib/pgbackups-archive/version.rb +1 -1
- data/lib/tasks/test.rake +10 -0
- data/pgbackups-archive.gemspec +4 -4
- data/test/ci/before_script.sh +6 -0
- data/test/ci/ci_runner.sh +8 -0
- data/test/lib/pgbackups-archive/heroku/client/pgbackups_archive_test.rb +64 -0
- data/test/lib/pgbackups-archive/storage_test.rb +33 -0
- data/test/minitest_helper.rb +22 -0
- data/test/support/minitest_reporters.rb +4 -0
- data/test/support/mocha.rb +1 -0
- metadata +25 -21
- data/spec/lib/pgbackups-archive/heroku/client/pgbackups_archive_spec.rb +0 -26
- data/spec/lib/pgbackups-archive/storage_spec.rb +0 -28
- data/spec/spec_helper.rb +0 -1
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.2
|
4
|
+
- 1.9.3
|
5
|
+
- jruby-19mode
|
6
|
+
- rbx-19mode
|
7
|
+
env:
|
8
|
+
- CI=true RAILS_ENV=test JRUBY_OPTS=--1.9 RBXOPT=-X19
|
9
|
+
before_script: "./test/ci/before_script.sh"
|
10
|
+
script: "./test/ci/ci_runner.sh"
|
11
|
+
notifications:
|
12
|
+
flowdock: 1ec5c0efa5a264c67c6ba3b2e6574a70
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pgbackups-archive (0.0
|
5
|
-
bundler (
|
4
|
+
pgbackups-archive (0.1.0)
|
5
|
+
bundler (>= 1.2.3)
|
6
6
|
fog (>= 1.4.0)
|
7
|
-
heroku (~> 2.
|
7
|
+
heroku (~> 2.34.0)
|
8
8
|
rake (>= 0.9.2.2)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
13
|
addressable (2.3.2)
|
14
|
+
ansi (1.4.3)
|
14
15
|
builder (3.1.4)
|
16
|
+
cane (2.5.2)
|
17
|
+
parallel
|
15
18
|
coderay (1.0.8)
|
16
|
-
|
17
|
-
|
18
|
-
fog (1.6.0)
|
19
|
+
excon (0.16.10)
|
20
|
+
fog (1.9.0)
|
19
21
|
builder
|
20
22
|
excon (~> 0.14)
|
21
23
|
formatador (~> 0.2.0)
|
@@ -25,67 +27,82 @@ GEM
|
|
25
27
|
net-ssh (>= 2.1.3)
|
26
28
|
nokogiri (~> 1.5.0)
|
27
29
|
ruby-hmac
|
28
|
-
formatador (0.2.
|
29
|
-
|
30
|
-
|
31
|
-
rspec-instafail (~> 0.2.0)
|
32
|
-
ruby-progressbar (~> 0.0.10)
|
33
|
-
growl (1.0.3)
|
34
|
-
guard (1.5.0)
|
35
|
-
listen (>= 0.4.2)
|
30
|
+
formatador (0.2.4)
|
31
|
+
guard (1.6.2)
|
32
|
+
listen (>= 0.6.0)
|
36
33
|
lumberjack (>= 1.0.2)
|
37
34
|
pry (>= 0.9.10)
|
35
|
+
terminal-table (>= 1.4.3)
|
38
36
|
thor (>= 0.14.6)
|
39
|
-
guard-
|
40
|
-
guard (>=
|
41
|
-
|
42
|
-
|
37
|
+
guard-minitest (0.5.0)
|
38
|
+
guard (>= 0.4)
|
39
|
+
hashie (1.2.0)
|
40
|
+
heroku (2.34.0)
|
41
|
+
heroku-api (~> 0.3.7)
|
43
42
|
launchy (>= 0.3.2)
|
44
43
|
netrc (~> 0.7.7)
|
45
44
|
rest-client (~> 1.6.1)
|
46
45
|
rubyzip
|
47
|
-
heroku-api (0.3.
|
48
|
-
excon (~> 0.16.
|
46
|
+
heroku-api (0.3.7)
|
47
|
+
excon (~> 0.16.10)
|
49
48
|
launchy (2.1.2)
|
50
49
|
addressable (~> 2.3)
|
51
|
-
listen (0.
|
50
|
+
listen (0.7.2)
|
52
51
|
lumberjack (1.0.2)
|
52
|
+
metaclass (0.0.1)
|
53
53
|
method_source (0.8.1)
|
54
|
-
mime-types (1.
|
54
|
+
mime-types (1.20.1)
|
55
|
+
minitest (4.5.0)
|
56
|
+
minitest-reporters (0.14.7)
|
57
|
+
ansi
|
58
|
+
builder
|
59
|
+
minitest (>= 2.12, < 5.0)
|
60
|
+
powerbar
|
61
|
+
mocha (0.13.2)
|
62
|
+
metaclass (~> 0.0.1)
|
55
63
|
multi_json (1.3.6)
|
56
64
|
net-scp (1.0.4)
|
57
65
|
net-ssh (>= 1.99.1)
|
58
|
-
net-ssh (2.6.
|
66
|
+
net-ssh (2.6.3)
|
59
67
|
netrc (0.7.7)
|
60
|
-
nokogiri (1.5.
|
61
|
-
|
68
|
+
nokogiri (1.5.6)
|
69
|
+
parallel (0.6.2)
|
70
|
+
powerbar (1.0.11)
|
71
|
+
ansi (~> 1.4.0)
|
72
|
+
hashie (>= 1.1.0)
|
73
|
+
pry (0.9.11.4)
|
62
74
|
coderay (~> 1.0.5)
|
63
75
|
method_source (~> 0.8)
|
64
|
-
slop (~> 3.
|
65
|
-
rake (0.
|
76
|
+
slop (~> 3.4)
|
77
|
+
rake (10.0.3)
|
78
|
+
rb-fsevent (0.9.3)
|
66
79
|
rest-client (1.6.7)
|
67
80
|
mime-types (>= 1.16)
|
68
|
-
rspec (2.11.0)
|
69
|
-
rspec-core (~> 2.11.0)
|
70
|
-
rspec-expectations (~> 2.11.0)
|
71
|
-
rspec-mocks (~> 2.11.0)
|
72
|
-
rspec-core (2.11.1)
|
73
|
-
rspec-expectations (2.11.3)
|
74
|
-
diff-lcs (~> 1.1.3)
|
75
|
-
rspec-instafail (0.2.4)
|
76
|
-
rspec-mocks (2.11.3)
|
77
81
|
ruby-hmac (0.4.0)
|
78
|
-
ruby-progressbar (0.0.10)
|
79
82
|
rubyzip (0.9.9)
|
80
|
-
|
81
|
-
|
83
|
+
simplecov (0.7.1)
|
84
|
+
multi_json (~> 1.0)
|
85
|
+
simplecov-html (~> 0.7.1)
|
86
|
+
simplecov-html (0.7.1)
|
87
|
+
slop (3.4.3)
|
88
|
+
terminal-notifier-guard (1.5.3)
|
89
|
+
terminal-table (1.4.5)
|
90
|
+
thincloud-test (1.0.0.pre)
|
91
|
+
cane (~> 2.5.2)
|
92
|
+
guard (~> 1.6.1)
|
93
|
+
guard-minitest (~> 0.5.0)
|
94
|
+
minitest (~> 4.5.0)
|
95
|
+
minitest-reporters (~> 0.14.7)
|
96
|
+
mocha (~> 0.13.2)
|
97
|
+
rb-fsevent (~> 0.9.1)
|
98
|
+
simplecov (~> 0.7.1)
|
99
|
+
terminal-notifier-guard (~> 1.5.3)
|
100
|
+
thor (~> 0.17.0)
|
101
|
+
thor (0.17.0)
|
82
102
|
|
83
103
|
PLATFORMS
|
84
104
|
ruby
|
85
105
|
|
86
106
|
DEPENDENCIES
|
87
|
-
fuubar (~> 1.0.0)
|
88
|
-
growl (~> 1.0.3)
|
89
|
-
guard-rspec (~> 1.2.0)
|
90
107
|
pgbackups-archive!
|
91
|
-
|
108
|
+
thincloud-test (~> 1.0.0.pre)
|
data/Guardfile
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard "minitest" do
|
5
|
+
# with Minitest::Spec
|
6
|
+
watch(%r|^test/(.*)_test\.rb|)
|
7
|
+
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
|
8
|
+
watch(%r|^test/minitest_helper\.rb|) { "test" }
|
9
|
+
watch(%r|^test/support/|) { "test" }
|
10
|
+
|
11
|
+
# Rails 3.2
|
12
|
+
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
|
13
|
+
watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" }
|
14
|
+
watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
|
15
|
+
watch(%r|^app/models/(.*)\.rb|) { |m| "test/models/#{m[1]}_test.rb" }
|
4
16
|
end
|
17
|
+
|
data/README.md
CHANGED
@@ -19,11 +19,9 @@ Add the gem to your Gemfile and bundle:
|
|
19
19
|
|
20
20
|
Install Heroku addons:
|
21
21
|
|
22
|
-
heroku addons:add pgbackups
|
22
|
+
heroku addons:add pgbackups
|
23
23
|
heroku addons:add scheduler:standard
|
24
24
|
|
25
|
-
Note: You can use paid-for versions of pgbackups if you'd like, however the dev and basic database offerings only support the free (plus) version.
|
26
|
-
|
27
25
|
Apply environment variables:
|
28
26
|
|
29
27
|
heroku config:add PGBACKUPS_AWS_ACCESS_KEY_ID="XXX"
|
@@ -31,6 +29,11 @@ Apply environment variables:
|
|
31
29
|
heroku config:add PGBACKUPS_BUCKET="myapp-backups"
|
32
30
|
heroku config:add PGBACKUPS_REGION="us-west-2"
|
33
31
|
|
32
|
+
Optionally set the database to perform backups on. Defaults to DATABASE_URL.
|
33
|
+
|
34
|
+
heroku config:add PGBACKUPS_DATABASE="HEROKU_POSTGRESQL_GOLD_URL"
|
35
|
+
|
36
|
+
|
34
37
|
Note: A good security measure would be to use a dedicated set of AWS credentials with a security policy only allowing access to the bucket you're specifying. See this Pro Tip on [Assigning an AWS IAM user access to a single S3 bucket](http://coderwall.com/p/dwhlma).
|
35
38
|
|
36
39
|
Add the rake task to scheduler:
|
@@ -67,8 +70,10 @@ Many thanks go to the following who have contributed to making this gem even bet
|
|
67
70
|
* Autoload rake task into Rails 2.x once the gem has been loaded.
|
68
71
|
* [Daniel Morrison (@danielmorrison)](https://github.com/danielmorrison)
|
69
72
|
* Ruby 1.8-compatible hash syntax.
|
73
|
+
* [Karl Baum (@kbaum)](https://github.com/kbaum)
|
74
|
+
* Custom setting for database to backup.
|
70
75
|
|
71
76
|
## License
|
72
77
|
|
73
78
|
* Freely distributable and licensed under the [MIT license](http://kjohnston.mit-license.org/license.html).
|
74
|
-
* Copyright (c) 2012 Kenny Johnston [![endorse](http://api.coderwall.com/kjohnston/endorsecount.png)](http://coderwall.com/kjohnston)
|
79
|
+
* Copyright (c) 2012-2013 Kenny Johnston [![endorse](http://api.coderwall.com/kjohnston/endorsecount.png)](http://coderwall.com/kjohnston)
|
@@ -12,7 +12,7 @@ class Heroku::Client::PgbackupsArchive
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def capture
|
15
|
-
@backup = @client.create_transfer
|
15
|
+
@backup = @client.create_transfer database_url, database_url, nil, "BACKUP", :expire => true
|
16
16
|
|
17
17
|
until @backup["finished_at"]
|
18
18
|
print "."
|
@@ -23,6 +23,10 @@ class Heroku::Client::PgbackupsArchive
|
|
23
23
|
@backup
|
24
24
|
end
|
25
25
|
|
26
|
+
def database_url
|
27
|
+
ENV["PGBACKUPS_DATABASE_URL"] || ENV["DATABASE_URL"]
|
28
|
+
end
|
29
|
+
|
26
30
|
def file
|
27
31
|
open @backup["public_url"]
|
28
32
|
end
|
data/lib/tasks/test.rake
ADDED
data/pgbackups-archive.gemspec
CHANGED
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{A means of automating Heroku's pgbackups and archiving them to Amazon S3 via the fog gem.}
|
13
13
|
s.description = %q{A means of automating Heroku's pgbackups and archiving them to Amazon S3 via the fog gem.}
|
14
14
|
|
15
|
-
s.add_dependency "bundler", "
|
16
|
-
s.add_dependency "fog",
|
17
|
-
s.add_dependency "heroku",
|
18
|
-
s.add_dependency "rake",
|
15
|
+
s.add_dependency "bundler", ">= 1.2.3"
|
16
|
+
s.add_dependency "fog", ">= 1.4.0"
|
17
|
+
s.add_dependency "heroku", "~> 2.34.0"
|
18
|
+
s.add_dependency "rake", ">= 0.9.2.2"
|
19
19
|
|
20
20
|
s.files = `git ls-files`.split("\n")
|
21
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
require "heroku/client"
|
3
|
+
|
4
|
+
describe Heroku::Client::PgbackupsArchive do
|
5
|
+
let(:archive) {
|
6
|
+
Heroku::Client::PgbackupsArchive.new(
|
7
|
+
:pgbackups_url => "https://ip:password@pgbackups.heroku.com/client"
|
8
|
+
)
|
9
|
+
}
|
10
|
+
let(:backup) { { "finished_at" => "some timestamp" } }
|
11
|
+
|
12
|
+
it "should use a pgbackup client" do
|
13
|
+
archive.client.class.must_equal Heroku::Client::Pgbackups
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "given a finished_at timestamp" do
|
17
|
+
before { archive.client.stubs(:create_transfer).returns(backup) }
|
18
|
+
|
19
|
+
it "should capture the backup" do
|
20
|
+
archive.capture.must_equal backup
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should store the backup" do
|
24
|
+
archive.stubs(:key).returns("key")
|
25
|
+
archive.stubs(:file).returns("file")
|
26
|
+
archive.store.class.must_equal Fog::Storage::AWS::File
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "configure the backup database" do
|
31
|
+
|
32
|
+
describe "backup database is not configured" do
|
33
|
+
before do
|
34
|
+
ENV["PGBACKUPS_DATABASE_URL"] = nil
|
35
|
+
ENV["DATABASE_URL"] = "db_url"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "defaults to using the DATABASE_URL" do
|
39
|
+
archive.client.expects(:create_transfer)
|
40
|
+
.with("db_url", "db_url", nil, "BACKUP", :expire => true)
|
41
|
+
.returns(backup)
|
42
|
+
|
43
|
+
archive.capture
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "backup database is configured" do
|
48
|
+
before do
|
49
|
+
ENV["PGBACKUPS_DATABASE_URL"] = "backup_db"
|
50
|
+
ENV["DATABASE_URL"] = "db_url"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "defaults to using the DATABASE_URL" do
|
54
|
+
archive.client.expects(:create_transfer)
|
55
|
+
.with("backup_db", "backup_db", nil, "BACKUP", :expire => true)
|
56
|
+
.returns(backup)
|
57
|
+
|
58
|
+
archive.capture
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
|
3
|
+
describe PgbackupsArchive::Storage do
|
4
|
+
let(:connection) {
|
5
|
+
Fog::Storage.new(
|
6
|
+
:provider => "AWS",
|
7
|
+
:aws_access_key_id => "XXX",
|
8
|
+
:aws_secret_access_key => "YYY")
|
9
|
+
}
|
10
|
+
let(:bucket) { connection.directories.create(:key => "someapp-backups") }
|
11
|
+
let(:key) { "pgbackups/test/2012-08-02-12-00-00.dump" }
|
12
|
+
let(:file) { "test" }
|
13
|
+
let(:storage) { PgbackupsArchive::Storage.new(key, file) }
|
14
|
+
|
15
|
+
before do
|
16
|
+
Fog.mock!
|
17
|
+
storage.stubs(:connection).returns(connection)
|
18
|
+
storage.stubs(:bucket).returns(bucket)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should create a fog connection" do
|
22
|
+
storage.connection.class.must_equal Fog::Storage::AWS::Mock
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should create a fog directory" do
|
26
|
+
storage.bucket.class.must_equal Fog::Storage::AWS::Directory
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should create a fog file" do
|
30
|
+
storage.store.class.must_equal Fog::Storage::AWS::File
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Dir[File.dirname(__FILE__) + "/../lib/**/*.rb"].each { |f| require f }
|
2
|
+
|
3
|
+
if RUBY_ENGINE == "ruby"
|
4
|
+
begin
|
5
|
+
require "simplecov"
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter "test"
|
8
|
+
add_filter "config"
|
9
|
+
command_name "MiniTest"
|
10
|
+
end
|
11
|
+
rescue LoadError
|
12
|
+
warn "unable to load SimpleCov"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
require "thincloud/test"
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
21
|
+
# in spec/support/ and its subdirectories.
|
22
|
+
Dir[File.join("./test/support/**/*.rb")].sort.each { |f| require f }
|
@@ -0,0 +1 @@
|
|
1
|
+
require "mocha/setup"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgbackups-archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.2.
|
21
|
+
version: 1.2.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.2.
|
29
|
+
version: 1.2.3
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: fog
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.34.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.
|
61
|
+
version: 2.34.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rake
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,6 +85,7 @@ extra_rdoc_files: []
|
|
85
85
|
files:
|
86
86
|
- .gitignore
|
87
87
|
- .rvmrc
|
88
|
+
- .travis.yml
|
88
89
|
- Gemfile
|
89
90
|
- Gemfile.lock
|
90
91
|
- Guardfile
|
@@ -96,10 +97,15 @@ files:
|
|
96
97
|
- lib/pgbackups-archive/storage.rb
|
97
98
|
- lib/pgbackups-archive/version.rb
|
98
99
|
- lib/tasks/pgbackups_archive.rake
|
100
|
+
- lib/tasks/test.rake
|
99
101
|
- pgbackups-archive.gemspec
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
102
|
+
- test/ci/before_script.sh
|
103
|
+
- test/ci/ci_runner.sh
|
104
|
+
- test/lib/pgbackups-archive/heroku/client/pgbackups_archive_test.rb
|
105
|
+
- test/lib/pgbackups-archive/storage_test.rb
|
106
|
+
- test/minitest_helper.rb
|
107
|
+
- test/support/minitest_reporters.rb
|
108
|
+
- test/support/mocha.rb
|
103
109
|
homepage: http://github.com/kjohnston/pgbackups-archive
|
104
110
|
licenses: []
|
105
111
|
post_install_message:
|
@@ -112,26 +118,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
118
|
- - ! '>='
|
113
119
|
- !ruby/object:Gem::Version
|
114
120
|
version: '0'
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
hash: -749794191267838677
|
118
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
122
|
none: false
|
120
123
|
requirements:
|
121
124
|
- - ! '>='
|
122
125
|
- !ruby/object:Gem::Version
|
123
126
|
version: '0'
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
hash: -749794191267838677
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.25
|
130
130
|
signing_key:
|
131
131
|
specification_version: 3
|
132
132
|
summary: A means of automating Heroku's pgbackups and archiving them to Amazon S3
|
133
133
|
via the fog gem.
|
134
134
|
test_files:
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
135
|
+
- test/ci/before_script.sh
|
136
|
+
- test/ci/ci_runner.sh
|
137
|
+
- test/lib/pgbackups-archive/heroku/client/pgbackups_archive_test.rb
|
138
|
+
- test/lib/pgbackups-archive/storage_test.rb
|
139
|
+
- test/minitest_helper.rb
|
140
|
+
- test/support/minitest_reporters.rb
|
141
|
+
- test/support/mocha.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "heroku/client"
|
3
|
-
|
4
|
-
describe Heroku::Client::PgbackupsArchive do
|
5
|
-
let(:archive) { Heroku::Client::PgbackupsArchive.new(:pgbackups_url => "https://ip:password@pgbackups.heroku.com/client") }
|
6
|
-
let(:backup) { { "finished_at" => "some timestamp" } }
|
7
|
-
|
8
|
-
it "should use a pgbackup client" do
|
9
|
-
archive.client.class.should eq Heroku::Client::Pgbackups
|
10
|
-
end
|
11
|
-
|
12
|
-
context "given a finished_at timestamp" do
|
13
|
-
before { archive.client.stub(:create_transfer).and_return(backup) }
|
14
|
-
|
15
|
-
it "should capture the backup" do
|
16
|
-
archive.capture.should eq backup
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should store the backup" do
|
20
|
-
archive.stub(:key).and_return("key")
|
21
|
-
archive.stub(:file).and_return("file")
|
22
|
-
archive.store.class.should eq Fog::Storage::AWS::File
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe PgbackupsArchive::Storage do
|
4
|
-
let(:connection) { Fog::Storage.new(:provider => "AWS", :aws_access_key_id => "XXX", :aws_secret_access_key => "YYY") }
|
5
|
-
let(:bucket) { connection.directories.create(:key => "someapp-backups") }
|
6
|
-
let(:key) { "pgbackups/test/2012-08-02-12-00-00.dump" }
|
7
|
-
let(:file) { "test" }
|
8
|
-
let(:storage) { PgbackupsArchive::Storage.new(key, file) }
|
9
|
-
|
10
|
-
before do
|
11
|
-
Fog.mock!
|
12
|
-
storage.stub(:connection).and_return(connection)
|
13
|
-
storage.stub(:bucket).and_return(bucket)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should create a fog connection" do
|
17
|
-
storage.connection.class.should eq Fog::Storage::AWS::Mock
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should create a fog directory" do
|
21
|
-
storage.bucket.class.should eq Fog::Storage::AWS::Directory
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should create a fog file" do
|
25
|
-
storage.store.class.should eq Fog::Storage::AWS::File
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Dir[File.dirname(__FILE__) + "/../lib/**/*.rb"].each { |f| require f }
|