Commit fba8ad560797500063df84089a99c24fdc5cacd7
1 parent
5f166878
Exists in
master
and in
4 other branches
Move Gitlab::Satellite into the Satellite module
Showing
3 changed files
with
42 additions
and
41 deletions
Show diff stats
app/roles/repository.rb
lib/gitlab/satellite.rb
| ... | ... | @@ -1,40 +0,0 @@ |
| 1 | -module Gitlab | |
| 2 | - class Satellite | |
| 3 | - | |
| 4 | - PARKING_BRANCH = "__parking_branch" | |
| 5 | - | |
| 6 | - attr_accessor :project | |
| 7 | - | |
| 8 | - def initialize(project) | |
| 9 | - @project = project | |
| 10 | - end | |
| 11 | - | |
| 12 | - #will be deleted all branches except PARKING_BRANCH | |
| 13 | - def clear | |
| 14 | - Dir.chdir(path) do | |
| 15 | - heads = Grit::Repo.new(".").heads.map{|head| head.name} | |
| 16 | - if heads.include? PARKING_BRANCH | |
| 17 | - `git checkout #{PARKING_BRANCH}` | |
| 18 | - else | |
| 19 | - `git checkout -b #{PARKING_BRANCH}` | |
| 20 | - end | |
| 21 | - heads.delete(PARKING_BRANCH) | |
| 22 | - heads.each do |head| | |
| 23 | - `git branch -D #{head}` | |
| 24 | - end | |
| 25 | - end | |
| 26 | - end | |
| 27 | - | |
| 28 | - def create | |
| 29 | - `git clone #{project.url_to_repo} #{path}` | |
| 30 | - end | |
| 31 | - | |
| 32 | - def exists? | |
| 33 | - File.exists? path | |
| 34 | - end | |
| 35 | - | |
| 36 | - def path | |
| 37 | - Rails.root.join("tmp", "repo_satellites", project.path) | |
| 38 | - end | |
| 39 | - end | |
| 40 | -end |
| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | +module Gitlab | |
| 2 | + module Satellite | |
| 3 | + class Satellite | |
| 4 | + PARKING_BRANCH = "__parking_branch" | |
| 5 | + | |
| 6 | + attr_accessor :project | |
| 7 | + | |
| 8 | + def initialize(project) | |
| 9 | + @project = project | |
| 10 | + end | |
| 11 | + | |
| 12 | + #will be deleted all branches except PARKING_BRANCH | |
| 13 | + def clear | |
| 14 | + Dir.chdir(path) do | |
| 15 | + heads = Grit::Repo.new(".").heads.map{|head| head.name} | |
| 16 | + if heads.include? PARKING_BRANCH | |
| 17 | + `git checkout #{PARKING_BRANCH}` | |
| 18 | + else | |
| 19 | + `git checkout -b #{PARKING_BRANCH}` | |
| 20 | + end | |
| 21 | + heads.delete(PARKING_BRANCH) | |
| 22 | + heads.each do |head| | |
| 23 | + `git branch -D #{head}` | |
| 24 | + end | |
| 25 | + end | |
| 26 | + end | |
| 27 | + | |
| 28 | + def create | |
| 29 | + `git clone #{project.url_to_repo} #{path}` | |
| 30 | + end | |
| 31 | + | |
| 32 | + def exists? | |
| 33 | + File.exists? path | |
| 34 | + end | |
| 35 | + | |
| 36 | + def path | |
| 37 | + Rails.root.join("tmp", "repo_satellites", project.path) | |
| 38 | + end | |
| 39 | + end | |
| 40 | + end | |
| 41 | +end | ... | ... |