Shell Script Sequencing with Rake
- by Haseeb Khan
Hi All,
I am working on a rake utility and want to implement something mentioned below:
There are some shell commands in a sequence in my Rake file. What I want is that the sequence should wait for the previous command to finish processing before it moves to the next one.
sh "git commit -m \"#{args.commit_message}\"" do |ok, res|
# Do some processing
end
sh "git push heroku master"
So, in the above example what I want is that
sh "git push heroku master"
shouldn't be executed until the processing in the
sh "git commit -m \"#{args.commit_message}\"" do |ok, res|
# Do some processing
end
is completed.
Also another nice to have would be that if I can store the output of the shell command in a Ruby variable so it can be used in further manipulation if required.
Looking forward to a reply from the fellow community member shortly.
Thanks in advance.