├── VERSION ├── .document ├── lib ├── backup-task.rb └── tasks │ └── backup.rake ├── .gitignore ├── test ├── test_backup-task.rb └── helper.rb ├── Gemfile ├── LICENSE.txt ├── README.rdoc ├── Rakefile └── backup-task.gemspec /VERSION: -------------------------------------------------------------------------------- 1 | 0.2.0 -------------------------------------------------------------------------------- /.document: -------------------------------------------------------------------------------- 1 | lib/**/*.rb 2 | bin/* 3 | - 4 | features/**/*.feature 5 | LICENSE.txt 6 | -------------------------------------------------------------------------------- /lib/backup-task.rb: -------------------------------------------------------------------------------- 1 | class BackupTask < Rails::Railtie 2 | rake_tasks do 3 | Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f } 4 | end 5 | end 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | db/*.sqlite3 3 | log/*.log 4 | tmp/**/* 5 | *~ 6 | .*# 7 | \#* 8 | */\#* 9 | .#* 10 | /capybara-* 11 | Gemfile.lock 12 | pkg/**/* 13 | rdoc/**/* 14 | pkg 15 | rdoc 16 | -------------------------------------------------------------------------------- /lib/tasks/backup.rake: -------------------------------------------------------------------------------- 1 | namespace :db do 2 | desc "Back up the database" 3 | task :backup do 4 | sh "backup perform --trigger db_backup --config_file config/backup.rb --data-path db --log-path log --tmp-path tmp" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /test/test_backup-task.rb: -------------------------------------------------------------------------------- 1 | require 'helper' 2 | 3 | class TestBackupTask < Test::Unit::TestCase 4 | should "probably rename this file and start testing for real" do 5 | flunk "hey buddy, you should probably rename this file and start testing for real" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | # Add dependencies required to use your gem here. 3 | # Example: 4 | # gem "activesupport", ">= 2.3.5" 5 | 6 | # Add dependencies to develop your gem here. 7 | # Include everything needed to run rake, tests, features, etc. 8 | group :development do 9 | # gem "shoulda", ">= 0" 10 | gem "bundler", "~> 1.0.0" 11 | gem "jeweler", "~> 1.5.2" 12 | # gem "rcov", ">= 0" 13 | end 14 | -------------------------------------------------------------------------------- /test/helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | begin 4 | Bundler.setup(:default, :development) 5 | rescue Bundler::BundlerError => e 6 | $stderr.puts e.message 7 | $stderr.puts "Run `bundle install` to install missing gems" 8 | exit e.status_code 9 | end 10 | require 'test/unit' 11 | require 'shoulda' 12 | 13 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 14 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 15 | require 'backup-task' 16 | 17 | class Test::Unit::TestCase 18 | end 19 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Erik DeBill 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. 21 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = Backup Task 2 | 3 | A simple rake task for backing up a Rails 3 application's database using 4 | the Backup gem. 5 | 6 | == Using 7 | 8 | Add the gem to your Gemfile. 9 | 10 | gem 'backup-task' 11 | 12 | Create a backup configuration file in config/backup.rb, with a trigger called 13 | db_backup. See https://github.com/meskyanichi/backup/wiki/Getting-Started for 14 | details. Be sure to move the resulting file to config/backup.rb within your 15 | Rails app and to name your trigger 'db_backup'. 16 | 17 | Once you've done a 'bundle install' you should be able to run the backup task 18 | 19 | rake db:backup 20 | 21 | This will back up your database according to the configuration in 22 | config/backup.rb. It will use the tmp, log, and db directories from your 23 | Rails app to avoid conflicting with any other backups happening on the same 24 | system. 25 | 26 | == Fixing 27 | 28 | Bug reports, pull requests, etc are welcome at 29 | http://github.com/edebill/backup-task or you can email the 30 | author at erik@debill.org. 31 | 32 | 33 | 34 | == Copyright 35 | 36 | Copyright (c) 2011 Erik DeBill. See LICENSE.txt for 37 | further details. 38 | 39 | 40 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | begin 4 | Bundler.setup(:default, :development) 5 | rescue Bundler::BundlerError => e 6 | $stderr.puts e.message 7 | $stderr.puts "Run `bundle install` to install missing gems" 8 | exit e.status_code 9 | end 10 | require 'rake' 11 | 12 | require 'jeweler' 13 | Jeweler::Tasks.new do |gem| 14 | # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options 15 | gem.name = "backup-task" 16 | gem.homepage = "http://github.com/edebill/backup-task" 17 | gem.license = "MIT" 18 | gem.summary = %Q{db:backup rake task} 19 | gem.description = %Q{Provides a db:backup rake task designed to work within a Rails app.} 20 | gem.email = "erik@debill.org" 21 | gem.authors = ["Erik DeBill"] 22 | # Include your dependencies below. Runtime dependencies are required when using your gem, 23 | # and development dependencies are only needed for development (ie running rake tasks, tests, etc) 24 | gem.add_runtime_dependency 'backup', '~> 3.0.9' 25 | # gem.add_development_dependency 'rspec', '> 1.2.3' 26 | gem.files += Dir['lib/tasks/**/*.rake'] 27 | end 28 | Jeweler::RubygemsDotOrgTasks.new 29 | 30 | require 'rake/testtask' 31 | Rake::TestTask.new(:test) do |test| 32 | test.libs << 'lib' << 'test' 33 | test.pattern = 'test/**/test_*.rb' 34 | test.verbose = true 35 | end 36 | 37 | #require 'rcov/rcovtask' 38 | #Rcov::RcovTask.new do |test| 39 | # test.libs << 'test' 40 | # test.pattern = 'test/**/test_*.rb' 41 | # test.verbose = true 42 | #end 43 | 44 | task :default => :test 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 = "backup-task #{version}" 52 | rdoc.rdoc_files.include('README*') 53 | rdoc.rdoc_files.include('lib/**/*.rb') 54 | end 55 | -------------------------------------------------------------------------------- /backup-task.gemspec: -------------------------------------------------------------------------------- 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{backup-task} 8 | s.version = "0.2.0" 9 | 10 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 11 | s.authors = ["Erik DeBill"] 12 | s.date = %q{2011-03-26} 13 | s.description = %q{Provides a db:backup rake task designed to work within a Rails app.} 14 | s.email = %q{erik@debill.org} 15 | s.extra_rdoc_files = [ 16 | "LICENSE.txt", 17 | "README.rdoc" 18 | ] 19 | s.files = [ 20 | ".document", 21 | "Gemfile", 22 | "LICENSE.txt", 23 | "README.rdoc", 24 | "Rakefile", 25 | "VERSION", 26 | "lib/backup-task.rb", 27 | "lib/tasks/backup.rake", 28 | "test/helper.rb", 29 | "test/test_backup-task.rb" 30 | ] 31 | s.homepage = %q{http://github.com/edebill/backup-task} 32 | s.licenses = ["MIT"] 33 | s.require_paths = ["lib"] 34 | s.rubygems_version = %q{1.6.1} 35 | s.summary = %q{db:backup rake task} 36 | s.test_files = [ 37 | "test/helper.rb", 38 | "test/test_backup-task.rb" 39 | ] 40 | 41 | if s.respond_to? :specification_version then 42 | s.specification_version = 3 43 | 44 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then 45 | s.add_development_dependency(%q, ["~> 1.0.0"]) 46 | s.add_development_dependency(%q, ["~> 1.5.2"]) 47 | s.add_runtime_dependency(%q, ["~> 3.0.9"]) 48 | else 49 | s.add_dependency(%q, ["~> 1.0.0"]) 50 | s.add_dependency(%q, ["~> 1.5.2"]) 51 | s.add_dependency(%q, ["~> 3.0.9"]) 52 | end 53 | else 54 | s.add_dependency(%q, ["~> 1.0.0"]) 55 | s.add_dependency(%q, ["~> 1.5.2"]) 56 | s.add_dependency(%q, ["~> 3.0.9"]) 57 | end 58 | end 59 | 60 | --------------------------------------------------------------------------------