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-11-23 02:44:54 +0300
committerConnor Shea <connor.james.shea@gmail.com>2016-11-23 02:44:54 +0300
commita90372f979f1caca3e2de3380e39a945e610c1e5 (patch)
tree2cbfc71eec8b78e5474449d295de4ede279fd27d /Rakefile
parent8c590df5e77f9fc657137ad7b2f5b3c233f56d73 (diff)
Update Rakefile with code improvements.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile28
1 files changed, 20 insertions, 8 deletions
diff --git a/Rakefile b/Rakefile
index ae071c14..747fddbe 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,8 +1,8 @@
-# By default won't delete any directories, requires all relevant directories
-# be empty. Run `RAKE_FORCE_DELETE=true rake pull_repos` to have directories
-# deleted.
desc 'Pulls down the CE, EE, Omnibus and Runner git repos and merges the content of their doc directories into the nanoc site'
task :pull_repos do
+ # By default won't delete any directories, requires all relevant directories
+ # be empty. Run `RAKE_FORCE_DELETE=true rake pull_repos` to have directories
+ # deleted.
force_delete = ENV['RAKE_FORCE_DELETE']
ce = {
@@ -50,7 +50,7 @@ task :pull_repos do
dirs.each do |dir|
puts "\n=> Deleting #{dir} if it exists\n"
- `rm -rf #{dir}`
+ FileUtils.rm_r("#{dir}") if File.exist?("#{dir}")
end
else
puts "NOTE: The following directories must be empty otherwise this task " +
@@ -60,11 +60,23 @@ task :pull_repos do
"`RAKE_FORCE_DELETE=true rake pull_repos`."
end
+ dirs.each do |dir|
+ unless "#{dir}".start_with?("tmp")
+
+ puts "\n=> Making an empty #{dir}"
+ FileUtils.mkdir("#{dir}") unless File.exist?("#{dir}")
+ end
+ end
+
products.each do |product|
- puts "\n=> Cloning #{product[:repo]} into #{product[:temp_dir]}\n"
- `git clone #{product[:repo]} #{product[:temp_dir]} --depth 1`
+ temp_dir = File.join(product[:temp_dir])
+ puts "\n=> Cloning #{product[:repo]} into #{temp_dir}\n"
- puts "\n=> Moving #{product[:temp_dir]}#{product[:doc_dir]}/ into #{product[:dest_dir]}\n"
- `mv #{product[:temp_dir]}#{product[:doc_dir]}/ #{product[:dest_dir]}`
+ `git clone #{product[:repo]} #{temp_dir} --depth 1 --branch master`
+
+ temp_doc_dir = File.join(product[:temp_dir], product[:doc_dir], '.')
+ destination_dir = File.join(product[:dest_dir])
+ puts "\n=> Copying #{temp_doc_dir} into #{destination_dir}\n"
+ FileUtils.cp_r(temp_doc_dir, destination_dir)
end
end