ey_db_backup 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +51 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +39 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/bin/ey_db_backup +7 -0
- data/config/.DS_Store +0 -0
- data/config/cucumber.yml +11 -0
- data/ey_db_backup.gemspec +97 -0
- data/features/.DS_Store +0 -0
- data/features/export.feature +10 -0
- data/features/step_definitions/.DS_Store +0 -0
- data/features/step_definitions/db_export_steps.rb +26 -0
- data/features/support/env.rb +14 -0
- data/lib/ey_db_backup.rb +2 -0
- data/lib/ey_db_backup/aws_configuration.rb +17 -0
- data/lib/ey_db_backup/database_export.rb +39 -0
- data/most_recent_backup +1 -0
- data/most_recent_file +1 -0
- data/pkg/Engine Yard Database Import-0.1.0.gem +0 -0
- data/pkg/ey_db_backup-0.2.0.gem +0 -0
- data/pkg/ey_db_import-0.1.0.gem +0 -0
- data/pkg/ey_db_import-0.2.0.gem +0 -0
- data/spec/ey_db_import_spec.rb +7 -0
- data/spec/spec_helper.rb +18 -0
- data/test/aww_yeah +1 -0
- data/test/chellocat.jpg +0 -0
- data/test/most_recent_backup +1 -0
- data/tmp/mock-aws-s3/bucket/abc123 +1 -0
- data/tmp/mock-aws-s3/bucket/backup_db +1 -0
- metadata +187 -0
data/.DS_Store
ADDED
Binary file
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "thor"
|
6
|
+
gem "aws-s3"
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "rspec", "~> 2.3.0"
|
11
|
+
gem "cucumber", ">= 0"
|
12
|
+
gem "bundler", "~> 1.0.0"
|
13
|
+
gem "jeweler", "~> 1.6.4"
|
14
|
+
gem "rcov", ">= 0"
|
15
|
+
gem "mock-aws-s3"
|
16
|
+
gem "aws-s3"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
aws-s3 (0.6.2)
|
5
|
+
builder
|
6
|
+
mime-types
|
7
|
+
xml-simple
|
8
|
+
builder (3.0.0)
|
9
|
+
cucumber (1.0.2)
|
10
|
+
builder (>= 2.1.2)
|
11
|
+
diff-lcs (>= 1.1.2)
|
12
|
+
gherkin (~> 2.4.5)
|
13
|
+
json (>= 1.4.6)
|
14
|
+
term-ansicolor (>= 1.0.5)
|
15
|
+
diff-lcs (1.1.2)
|
16
|
+
gherkin (2.4.5)
|
17
|
+
json (>= 1.4.6)
|
18
|
+
git (1.2.5)
|
19
|
+
jeweler (1.6.4)
|
20
|
+
bundler (~> 1.0)
|
21
|
+
git (>= 1.2.5)
|
22
|
+
rake
|
23
|
+
json (1.5.3)
|
24
|
+
mime-types (1.16)
|
25
|
+
mock-aws-s3 (0.6.0)
|
26
|
+
rake (0.9.2)
|
27
|
+
rcov (0.9.9)
|
28
|
+
rspec (2.3.0)
|
29
|
+
rspec-core (~> 2.3.0)
|
30
|
+
rspec-expectations (~> 2.3.0)
|
31
|
+
rspec-mocks (~> 2.3.0)
|
32
|
+
rspec-core (2.3.1)
|
33
|
+
rspec-expectations (2.3.0)
|
34
|
+
diff-lcs (~> 1.1.2)
|
35
|
+
rspec-mocks (2.3.0)
|
36
|
+
term-ansicolor (1.0.6)
|
37
|
+
thor (0.14.6)
|
38
|
+
xml-simple (1.1.0)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
aws-s3
|
45
|
+
bundler (~> 1.0.0)
|
46
|
+
cucumber
|
47
|
+
jeweler (~> 1.6.4)
|
48
|
+
mock-aws-s3
|
49
|
+
rcov
|
50
|
+
rspec (~> 2.3.0)
|
51
|
+
thor
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Brett Chalupa
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
== Engine Yard Database Backup
|
2
|
+
|
3
|
+
Engine Yard Database Backup is used to backup the latest database backup from Amazon's S3 service.
|
4
|
+
This gem downloads the latest file in the bucket you specify in your AWS S3 account.
|
5
|
+
This backup utility is to make sure there is a recent backup of the database incase Amazon's S3 service goes down and you need access to your data.
|
6
|
+
|
7
|
+
== Setting up and using the Engine Yard Database Backup gem
|
8
|
+
1. <tt>gem install ey_db_export</tt>
|
9
|
+
2. Create the directory <tt>config</tt> within the local directory you are running the gem in.
|
10
|
+
3. Create a YAML file <tt>config.yml</tt> structured as below:
|
11
|
+
<tt>
|
12
|
+
access_key_id: "put your access key id here"
|
13
|
+
secret_access_key: "put your secret access key here"
|
14
|
+
bucket_name: "put the bucket name here"
|
15
|
+
export_path: "put the location you want to export the file to here (e.g. documents/db_exports/)"
|
16
|
+
</tt>
|
17
|
+
4. Simply run <tt>ey_db_backup run_export</tt> to download the latest file in the bucket you specified to the directory you specified.
|
18
|
+
|
19
|
+
== Configuring Engine Yard Databse Backup for Development
|
20
|
+
|
21
|
+
1. Fork this project.
|
22
|
+
2. Create the config file as described above.
|
23
|
+
3. Code away!
|
24
|
+
|
25
|
+
== Contributing to ey_db_export
|
26
|
+
|
27
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
28
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
29
|
+
* Fork the project
|
30
|
+
* Start a feature/bugfix branch
|
31
|
+
* Commit and push until you are happy with your contribution
|
32
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
33
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
34
|
+
|
35
|
+
== Copyright
|
36
|
+
|
37
|
+
Copyright (c) 2011 Brett Chalupa. See LICENSE.txt for
|
38
|
+
further details.
|
39
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
# require 'yaml'
|
15
|
+
|
16
|
+
require 'jeweler'
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
19
|
+
gem.name = "ey_db_backup"
|
20
|
+
gem.homepage = "http://github.com/brettchalupa/ey_db_backup"
|
21
|
+
gem.license = "MIT"
|
22
|
+
gem.summary = %Q{Gem interacts with Amazon's S3 service to import the latest database backup.}
|
23
|
+
gem.description = %Q{This gem interacts with Amazon's S3 service to give the user the ability to backup their database and store it elsewhere in case S3 experiences an outage. This gem should allow the user to easily automate the process of grabbing the most recent database from S3.}
|
24
|
+
gem.email = "brettchalupa@gmail.com"
|
25
|
+
gem.authors = ["Brett Chalupa"]
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rspec/core'
|
31
|
+
require 'rspec/core/rake_task'
|
32
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
37
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
38
|
+
spec.rcov = true
|
39
|
+
end
|
40
|
+
|
41
|
+
require 'cucumber/rake/task'
|
42
|
+
Cucumber::Rake::Task.new(:features)
|
43
|
+
|
44
|
+
task :default => :spec
|
45
|
+
|
46
|
+
require 'rake/rdoctask'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "ey_db_backup #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/bin/ey_db_backup
ADDED
data/config/.DS_Store
ADDED
Binary file
|
data/config/cucumber.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
# CUCUMBER=true sets a env variable that we used to differentiate between test and cucumber environments.
|
7
|
+
# This is particularly useful when we want to not loop in test be do in cucumber.
|
8
|
+
default: CUCUMBER=true <%= std_opts %> features
|
9
|
+
wip: CUCUMBER=true --tags @wip:10 --wip features
|
10
|
+
rerun: CUCUMBER=true <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
11
|
+
guard: CUCUMBER=true --format progress
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ey_db_backup}
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Brett Chalupa"]
|
12
|
+
s.date = %q{2011-08-17}
|
13
|
+
s.default_executable = %q{ey_db_backup}
|
14
|
+
s.description = %q{This gem interacts with Amazon's S3 service to give the user the ability to backup their database and store it elsewhere in case S3 experiences an outage. This gem should allow the user to easily automate the process of grabbing the most recent database from S3.}
|
15
|
+
s.email = %q{brettchalupa@gmail.com}
|
16
|
+
s.executables = ["ey_db_backup"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".DS_Store",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/ey_db_backup",
|
30
|
+
"config/.DS_Store",
|
31
|
+
"config/cucumber.yml",
|
32
|
+
"ey_db_backup.gemspec",
|
33
|
+
"features/.DS_Store",
|
34
|
+
"features/export.feature",
|
35
|
+
"features/step_definitions/.DS_Store",
|
36
|
+
"features/step_definitions/db_export_steps.rb",
|
37
|
+
"features/support/env.rb",
|
38
|
+
"lib/ey_db_backup.rb",
|
39
|
+
"lib/ey_db_backup/aws_configuration.rb",
|
40
|
+
"lib/ey_db_backup/database_export.rb",
|
41
|
+
"most_recent_backup",
|
42
|
+
"most_recent_file",
|
43
|
+
"pkg/Engine Yard Database Import-0.1.0.gem",
|
44
|
+
"pkg/ey_db_backup-0.2.0.gem",
|
45
|
+
"pkg/ey_db_import-0.1.0.gem",
|
46
|
+
"pkg/ey_db_import-0.2.0.gem",
|
47
|
+
"spec/ey_db_import_spec.rb",
|
48
|
+
"spec/spec_helper.rb",
|
49
|
+
"test/aww_yeah",
|
50
|
+
"test/chellocat.jpg",
|
51
|
+
"test/most_recent_backup",
|
52
|
+
"tmp/mock-aws-s3/bucket/abc123",
|
53
|
+
"tmp/mock-aws-s3/bucket/backup_db"
|
54
|
+
]
|
55
|
+
s.homepage = %q{http://github.com/brettchalupa/ey_db_backup}
|
56
|
+
s.licenses = ["MIT"]
|
57
|
+
s.require_paths = ["lib"]
|
58
|
+
s.rubygems_version = %q{1.6.2}
|
59
|
+
s.summary = %q{Gem interacts with Amazon's S3 service to import the latest database backup.}
|
60
|
+
|
61
|
+
if s.respond_to? :specification_version then
|
62
|
+
s.specification_version = 3
|
63
|
+
|
64
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
66
|
+
s.add_runtime_dependency(%q<aws-s3>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
68
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
71
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
72
|
+
s.add_development_dependency(%q<mock-aws-s3>, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<aws-s3>, [">= 0"])
|
74
|
+
else
|
75
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
76
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
78
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
79
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
80
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
81
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
82
|
+
s.add_dependency(%q<mock-aws-s3>, [">= 0"])
|
83
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
84
|
+
end
|
85
|
+
else
|
86
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
87
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
88
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
89
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
90
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
91
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
92
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
93
|
+
s.add_dependency(%q<mock-aws-s3>, [">= 0"])
|
94
|
+
s.add_dependency(%q<aws-s3>, [">= 0"])
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
data/features/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Exporting database from Engine Yard
|
2
|
+
As a developer
|
3
|
+
I want to export the latest database from Engine Yard
|
4
|
+
So that I have a backup of the database hosted on another server that isn't Amazon's S3
|
5
|
+
|
6
|
+
Scenario: Successfully downloading the database
|
7
|
+
Given I have Amazon S3 credentials located in a file
|
8
|
+
And I have a database backup on Amazon S3
|
9
|
+
When I run the script to export the database
|
10
|
+
Then I should have successfully exported the database to my local directory
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'aws/s3'
|
2
|
+
|
3
|
+
Given /^I have Amazon S(\d+) credentials located in a file$/ do |arg1|
|
4
|
+
File.exists?("config/config.yml")
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^I have a database backup on Amazon S(\d+)$/ do |arg1|
|
8
|
+
@aws_config = AWSConfiguration.new
|
9
|
+
@aws_config.read_from_yaml
|
10
|
+
|
11
|
+
AWS::S3::Base.establish_connection!(
|
12
|
+
:access_key_id => @aws_config.access_key_id ,
|
13
|
+
:secret_access_key => @aws_config.secret_access_key
|
14
|
+
)
|
15
|
+
|
16
|
+
AWS::S3::S3Object.store 'aww_yeah', 'awwwww yeah', 'bc_images'
|
17
|
+
end
|
18
|
+
|
19
|
+
When /^I run the script to export the database$/ do
|
20
|
+
DatabaseExport.new.run_export
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^I should have successfully exported the database to my local directory$/ do
|
24
|
+
File.exists?('test/aww_yeah')
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
11
|
+
require 'ey_db_backup'
|
12
|
+
|
13
|
+
require 'rspec/expectations'
|
14
|
+
|
data/lib/ey_db_backup.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
class AWSConfiguration
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
attr_accessor :access_key_id
|
5
|
+
attr_accessor :secret_access_key
|
6
|
+
attr_accessor :bucket_name
|
7
|
+
attr_accessor :export_path
|
8
|
+
|
9
|
+
def read_from_yaml
|
10
|
+
s3_credentials_yml = YAML.load_file("config/config.yml")
|
11
|
+
@access_key_id = s3_credentials_yml["access_key_id"]
|
12
|
+
@secret_access_key = s3_credentials_yml["secret_access_key"]
|
13
|
+
@bucket_name = s3_credentials_yml["bucket_name"]
|
14
|
+
@export_path = s3_credentials_yml["export_path"]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'aws/s3'
|
2
|
+
require 'thor'
|
3
|
+
|
4
|
+
class DatabaseExport < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
desc "run_export", "Exports EY database backup to local machine"
|
8
|
+
def run_export
|
9
|
+
|
10
|
+
aws_config = AWSConfiguration.new
|
11
|
+
aws_config.read_from_yaml
|
12
|
+
|
13
|
+
AWS::S3::Base.establish_connection!(
|
14
|
+
:access_key_id => aws_config.access_key_id ,
|
15
|
+
:secret_access_key => aws_config.secret_access_key
|
16
|
+
)
|
17
|
+
|
18
|
+
bucket_name = aws_config.bucket_name
|
19
|
+
export_path = aws_config.export_path
|
20
|
+
|
21
|
+
bucket_files = AWS::S3::Bucket.objects(bucket_name)
|
22
|
+
|
23
|
+
|
24
|
+
most_recent = bucket_files[0]
|
25
|
+
|
26
|
+
bucket_files.each do |n|
|
27
|
+
if n.about["last-modified"] > most_recent.about["last-modified"]
|
28
|
+
most_recent = n
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
open("#{export_path}#{most_recent.key}", 'w') do |file|
|
33
|
+
file.write(AWS::S3::S3Object.stream(most_recent.key, bucket_name))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
DatabaseExport.start
|
39
|
+
|
data/most_recent_backup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
this is the most recent backup
|
data/most_recent_file
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
this is the most recent
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'ey_db_backup'
|
5
|
+
|
6
|
+
require 'mock-aws-s3'
|
7
|
+
|
8
|
+
require 'aws/s3'
|
9
|
+
require 'aws-s3'
|
10
|
+
|
11
|
+
# Requires supporting files with custom matchers and macros, etc,
|
12
|
+
# in ./support/ and its subdirectories.
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
|
17
|
+
end
|
18
|
+
|
data/test/aww_yeah
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
awwwww yeah
|
data/test/chellocat.jpg
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
this is the most recent backup
|
@@ -0,0 +1 @@
|
|
1
|
+
some data
|
@@ -0,0 +1 @@
|
|
1
|
+
some data
|
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ey_db_backup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brett Chalupa
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-08-17 00:00:00.000000000 -04:00
|
13
|
+
default_executable: ey_db_backup
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
requirement: &70251781181060 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70251781181060
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: aws-s3
|
28
|
+
requirement: &70251781180360 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70251781180360
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
requirement: &70251781179760 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.3.0
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70251781179760
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: cucumber
|
50
|
+
requirement: &70251781179180 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70251781179180
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: bundler
|
61
|
+
requirement: &70251781178640 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 1.0.0
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70251781178640
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: jeweler
|
72
|
+
requirement: &70251781178060 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.6.4
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *70251781178060
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rcov
|
83
|
+
requirement: &70251781177560 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *70251781177560
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: mock-aws-s3
|
94
|
+
requirement: &70251781177060 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *70251781177060
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: aws-s3
|
105
|
+
requirement: &70251781176560 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *70251781176560
|
114
|
+
description: This gem interacts with Amazon's S3 service to give the user the ability
|
115
|
+
to backup their database and store it elsewhere in case S3 experiences an outage.
|
116
|
+
This gem should allow the user to easily automate the process of grabbing the most
|
117
|
+
recent database from S3.
|
118
|
+
email: brettchalupa@gmail.com
|
119
|
+
executables:
|
120
|
+
- ey_db_backup
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files:
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.rdoc
|
125
|
+
files:
|
126
|
+
- .DS_Store
|
127
|
+
- Gemfile
|
128
|
+
- Gemfile.lock
|
129
|
+
- LICENSE.txt
|
130
|
+
- README.rdoc
|
131
|
+
- Rakefile
|
132
|
+
- VERSION
|
133
|
+
- bin/ey_db_backup
|
134
|
+
- config/.DS_Store
|
135
|
+
- config/cucumber.yml
|
136
|
+
- ey_db_backup.gemspec
|
137
|
+
- features/.DS_Store
|
138
|
+
- features/export.feature
|
139
|
+
- features/step_definitions/.DS_Store
|
140
|
+
- features/step_definitions/db_export_steps.rb
|
141
|
+
- features/support/env.rb
|
142
|
+
- lib/ey_db_backup.rb
|
143
|
+
- lib/ey_db_backup/aws_configuration.rb
|
144
|
+
- lib/ey_db_backup/database_export.rb
|
145
|
+
- most_recent_backup
|
146
|
+
- most_recent_file
|
147
|
+
- pkg/Engine Yard Database Import-0.1.0.gem
|
148
|
+
- pkg/ey_db_backup-0.2.0.gem
|
149
|
+
- pkg/ey_db_import-0.1.0.gem
|
150
|
+
- pkg/ey_db_import-0.2.0.gem
|
151
|
+
- spec/ey_db_import_spec.rb
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
- test/aww_yeah
|
154
|
+
- test/chellocat.jpg
|
155
|
+
- test/most_recent_backup
|
156
|
+
- tmp/mock-aws-s3/bucket/abc123
|
157
|
+
- tmp/mock-aws-s3/bucket/backup_db
|
158
|
+
has_rdoc: true
|
159
|
+
homepage: http://github.com/brettchalupa/ey_db_backup
|
160
|
+
licenses:
|
161
|
+
- MIT
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ! '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
hash: 3508712277983148536
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
requirements: []
|
182
|
+
rubyforge_project:
|
183
|
+
rubygems_version: 1.6.2
|
184
|
+
signing_key:
|
185
|
+
specification_version: 3
|
186
|
+
summary: Gem interacts with Amazon's S3 service to import the latest database backup.
|
187
|
+
test_files: []
|