vendredi 8 mai 2015

how to get result from executing a set of system commands in a Ruby script

I am running a set of system commands in my Ruby script , and I would like to get the result (true /false) of the execution ( as I already did for a single command

  unless system("mkdir -p #{project_path}")
     puts "Cannot create local project directory." 
     exit 1
 end

for a set of commands I tried :

unless system <<EOC
  cp "#{dockerfile_template}" "#{project_path}"
  cd "#{project_path}"
  git init .
  git add -A
  git commit -m "first commit" 
  git remote add origin "#{project_repository}"
  git push -u origin master
EOC
exit 1
end

but it's failing : => an't find string "EOC" anywhere before EOF any suggestion welcome ...

Aucun commentaire:

Enregistrer un commentaire