Shell Script Sequencing with Rake

Posted by Haseeb Khan on Stack Overflow See other posts from Stack Overflow or by Haseeb Khan
Published on 2010-04-01T19:29:11Z Indexed on 2010/04/01 19:33 UTC
Read the original article Hit count: 349

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about git

Related posts about rake