class Gitlab::Satellite

Constants

PARKING_BRANCH

Attributes

project[RW]

Public Class Methods

new(project) click to toggle source
# File lib/gitlab/satellite.rb, line 8
def initialize project
  self.project = project
end

Public Instance Methods

clear() click to toggle source

will be deleted all branches except PARKING_BRANCH

# File lib/gitlab/satellite.rb, line 25
def clear
  Dir.chdir(path) do
    heads = Grit::Repo.new(".").heads.map{|head| head.name}
    if heads.include? PARKING_BRANCH
      %xgit checkout #{PARKING_BRANCH}`
    else
      %xgit checkout -b #{PARKING_BRANCH}`
    end
    heads.delete(PARKING_BRANCH)
    heads.each do |head|
      %xgit branch -D #{head}`
    end
  end
end
create() click to toggle source
# File lib/gitlab/satellite.rb, line 12
def create
  %xgit clone #{project.url_to_repo} #{path}`
end
exists?() click to toggle source
# File lib/gitlab/satellite.rb, line 20
def exists?
  File.exists? path
end
path() click to toggle source
# File lib/gitlab/satellite.rb, line 16
def path
  Rails.root.join("tmp", "repo_satellites", project.path)
end