noosfero | quick-start: give feedback when compiling translations fail

Antonio Terceiro gitlab at gitlab.com
Fri Feb 13 12:56:53 BRST 2015


Antonio Terceiro pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>

Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/8c96fea80f9a993b42cec2dee36912db7e80c666">8c96fea8</a> by Antonio Terceiro
quick-start: give feedback when compiling translations fail

If there is a problem with the DB setup, rake
noosfero:translations:compile would fail silently, but we also do not
want all its output (which is a lot) unless something goes wrong.

- - - - -


Changes:

=====================================
script/quick-start
=====================================
--- a/script/quick-start
+++ b/script/quick-start
@@ -22,15 +22,26 @@ complain() {
 
 run() {
   say "\$ $@"
-  echo "$@" | sh
-  status="$?"
-  if [ $status -ne 0 ]; then
+  local rc=0
+  "$@" || rc=$?
+  if [ $rc -ne 0 ]; then
     complain "E: The command \"$@\" failed with status code $status, we cannot proceed."
     complain "I: If you have no idea of what went wrong, please feel free to ask for help in the Noosfero community. Check the contact information in the project website (http://noosfero.org/)."
     exit 1
   fi
 }
 
+quiet() {
+  local tmpfile=$(mktemp)
+  local rc=0
+  "$@" > "$tmpfile" 2>&1 || rc=$?
+  if [ $rc -ne 0 ]; then
+    cat "$tmpfile"
+  fi
+  rm -f "$tmpfile"
+  return $rc
+}
+
 gem_install() {
   if [ -w "$(ruby -rubygems -e 'puts Gem.dir')" ]; then
     run gem install --no-ri --no-rdoc $@
@@ -103,13 +114,15 @@ else
   rails runner 'Environment.default.enable("skip_new_user_email_confirmation")'
 fi
 
-run 'rake noosfero:translations:compile >/dev/null 2>&1'
+run quiet rake noosfero:translations:compile
 
 # create needed directory
 mkdir -p tmp/pids
 
 # use default gitignore rules
-ln -s gitignore.example .gitignore || true
+if [ ! -f .gitignore ]; then
+  ln -s gitignore.example .gitignore
+fi
 
 # you can now start the server
 say "I: Congratulations, you are ready to run Noosfero."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150213/d0a3d322/attachment-0001.html>


More information about the Noosfero-dev mailing list