class Golem::Command::CreateRepository
Command for creating a repository.
Constants
- USAGE
@private
Public Instance Methods
run(name)
click to toggle source
Run the command. Installs hooks with {#install_hooks}. @param [String] name repository name.
# File lib/golem/command/create_repository.rb, line 9 def run(name) path = Golem::Config.repository_path(name) abort "Repository already exists!" if File.directory?(path) pwd = Dir.pwd Dir.mkdir(path, 0700) Dir.chdir(path) system('git --bare init ' + (verbose? ? '>&2' : '>/dev/null 2>&1')) print "Repository #{path} created, installing hooks...\n" if verbose? install_hooks(name) Dir.chdir(pwd) end