Namespace
Methods
E
L
N
Attributes
[R] new_dir
[R] old_dir
[R] project
Class Public methods
new(project, old_dir, new_dir)
# File lib/gitlab/project_mover.rb, line 10
def initialize(project, old_dir, new_dir)
  @project = project
  @old_dir = old_dir
  @new_dir = new_dir
end
Instance Public methods
execute()
# File lib/gitlab/project_mover.rb, line 16
def execute
  # Create new dir if missing
  new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir)
  system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path)

  old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
  new_path = File.join(new_dir_path, "#{project.path}.git")

  if File.exists? new_path
    raise ProjectMoveError.new("Destination #{new_path} already exists")
  end

  if system("mv #{old_path} #{new_path}")
    log_info "Project #{project.name} was moved from #{old_path} to #{new_path}"
    true
  else
    message = "Project #{project.name} cannot be moved from #{old_path} to #{new_path}"
    log_info "Error! #{message}"
    raise ProjectMoveError.new(message)
  end
end
Instance Protected methods
log_info(message)
# File lib/gitlab/project_mover.rb, line 40
def log_info message
  Gitlab::AppLogger.info message
end