Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Update rake multirepo:init
Browse files Browse the repository at this point in the history
Use ruby syntax for environment variable
Exit if rake init fails on checkout
  • Loading branch information
dshevtsov committed Nov 15, 2019
1 parent b37f6aa commit bd4c67d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions rakelib/multirepo.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
namespace :multirepo do
desc 'Create a file tree for devdocs website and get all required content'
task :init do
ssh = 'git@github.com:'
https = 'https://${token}@github.com/'
protocol =
if ENV['token']
https
else
ssh
end

protocol = ENV['token'] ? "https://#{ENV['token']}@github.com/" : 'git@github.com:'
content_map = DocConfig.new.content_map
content_map.each do |subrepo|
sh "./scripts/docs-from-code.sh #{subrepo['directory']} #{protocol}#{subrepo['repository']}.git #{subrepo['branch']} #{subrepo['filter']}"
sh "./scripts/docs-from-code.sh #{subrepo['directory']} #{protocol}#{subrepo['repository']}.git #{subrepo['branch']} #{subrepo['filter']}" do |ok,res|
if !ok
puts "Couldn't checkout files for the #{subrepo['repository']} project".red
exit 1
end
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion scripts/docs-from-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ if $sparse; then
fi

echo "Checkouting a branch: $branch"
git checkout "$branch"
git checkout "$branch" || exit

cd ..

0 comments on commit bd4c67d

Please sign in to comment.