Commit 8c96fea80f9a993b42cec2dee36912db7e80c666
1 parent
18a80c93
Exists in
master
and in
22 other branches
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.
Showing
1 changed file
with
18 additions
and
5 deletions
Show diff stats
script/quick-start
... | ... | @@ -22,15 +22,26 @@ complain() { |
22 | 22 | |
23 | 23 | run() { |
24 | 24 | say "\$ $@" |
25 | - echo "$@" | sh | |
26 | - status="$?" | |
27 | - if [ $status -ne 0 ]; then | |
25 | + local rc=0 | |
26 | + "$@" || rc=$? | |
27 | + if [ $rc -ne 0 ]; then | |
28 | 28 | complain "E: The command \"$@\" failed with status code $status, we cannot proceed." |
29 | 29 | 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/)." |
30 | 30 | exit 1 |
31 | 31 | fi |
32 | 32 | } |
33 | 33 | |
34 | +quiet() { | |
35 | + local tmpfile=$(mktemp) | |
36 | + local rc=0 | |
37 | + "$@" > "$tmpfile" 2>&1 || rc=$? | |
38 | + if [ $rc -ne 0 ]; then | |
39 | + cat "$tmpfile" | |
40 | + fi | |
41 | + rm -f "$tmpfile" | |
42 | + return $rc | |
43 | +} | |
44 | + | |
34 | 45 | gem_install() { |
35 | 46 | if [ -w "$(ruby -rubygems -e 'puts Gem.dir')" ]; then |
36 | 47 | run gem install --no-ri --no-rdoc $@ |
... | ... | @@ -103,13 +114,15 @@ else |
103 | 114 | rails runner 'Environment.default.enable("skip_new_user_email_confirmation")' |
104 | 115 | fi |
105 | 116 | |
106 | -run 'rake noosfero:translations:compile >/dev/null 2>&1' | |
117 | +run quiet rake noosfero:translations:compile | |
107 | 118 | |
108 | 119 | # create needed directory |
109 | 120 | mkdir -p tmp/pids |
110 | 121 | |
111 | 122 | # use default gitignore rules |
112 | -ln -s gitignore.example .gitignore || true | |
123 | +if [ ! -f .gitignore ]; then | |
124 | + ln -s gitignore.example .gitignore | |
125 | +fi | |
113 | 126 | |
114 | 127 | # you can now start the server |
115 | 128 | say "I: Congratulations, you are ready to run Noosfero." | ... | ... |