summaryrefslogtreecommitdiff
path: root/db/fixtures/test/001_repo.rb
blob: 59fd2fde124e9f4a4d889155b8eb2908fff02f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'fileutils'

print "Unpacking seed repository..."

SEED_REPO = 'seed_project.tar.gz'
REPO_PATH = Rails.root.join('tmp', 'repositories')

# Make whatever directories we need to make
FileUtils.mkdir_p(REPO_PATH)

# Copy the archive to the repo path
FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH)

# chdir to the repo path
FileUtils.cd(REPO_PATH) do
  # Extract the archive
  `tar -xf #{SEED_REPO}`

  # Remove the copy
  FileUtils.rm(SEED_REPO)
end
puts ' done.'
print "Creating seed satellite..."

SATELLITE_PATH = Rails.root.join('tmp', 'satellite')
# Make directory
FileUtils.mkdir_p(SATELLITE_PATH)
#  Chdir, clone from the seed
FileUtils.cd(SATELLITE_PATH) do
  # Clone the satellite
  `git clone --quiet #{REPO_PATH}/gitlabhq #{SATELLITE_PATH}/gitlabhq`
end
puts ' done.'