class GemHadar

def master_prepare_task

to the local project.
account details to configure the repository and establish a connection back
server via SSH. It prompts for the remote name, directory path, and SSH
guides the user through creating a new bare Git repository on a remote
This method creates a :master:prepare task under the Rake namespace that

Git repository for the project.
The master_prepare_task method defines a Rake task that sets up a remote
def master_prepare_task
  namespace :master do
    desc "Prepare a remote git repository for this project"
    task :prepare do
      puts "Create a new remote git repository for #{name.inspect}"
      remote_name = ask?('Name (default: origin) ? ', /^.+$/).
        full?(:[], 0) || 'origin'
      dir         = ask?("Directory (default: /git/#{name}.git)? ", /^.+$/).
        full?(:[], 0) || "/git/#{name}.git"
      ssh_account = ask?('SSH account (format: login@host)? ', /^[^@]+@[^@]+/).
        full?(:[], 0) || exit(1)
      sh "ssh #{ssh_account} 'git init --bare #{dir}'"
      sh "git remote add -m master #{remote_name} #{ssh_account}:#{dir}"
    end
  end
end