Methods
Constants
PARKING_BRANCH | = | "__parking_branch" |
Attributes
[RW] | project |
Class Public methods
new(project)
Link
Source: show
# File lib/gitlab/satellite/satellite.rb, line 8 def initialize(project) @project = project end
Instance Public methods
clear_and_update!()
Link
Source: show
# File lib/gitlab/satellite/satellite.rb, line 12 def clear_and_update! raise "Satellite doesn't exist" unless exists? delete_heads! clear_working_dir! update_from_source! end
create()
Link
Source: show
# File lib/gitlab/satellite/satellite.rb, line 20 def create create_cmd = "git clone #{project.url_to_repo} #{path}" if system(create_cmd) true else Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}") false end end
exists?()
Link
Source: show
# File lib/gitlab/satellite/satellite.rb, line 30 def exists? File.exists? path end
lock()
Link
-
Locks the satellite
-
Changes the current directory to the satellite’s working dir
-
Yields
Source: show
# File lib/gitlab/satellite/satellite.rb, line 37 def lock raise "Satellite doesn't exist" unless exists? File.open(lock_file, "w+") do |f| f.flock(File::LOCK_EX) Dir.chdir(path) do return yield end end end
lock_file()
Link
Source: show
# File lib/gitlab/satellite/satellite.rb, line 49 def lock_file Rails.root.join("tmp", "satellite_#{project.id}.lock") end