Class: Golem::Command::CreateRepository
- Includes:
- ManageHooks
- Defined in:
- lib/golem/command/create_repository.rb
Overview
Command for creating a repository.
Instance Method Summary collapse
-
#run(name) ⇒ Object
Run the command.
Methods included from ManageHooks
Methods inherited from Base
#command, #initialize, #verbose?
Constructor Details
This class inherits a constructor from Golem::Command::Base
Instance Method Details
#run(name) ⇒ Object
Run the command. Installs hooks with ManageHooks#install_hooks.
9 10 11 12 13 14 15 16 17 18 19 |
# 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 |