Sha256: 6d0ad753ef971644268bd9b5f8df047daa34e7e5bbf05bc0005e60679d8d2a7e

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

require 'fileutils'
Capistrano::Configuration.instance(:must_exist).load do
 
  namespace :localrepo do
     
    desc "Setup directory structure and initialize git repository on remote server"
    task :setup, :roles => :scm do
      dir =  "#{deploy_to}/repos/#{application}.git"
      run   "mkdir -p #{dir}"
      sudo  "chown -R #{user}:#{user} #{dir}"
      run   "cd #{dir} && git --bare init"
      run   "chmod 770 #{dir}"
    end

    desc "Import code into remote git repository."
    task :import  do
      puts    "Initializing local git repository"
      system  "git init"

      puts    "Adding remote server pointing to #{repository}"
      system  "git remote add origin #{repository}"

      puts "Adding .gitignore file"
      system "echo 'log/*'>> .gitignore"
      system "echo 'tmp/*'>> .gitignore"
      system "echo '.DS_Store'>> .gitignore"
      system "echo 'public/cache/**/*'>> .gitignore"
      system "git add .gitignore"

      puts "Committing application locally"
      system "git add *"
      system 'git commit -a -v -m "initial import of site"'

      puts "Pushing application to the remote server.  The name of the branch is:"
      system  "git remote"
      system  "git push origin master"
    
      puts "git setup complete"
      puts "You can clone this repository with git clone #{repository} #{application}"
    end
 
  end
 
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
railsmachine-railsmachine-1.0.3 lib/railsmachine/recipes/scm/git.rb
railsmachine-railsmachine-1.0.4 lib/railsmachine/recipes/scm/git.rb
railsmachine-1.0.3 lib/railsmachine/recipes/scm/git.rb
railsmachine-1.0.4 lib/railsmachine/recipes/scm/git.rb