Changeset 497

Show
Ignore:
Timestamp:
06/16/08 14:58:30 (5 months ago)
Author:
mbailey
Message:

added gitosis recipes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/deprec/recipes.rb

    r495 r497  
    3232require "#{File.dirname(__FILE__)}/recipes/utils" 
    3333require "#{File.dirname(__FILE__)}/recipes/git" 
     34require "#{File.dirname(__FILE__)}/recipes/gitosis" 
  • trunk/lib/deprec/recipes/git.rb

    r495 r497  
    2828        deprec2.download_src(SRC_PACKAGES[:git], src_dir) 
    2929        deprec2.install_from_src(SRC_PACKAGES[:git], src_dir) 
    30         create_git_root 
    31         create_git_user 
     30        # create_git_root 
     31        # create_git_user 
    3232      end 
    3333 
     
    3636        apt.install( {:base => %w(zlib1g-dev gettext)}, :stable ) 
    3737      end 
    38  
    39  
    4038 
    4139      desc "Grant user ssh access to git" 
     
    9593       
    9694      task :create_remote do 
     95         
     96        # Create local git repo if missing 
    9797        if ! File.directory?('.git') 
    9898          system('git init') 
     
    101101          system("git add . && git commit -m 'initial import'") 
    102102        end 
    103         tempfile = "/tmp/#{application}.git" 
    104         destination = "#{git_root}/#{application}" 
    105         sudo "test -d #{tempfile} && mv /tmp/#{application}.git /tmp/#{application}.git-old; exit 0" 
    106         upload ".git", tempfile 
    107         sudo "mv  #{tempfile} #{destination}" 
    108         sudo "chown -R #{git_user}.#{git_group} #{destination}"   
     103          
     104        # Push to remote git repo 
    109105        hostname = capture "echo $CAPISTRANO:HOST$" 
     106        system "git remote add origin git@#{hostname.chomp}:#{application}" 
     107        system "git push origin master:refs/heads/master" 
     108         
    110109        puts  
    111         puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{destination}" 
    112         puts       
     110        puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{application}" 
     111        puts     
     112         
     113        # Probably want to add this to .git/config 
     114        # 
     115        puts 'Add the following to .git/config' 
     116        puts '[branch "master"]' 
     117        puts ' remote = origin' 
     118        puts ' merge = refs/heads/master' 
     119           
    113120      end 
    114121       
     
    139146      end 
    140147       
    141       task :create_git_user do 
    142         deprec2.groupadd(git_group)  
    143         deprec2.useradd(git_user, :group => git_group, :shell => '/usr/local/bin/git-shell') 
    144         # Set the primary group for the git user (in case user already existed 
    145         # when previous command was run) 
    146         sudo "usermod --gid #{git_group} #{git_user}" 
    147         sudo "passwd --unlock #{git_user}" 
    148       end 
     148      # task :create_git_user do 
     149      #   deprec2.groupadd(git_group)  
     150      #   deprec2.useradd(git_user, :group => git_group, :shell => '/usr/local/bin/git-shell') 
     151      #   # Set the primary group for the git user (in case user already existed 
     152      #   # when previous command was run) 
     153      #   sudo "usermod --gid #{git_group} #{git_user}" 
     154      #   sudo "passwd --unlock #{git_user}" 
     155      # end 
    149156       
    150157      # regenerate git authorized keys file from users file in same dir