BigW Consortium Gitlab

001_repo.rb 876 Bytes
Newer Older
1 2 3 4 5
require 'fileutils'

print "Unpacking seed repository..."

SEED_REPO = 'seed_project.tar.gz'
6
REPO_PATH = Rails.root.join('tmp', 'repositories')
7 8 9 10 11

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

# Copy the archive to the repo path
12
FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH)
13 14 15 16 17 18 19 20

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

  # Remove the copy
  FileUtils.rm(SEED_REPO)
gitlabhq committed
21
end
22 23
puts ' done.'
print "Creating seed satellite..."
24

25 26 27
SATELLITE_PATH = Rails.root.join('tmp', 'satellite')
# Make directory
FileUtils.mkdir_p(SATELLITE_PATH)
Izaak Alpert committed
28 29
# Clear any potential directory
FileUtils.rm_rf("#{SATELLITE_PATH}/gitlabhq")
30 31 32
#  Chdir, clone from the seed
FileUtils.cd(SATELLITE_PATH) do
  # Clone the satellite
Izaak Alpert committed
33

34 35
  `git clone --quiet #{REPO_PATH}/gitlabhq #{SATELLITE_PATH}/gitlabhq`
end
36
puts ' done.'