Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-12-13 09:49:29 +0300
committerConnor Shea <connor.james.shea@gmail.com>2016-12-13 10:24:24 +0300
commite9017a29beb8426eaeb381b22ed2455805c1a3e6 (patch)
tree3c08369814c509e164a3145daf460acbf350c6b3 /Rakefile
parente6218957fd8c11d3ee356194a85385f72aa3a378 (diff)
Add caching for certain jobs to make things go faster.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile17
1 files changed, 15 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index 9504f81a..bd363c8d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -49,9 +49,22 @@ task :pull_repos do
products.each do |product|
temp_dir = File.join(product['dirs']['temp_dir'])
- puts "\n=> Cloning #{product['repo']} into #{temp_dir}\n"
- `git clone #{product['repo']} #{temp_dir} --depth 1 --branch master`
+ if !File.exist?(temp_dir) || Dir.entries(temp_dir).length.zero?
+ puts "\n=> Cloning #{product['repo']} into #{temp_dir}\n"
+
+ `git clone #{product['repo']} #{temp_dir} --depth 1 --branch master`
+ elsif File.exist?(temp_dir) && !Dir.entries(temp_dir).length.zero?
+ puts "\n=> Pulling master of #{product['repo']}\n"
+
+ # Enter the temporary directory and return after block is completed.
+ FileUtils.cd(temp_dir) do
+ # Update repository from master.
+ `git pull origin master`
+ end
+ else
+ puts "This shouldn't happen"
+ end
temp_doc_dir = File.join(product['dirs']['temp_dir'], product['dirs']['doc_dir'], '.')
destination_dir = File.join(product['dirs']['dest_dir'])