Skip to content

Commit 14ee27c

Browse files
authored
Merge pull request #2281 from Bash-it/ira/cleanup3
2 parents 44623ff + 99fe7fd commit 14ee27c

File tree

8 files changed

+37
-22
lines changed

8 files changed

+37
-22
lines changed

clean_files.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,18 @@ plugins/available/osx-timemachine.plugin.bash
127127
plugins/available/osx.plugin.bash
128128
plugins/available/percol.plugin.bash
129129
plugins/available/plenv.plugin.bash
130+
plugins/available/postgres.plugin.bash
130131
plugins/available/projects.plugin.bash
131132
plugins/available/proxy.plugin.bash
132133
plugins/available/pyenv.plugin.bash
133134
plugins/available/python.plugin.bash
135+
plugins/available/rails.plugin.bash
134136
plugins/available/rbenv.plugin.bash
135137
plugins/available/ruby.plugin.bash
138+
plugins/available/rvm.plugin.bash
139+
plugins/available/ssh.plugin.bash
140+
plugins/available/sshagent.plugin.bash
141+
plugins/available/subversion.plugin.bash
136142
plugins/available/sudo.plugin.bash
137143
plugins/available/textmate.plugin.bash
138144
plugins/available/thefuck.plugin.bash

plugins/available/pipsi.plugin.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# shellcheck shell=bash
12
cite about-plugin
23
about-plugin 'load pipsi, if you are using it'
34

plugins/available/postgres.plugin.bash

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
cite about-plugin
33
about-plugin 'postgres helper functions'
44

5-
export PGVERSION=$(pg_config --version | awk '{print $2}')
6-
export POSTGRES_BIN=$(pg_config --bindir)
5+
PGVERSION=$(pg_config --version | awk '{print $2}')
6+
POSTGRES_BIN=$(pg_config --bindir)
7+
export POSTGRES_BIN PGVERSION
78
COMMON_PGDATA_PATHS=("/usr/local/var/postgres" "/var/pgsql" "/Library/Server/PostgreSQL/Data")
89
for possible in "${COMMON_PGDATA_PATHS[@]}"; do
910
:
@@ -18,22 +19,22 @@ function postgres_start {
1819
group 'postgres'
1920

2021
echo 'Starting Postgres....'
21-
$POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start
22+
"$POSTGRES_BIN/pg_ctl" -D "$PGDATA" -l "$PGDATA/logfile" start
2223
}
2324

2425
function postgres_stop {
2526
about 'Stops PostgreSQL server'
2627
group 'postgres'
2728

2829
echo 'Stopping Postgres....'
29-
$POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast
30+
"$POSTGRES_BIN/pg_ctl" -D "$PGDATA" -l "$PGDATA/logfile" stop -s -m fast
3031
}
3132

3233
function postgres_status {
3334
about 'Returns status of PostgreSQL server'
3435
group 'postgres'
3536

36-
# $POSTGRES_BIN/pg_ctl -D $PGDATA status
37+
# "$POSTGRES_BIN/pg_ctl" -D "$PGDATA status"
3738
if [[ $(is_postgres_running) == "no server running" ]]; then
3839
echo "Postgres service [STOPPED]"
3940
else
@@ -42,29 +43,29 @@ function postgres_status {
4243
}
4344

4445
function is_postgres_running {
45-
$POSTGRES_BIN/pg_ctl -D $PGDATA status | grep -F -o "no server running"
46+
"$POSTGRES_BIN/pg_ctl" -D "$PGDATA" status | grep -F -o "no server running"
4647
}
4748

4849
function postgres_restart {
4950
about 'Restarts status of PostgreSQL server'
5051
group 'postgres'
5152

5253
echo 'Restarting Postgres....'
53-
$POSTGRES_BIN/pg_ctl -D $PGDATA restart
54+
"$POSTGRES_BIN/pg_ctl" -D "$PGDATA" restart
5455
}
5556

5657
function postgres_logfile {
5758
about 'View the last 500 lines from logfile'
5859
group 'postgres'
5960

60-
tail -500 $PGDATA/logfile | less
61+
tail -500 "$PGDATA/logfile" | less
6162
}
6263

6364
function postgres_serverlog {
6465
about 'View the last 500 lines from server.log'
6566
group 'postgres'
6667

67-
tail -500 $PGDATA/server.log | less
68+
tail -500 "$PGDATA/server.log" | less
6869
}
6970

7071
# function postgres_syslog {

plugins/available/rails.plugin.bash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# shellcheck shell=bash
12
cite about-plugin
23
about-plugin 'Helper functions for Ruby on Rails'
34

@@ -7,9 +8,9 @@ function killrails() {
78
group 'rails'
89

910
railsPid="$(cat tmp/pids/server.pid)"
10-
if [ ! -z "$railsPid" ]; then
11+
if [ -n "$railsPid" ]; then
1112
echo "[OK] Rails Server Process Id : ${railsPid}"
12-
kill -9 $railsPid
13+
kill -9 "$railsPid"
1314
echo "[OK] Process Killed"
1415
else
1516
echo "[FAIL] Error killing Rails server"

plugins/available/rvm.plugin.bash

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1+
# shellcheck shell=bash
12
# Load RVM, if you are using it
23

34
cite about-plugin
45
about-plugin 'load rvm, if you are using it'
56

7+
# shellcheck disable=SC1091
68
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
79

810
# Check to make sure that RVM is actually loaded before adding
911
# the customizations to it.
1012
if [ "$rvm_path" ]; then
1113
# Load the auto-completion script if RVM was loaded.
12-
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
14+
# shellcheck disable=SC1091
15+
[[ -r "$rvm_path/scripts/completion" ]] && . "$rvm_path/scripts/completion"
1316

1417
switch() {
15-
rvm $1
16-
local v=$(rvm_version)
17-
rvm wrapper $1 textmate
18-
echo "Switch to Ruby version: "$v
18+
rvm "$1"
19+
local v
20+
v=$(rvm_version)
21+
rvm wrapper "$1" textmate
22+
echo "Switch to Ruby version: $v"
1923
}
2024

2125
rvm_default() {
22-
rvm --default $1
23-
rvm wrapper $1 textmate
26+
rvm --default "$1"
27+
rvm wrapper "$1" textmate
2428
}
2529

2630
function rvm_version() {

plugins/available/ssh.plugin.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# shellcheck shell=bash
12
cite about-plugin
23
about-plugin 'ssh helper functions'
34

plugins/available/sshagent.plugin.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22
cite about-plugin
33
about-plugin 'sshagent helper functions'
44

@@ -22,8 +22,8 @@ function _get_process_status_field() {
2222
pid="${1}"
2323
field="${2}"
2424
status_file="/proc/${pid}/status"
25-
if ! ([[ -d "${status_file%/*}" ]] \
26-
&& [[ -r "${status_file}" ]]); then
25+
if ! { [[ -d "${status_file%/*}" ]] \
26+
&& [[ -r "${status_file}" ]]; }; then
2727
echo ""
2828
return
2929
fi

plugins/available/subversion.plugin.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# shellcheck shell=bash
12
cite about-plugin
23
about-plugin 'svn helper functions'
34

@@ -10,7 +11,7 @@ rm_svn() {
1011
reference rm_svn
1112
return
1213
fi
13-
find $1 -name .svn -print0 | xargs -0 rm -rf
14+
find "$1" -name .svn -print0 | xargs -0 rm -rf
1415
}
1516

1617
svn_add() {

0 commit comments

Comments
 (0)