2012-08-28 21:13:22 -04:00
|
|
|
require 'fileutils'
|
|
|
|
|
|
|
|
print "Unpacking seed repository..."
|
|
|
|
|
|
|
|
SEED_REPO = 'seed_project.tar.gz'
|
2012-09-26 14:52:01 -04:00
|
|
|
REPO_PATH = Rails.root.join('tmp', 'repositories')
|
2012-08-28 21:13:22 -04:00
|
|
|
|
|
|
|
# Make whatever directories we need to make
|
|
|
|
FileUtils.mkdir_p(REPO_PATH)
|
|
|
|
|
|
|
|
# Copy the archive to the repo path
|
2012-09-26 14:52:01 -04:00
|
|
|
FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH)
|
2012-08-28 21:13:22 -04:00
|
|
|
|
|
|
|
# chdir to the repo path
|
|
|
|
FileUtils.cd(REPO_PATH) do
|
|
|
|
# Extract the archive
|
|
|
|
`tar -xf #{SEED_REPO}`
|
|
|
|
|
|
|
|
# Remove the copy
|
|
|
|
FileUtils.rm(SEED_REPO)
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
2013-04-25 10:15:33 -04:00
|
|
|
puts ' done.'
|
|
|
|
print "Creating seed satellite..."
|
2012-08-28 21:13:22 -04:00
|
|
|
|
2013-04-25 10:15:33 -04:00
|
|
|
SATELLITE_PATH = Rails.root.join('tmp', 'satellite')
|
|
|
|
# Make directory
|
|
|
|
FileUtils.mkdir_p(SATELLITE_PATH)
|
2013-06-03 16:20:50 -04:00
|
|
|
# Clear any potential directory
|
|
|
|
FileUtils.rm_rf("#{SATELLITE_PATH}/gitlabhq")
|
2013-04-25 10:15:33 -04:00
|
|
|
# Chdir, clone from the seed
|
|
|
|
FileUtils.cd(SATELLITE_PATH) do
|
|
|
|
# Clone the satellite
|
2013-06-03 16:20:50 -04:00
|
|
|
|
2013-04-25 10:15:33 -04:00
|
|
|
`git clone --quiet #{REPO_PATH}/gitlabhq #{SATELLITE_PATH}/gitlabhq`
|
|
|
|
end
|
2012-08-28 21:13:22 -04:00
|
|
|
puts ' done.'
|