-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhatchbox.fish
More file actions
27 lines (23 loc) · 901 Bytes
/
hatchbox.fish
File metadata and controls
27 lines (23 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function hb
set -l user "deploy"
set -l address "XX.XXX.XXX.X" # REPLACE ME
if [ (count $argv) -lt 2 ]
echo "HatchBox CLI: Must provide an app slug and command, e.g hb <app> <command>"
echo ""
echo "Available commands:"
echo "hb <app> console Run rails console for <app>"
echo "hb <app> logs Read live logs for <app>"
return
end
set -l app $argv[1]
set -l action $argv[2]
if [ "$action" = "logs" ]
echo "tailing the $app logs..."
set action "journalctl --user --unit=$app-server" # HatchBox v2.0
# set action "tail -f ~/$app/current/log/production.log" # enable for HatchBox Classic
else if [ "$action" = "console" ]
echo "opening the $app console..."
set action "cd ~/$app/current && bundle exec rails console"
end
ssh -t $user@$address $action
end