Sha256: 20a72ef0b42277cad63b56b630aaaced2e56cbb0b8d04c39812803c2729e50bb

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require 'fileutils'
Capistrano::Configuration.instance(:must_exist).load do
 
 namespace :svn do
 
   desc "Setup svn repository"
   task :setup, :roles => :scm do
     dir = "#{deploy_to}/repos"
     run "mkdir -p #{dir}"
     run "chmod 770 #{dir}"
     run "svnadmin create #{dir}"
   end
   
   desc "Import code into svn repository."
   task :import  do
     new_path = Dir.pwd + "_machine"
     tags = repository.sub("trunk", "tags")
     branches = repository.sub("trunk", "branches")
     puts "Adding branches and tags"
     system "svn mkdir -m 'Adding tags and branches directories' #{tags} #{branches}"
     puts "Importing application."
     system "svn import #{repository} -m 'Import'"
     puts "Checking out to new directory."
     system "svn co #{repository} #{new_path}"
     cwd = Dir.getwd
     Dir.chdir new_path
     puts "removing log directory contents from svn"
     system "svn remove log/*"
     puts "ignoring log directory"
     system "svn propset svn:ignore '*.log' log/"
     system "svn update log/"
     puts "removing tmp directory from svn"
     system "svn remove tmp/"
     puts "ignoring tmp directory"
     system "svn propset svn:ignore '*' tmp/"
     system "svn update tmp/"
     puts "committing changes"
     system "svn commit -m 'Removed and ignored log files and tmp'"
     Dir.chdir cwd
     puts "Your repository is: #{repository}" 
     puts "Please change to your new working directory: #{new_path}"
   end
 
 end
 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsmachine-1.0.1 lib/railsmachine/recipes/svn.rb
railsmachine-1.0.0 lib/railsmachine/recipes/svn.rb