summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-26 00:56:24 +0200
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-26 00:56:24 +0200
commitfba8ad560797500063df84089a99c24fdc5cacd7 (patch)
treeab9fa00191755177493dfb787a373e69e694b01c /lib
parent5f16687805b4daa98f7227849d064345e68210d2 (diff)
downloadgitlab-ce-fba8ad560797500063df84089a99c24fdc5cacd7.tar.gz
Move Gitlab::Satellite into the Satellite module
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/satellite.rb40
-rw-r--r--lib/gitlab/satellite/satellite.rb41
2 files changed, 41 insertions, 40 deletions
diff --git a/lib/gitlab/satellite.rb b/lib/gitlab/satellite.rb
deleted file mode 100644
index 64875f3fb30..00000000000
--- a/lib/gitlab/satellite.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-module Gitlab
- class Satellite
-
- PARKING_BRANCH = "__parking_branch"
-
- attr_accessor :project
-
- def initialize(project)
- @project = project
- end
-
- #will be deleted all branches except PARKING_BRANCH
- def clear
- Dir.chdir(path) do
- heads = Grit::Repo.new(".").heads.map{|head| head.name}
- if heads.include? PARKING_BRANCH
- `git checkout #{PARKING_BRANCH}`
- else
- `git checkout -b #{PARKING_BRANCH}`
- end
- heads.delete(PARKING_BRANCH)
- heads.each do |head|
- `git branch -D #{head}`
- end
- end
- end
-
- def create
- `git clone #{project.url_to_repo} #{path}`
- end
-
- def exists?
- File.exists? path
- end
-
- def path
- Rails.root.join("tmp", "repo_satellites", project.path)
- end
- end
-end
diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb
new file mode 100644
index 00000000000..5137cd4cf01
--- /dev/null
+++ b/lib/gitlab/satellite/satellite.rb
@@ -0,0 +1,41 @@
+module Gitlab
+ module Satellite
+ class Satellite
+ PARKING_BRANCH = "__parking_branch"
+
+ attr_accessor :project
+
+ def initialize(project)
+ @project = project
+ end
+
+ #will be deleted all branches except PARKING_BRANCH
+ def clear
+ Dir.chdir(path) do
+ heads = Grit::Repo.new(".").heads.map{|head| head.name}
+ if heads.include? PARKING_BRANCH
+ `git checkout #{PARKING_BRANCH}`
+ else
+ `git checkout -b #{PARKING_BRANCH}`
+ end
+ heads.delete(PARKING_BRANCH)
+ heads.each do |head|
+ `git branch -D #{head}`
+ end
+ end
+ end
+
+ def create
+ `git clone #{project.url_to_repo} #{path}`
+ end
+
+ def exists?
+ File.exists? path
+ end
+
+ def path
+ Rails.root.join("tmp", "repo_satellites", project.path)
+ end
+ end
+ end
+end