diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-12-13 09:49:29 +0300 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-12-13 10:24:24 +0300 |
commit | e9017a29beb8426eaeb381b22ed2455805c1a3e6 (patch) | |
tree | 3c08369814c509e164a3145daf460acbf350c6b3 /Rakefile | |
parent | e6218957fd8c11d3ee356194a85385f72aa3a378 (diff) |
Add caching for certain jobs to make things go faster.
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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']) |