config/proc.sh in traquitana-0.0.14 vs config/proc.sh in traquitana-0.0.15
- old
+ new
@@ -36,13 +36,29 @@
# check the new Gemfile checksum
new_gemfile_md5=$(md5sum Gemfile 2> /dev/null | cut -f1 -d' ')
# if the current Gemfile is different, run bundle install
-if [ "$old_gemfile_md5" != "$new_gemfile_md5" ]; then
- msg "Running bundle install ..." "$verbose" "true"
- bundle install
+if [ -f Gemfile -a "$old_gemfile_md5" != "$new_gemfile_md5" ]; then
+
+ if [ -f Gemfile.lock ]; then # if there is a Gemfile.lock file ...
+ if [ -w Gemfile.lock ]; then # ... and it is writable
+ msg "Running bundle install ..." "true" "true"
+ bundle install
+ else
+ msg "Gemfile.lock exists but it is not writable, not running bundle install." "true" "true"
+ fi
+ fi
+
+ if [ ! -f Gemfile.lock ]; then # if there is not a Gemfile.lock file ...
+ if [ -w . ]; then # ... and current dir is writable
+ msg "Running bundle install ..." "true" "true"
+ bundle install
+ else
+ msg "Gemfile.lock does not exists but current dir is not writable, not running bundle install" "true" "true"
+ fi
+ fi
fi
# run migrations if needed
migrations=$(grep "^db/migrate" traq/$2.list)
if [ -n "$migrations" ]; then
@@ -57,12 +73,14 @@
bundle exec rake assets:precompile 2> /dev/null
msg "done." "$verbose" "true"
fi
# change file permissions on public dir
-msg "Changing file permissions on public to 0755 ... " "$verbose" "false"
-chmod -R 0755 public/*
-msg "done." "$verbose" "true"
+if [ -d public ]; then
+ msg "Changing file permissions on public to 0755 ... " "$verbose" "false"
+ chmod -R 0755 public/*
+ msg "done." "$verbose" "true"
+fi
# restart server
if [ -x ./traq/server.sh -a -f ./traq/server.sh ]; then
./traq/server.sh
fi