diff --git a/clean_files.txt b/clean_files.txt index 49bbe93720..a115c5dd5e 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -127,12 +127,18 @@ plugins/available/osx-timemachine.plugin.bash plugins/available/osx.plugin.bash plugins/available/percol.plugin.bash plugins/available/plenv.plugin.bash +plugins/available/postgres.plugin.bash plugins/available/projects.plugin.bash plugins/available/proxy.plugin.bash plugins/available/pyenv.plugin.bash plugins/available/python.plugin.bash +plugins/available/rails.plugin.bash plugins/available/rbenv.plugin.bash plugins/available/ruby.plugin.bash +plugins/available/rvm.plugin.bash +plugins/available/ssh.plugin.bash +plugins/available/sshagent.plugin.bash +plugins/available/subversion.plugin.bash plugins/available/sudo.plugin.bash plugins/available/textmate.plugin.bash plugins/available/thefuck.plugin.bash diff --git a/plugins/available/pipsi.plugin.bash b/plugins/available/pipsi.plugin.bash index bf42758c4d..ccc6cb5183 100644 --- a/plugins/available/pipsi.plugin.bash +++ b/plugins/available/pipsi.plugin.bash @@ -1,3 +1,4 @@ +# shellcheck shell=bash cite about-plugin about-plugin 'load pipsi, if you are using it' diff --git a/plugins/available/postgres.plugin.bash b/plugins/available/postgres.plugin.bash index ff24b0bbf7..0d4aaac7b3 100644 --- a/plugins/available/postgres.plugin.bash +++ b/plugins/available/postgres.plugin.bash @@ -2,8 +2,9 @@ cite about-plugin about-plugin 'postgres helper functions' -export PGVERSION=$(pg_config --version | awk '{print $2}') -export POSTGRES_BIN=$(pg_config --bindir) +PGVERSION=$(pg_config --version | awk '{print $2}') +POSTGRES_BIN=$(pg_config --bindir) +export POSTGRES_BIN PGVERSION COMMON_PGDATA_PATHS=("/usr/local/var/postgres" "/var/pgsql" "/Library/Server/PostgreSQL/Data") for possible in "${COMMON_PGDATA_PATHS[@]}"; do : @@ -18,7 +19,7 @@ function postgres_start { group 'postgres' echo 'Starting Postgres....' - $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start + "$POSTGRES_BIN/pg_ctl" -D "$PGDATA" -l "$PGDATA/logfile" start } function postgres_stop { @@ -26,14 +27,14 @@ function postgres_stop { group 'postgres' echo 'Stopping Postgres....' - $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast + "$POSTGRES_BIN/pg_ctl" -D "$PGDATA" -l "$PGDATA/logfile" stop -s -m fast } function postgres_status { about 'Returns status of PostgreSQL server' group 'postgres' - # $POSTGRES_BIN/pg_ctl -D $PGDATA status + # "$POSTGRES_BIN/pg_ctl" -D "$PGDATA status" if [[ $(is_postgres_running) == "no server running" ]]; then echo "Postgres service [STOPPED]" else @@ -42,7 +43,7 @@ function postgres_status { } function is_postgres_running { - $POSTGRES_BIN/pg_ctl -D $PGDATA status | grep -F -o "no server running" + "$POSTGRES_BIN/pg_ctl" -D "$PGDATA" status | grep -F -o "no server running" } function postgres_restart { @@ -50,21 +51,21 @@ function postgres_restart { group 'postgres' echo 'Restarting Postgres....' - $POSTGRES_BIN/pg_ctl -D $PGDATA restart + "$POSTGRES_BIN/pg_ctl" -D "$PGDATA" restart } function postgres_logfile { about 'View the last 500 lines from logfile' group 'postgres' - tail -500 $PGDATA/logfile | less + tail -500 "$PGDATA/logfile" | less } function postgres_serverlog { about 'View the last 500 lines from server.log' group 'postgres' - tail -500 $PGDATA/server.log | less + tail -500 "$PGDATA/server.log" | less } # function postgres_syslog { diff --git a/plugins/available/rails.plugin.bash b/plugins/available/rails.plugin.bash index 303264eef8..095bfa871f 100644 --- a/plugins/available/rails.plugin.bash +++ b/plugins/available/rails.plugin.bash @@ -1,3 +1,4 @@ +# shellcheck shell=bash cite about-plugin about-plugin 'Helper functions for Ruby on Rails' @@ -7,9 +8,9 @@ function killrails() { group 'rails' railsPid="$(cat tmp/pids/server.pid)" - if [ ! -z "$railsPid" ]; then + if [ -n "$railsPid" ]; then echo "[OK] Rails Server Process Id : ${railsPid}" - kill -9 $railsPid + kill -9 "$railsPid" echo "[OK] Process Killed" else echo "[FAIL] Error killing Rails server" diff --git a/plugins/available/rvm.plugin.bash b/plugins/available/rvm.plugin.bash index c77bf40bc9..747e1f7009 100644 --- a/plugins/available/rvm.plugin.bash +++ b/plugins/available/rvm.plugin.bash @@ -1,26 +1,30 @@ +# shellcheck shell=bash # Load RVM, if you are using it cite about-plugin about-plugin 'load rvm, if you are using it' +# shellcheck disable=SC1091 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Check to make sure that RVM is actually loaded before adding # the customizations to it. if [ "$rvm_path" ]; then # Load the auto-completion script if RVM was loaded. - [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion + # shellcheck disable=SC1091 + [[ -r "$rvm_path/scripts/completion" ]] && . "$rvm_path/scripts/completion" switch() { - rvm $1 - local v=$(rvm_version) - rvm wrapper $1 textmate - echo "Switch to Ruby version: "$v + rvm "$1" + local v + v=$(rvm_version) + rvm wrapper "$1" textmate + echo "Switch to Ruby version: $v" } rvm_default() { - rvm --default $1 - rvm wrapper $1 textmate + rvm --default "$1" + rvm wrapper "$1" textmate } function rvm_version() { diff --git a/plugins/available/ssh.plugin.bash b/plugins/available/ssh.plugin.bash index 8f373079f8..a5d1e3b2e5 100644 --- a/plugins/available/ssh.plugin.bash +++ b/plugins/available/ssh.plugin.bash @@ -1,3 +1,4 @@ +# shellcheck shell=bash cite about-plugin about-plugin 'ssh helper functions' diff --git a/plugins/available/sshagent.plugin.bash b/plugins/available/sshagent.plugin.bash index e8e4a57606..bff408d2ba 100644 --- a/plugins/available/sshagent.plugin.bash +++ b/plugins/available/sshagent.plugin.bash @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +# shellcheck shell=bash cite about-plugin about-plugin 'sshagent helper functions' @@ -22,8 +22,8 @@ function _get_process_status_field() { pid="${1}" field="${2}" status_file="/proc/${pid}/status" - if ! ([[ -d "${status_file%/*}" ]] \ - && [[ -r "${status_file}" ]]); then + if ! { [[ -d "${status_file%/*}" ]] \ + && [[ -r "${status_file}" ]]; }; then echo "" return fi diff --git a/plugins/available/subversion.plugin.bash b/plugins/available/subversion.plugin.bash index 28bf65f760..5c6253d5ee 100644 --- a/plugins/available/subversion.plugin.bash +++ b/plugins/available/subversion.plugin.bash @@ -1,3 +1,4 @@ +# shellcheck shell=bash cite about-plugin about-plugin 'svn helper functions' @@ -10,7 +11,7 @@ rm_svn() { reference rm_svn return fi - find $1 -name .svn -print0 | xargs -0 rm -rf + find "$1" -name .svn -print0 | xargs -0 rm -rf } svn_add() {