Sha256: 422eb396fd116321bc122246d19ce40726b8c3b17235c9b49fba81d69b9cfa01

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

namespace :backup do
  namespace :setup do
    desc "Automatically sets up Capistrano Structure for you!"
    task :capistrano => :environment do
      puts 'Looking for shared path!'
      if File.directory?("../../shared") then
        puts 'Found shared path!'
        puts 'Looking for db folder in shared path!'
      	unless File.directory?("../../shared/db") then
          puts 'Cound not find db folder in shared path! Creating it now!'
      		%x{ mkdir -p ../../shared/db }
      	else
      	  puts 'Found db folder in shared path!'
      	end
	      
	      puts 'Looking for backup.sqlite3 in shared/db path!'
	      unless File.exist?("../../shared/db/backup.sqlite3") then
	        puts 'Could not find, creating it now!'
	        %x{ cp #{RAILS_ROOT}/lib/tasks/backup/files/backup.sqlite3 ../../shared/db/backup.sqlite3 }
        else
          puts "backup.sqlite3 already exists in the shared/db folder! Skipping backup.sqlite3 creation!"
        end
	        %x{ ln -nfs #{RAILS_ROOT}/../../shared/db/backup.sqlite3 #{RAILS_ROOT}/db/backup.sqlite3 }
	        puts "Set up a symbolic link to the backup.sqlite3 inside #{RAILS_ROOT}/db/ folder!"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backup-1.3.4 generators/backup_files/templates/setup.rake
backup-1.3.3 generators/backup_files/templates/setup.rake
backup-1.3.2 generators/backup_files/templates/setup.rake
backup-1.3.1 generators/backup_files/templates/setup.rake