-
Notifications
You must be signed in to change notification settings - Fork 8
/
composer_update.cap
23 lines (18 loc) · 1.28 KB
/
composer_update.cap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
namespace :composer do
desc 'Push a new Git branch with an up-to-date composer.lock'
task :update_vendor do
on roles(:app) do
puts "\n\e[36m\e[1m> Creating temporary folder"
execute "cd ~;rm -rf ./#{fetch(:update_dir)};mkdir #{fetch(:update_dir)};"
puts "\n\e[36m\e[1m> Cloning Open Orchestra"
execute "cd ~/#{fetch(:update_dir)};git clone #{fetch(:repo_url)};cd #{fetch(:git_project_dir)};git checkout #{fetch(:branch)}"
puts "\n\e[36m\e[1m> Updating dependencies"
execute "cd ~/#{fetch(:update_dir)}/#{fetch(:git_project_dir)};composer clear-cache;composer update --no-progress --ignore-platform-reqs;"
puts "\n\e[36m\e[1m> Pushing the composer.lock to a new Git branch"
execute "cd ~/#{fetch(:update_dir)}/#{fetch(:git_project_dir)};git add composer.lock;git commit -m \"auto update vendor\";git pull --rebase origin #{fetch(:branch)};git push origin #{fetch(:branch)}:auto_update_vendor"
puts "\n\e[36m\e[1m> Removing temporary files"
execute "cd ~;rm -rf #{fetch(:update_dir)}"
puts "\n\e[32mYou can now connect to Github and create a Pull Request to merge the \"auto_update_vendor\" branch into \"#{fetch(:branch)}\"\e[0m"
end
end
end