mirror of
https://github.com/coderofsalvation/podi.git
synced 2025-12-16 11:57:45 +01:00
work in progress [might break]
This commit is contained in:
10
podi
10
podi
@@ -49,6 +49,7 @@ trigger() { printf "$C_NORMAL [$C_CYAN✓$C_NORMAL] $C_BOLD%s$C_NORMAL\n" "$1
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
on() { export on_$1="$2 $(eval echo \$on_$1)"; }
|
on() { export on_$1="$2 $(eval echo \$on_$1)"; }
|
||||||
|
init_dirs() { test -d .git || git init; test -d .pod || mkdir .pod; }
|
||||||
|
|
||||||
init_post_receive(){
|
init_post_receive(){
|
||||||
echo "#!/bin/sh
|
echo "#!/bin/sh
|
||||||
@@ -98,7 +99,7 @@ init(){ # init git@server:/dir/to/deploy [branch] [port] [name] : initializes a
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_localhost(){
|
init_localhost(){
|
||||||
test -d .git || git init
|
init_dirs
|
||||||
test -f .pod/pipeline || {
|
test -f .pod/pipeline || {
|
||||||
test -d .pod || mkdir -p .pod
|
test -d .pod || mkdir -p .pod
|
||||||
test -f .pod/pipeline || recipe pipeline
|
test -f .pod/pipeline || recipe pipeline
|
||||||
@@ -135,7 +136,7 @@ init_server(){
|
|||||||
scp -r -P $port $0 .pod $user@$server:$gitpath/. 1>/dev/null
|
scp -r -P $port $0 .pod $user@$server:$gitpath/. 1>/dev/null
|
||||||
try ssh -p $port $user@$server "cd $gitpath; ./podi init_gitops $gitpath $server $user $port"
|
try ssh -p $port $user@$server "cd $gitpath; ./podi init_gitops $gitpath $server $user $port"
|
||||||
set +e
|
set +e
|
||||||
test -d .git || git init
|
init_dirs
|
||||||
init_remotes
|
init_remotes
|
||||||
silent git push $appname $branch
|
silent git push $appname $branch
|
||||||
print "you can now run: git push $appname $branch"
|
print "you can now run: git push $appname $branch"
|
||||||
@@ -163,10 +164,9 @@ recipe(){ # recipe <name_or_url> : installs a recipe from podi repo or url
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
install(){
|
install(){
|
||||||
|
init_dirs
|
||||||
for repo in $RECIPE_REPOS; do
|
for repo in $RECIPE_REPOS; do
|
||||||
curl -s $repo | silent grep -E "^$1$" && {
|
curl -s $repo | silent grep -E "^$1$" && {
|
||||||
test -d .git || git init
|
|
||||||
test -d .pod || mkdir .pod
|
|
||||||
print "writing .pod/$1"
|
print "writing .pod/$1"
|
||||||
dir=$(dirname $1)
|
dir=$(dirname $1)
|
||||||
test -d .pod/$dir || mkdir -p .pod/$dir
|
test -d .pod/$dir || mkdir -p .pod/$dir
|
||||||
@@ -179,6 +179,7 @@ recipe(){ # recipe <name_or_url> : installs a recipe from podi repo or url
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_remotes(){
|
init_remotes(){
|
||||||
|
find .pod | silent grep config || return 0
|
||||||
for config in .pod/*@*/*/config; do
|
for config in .pod/*@*/*/config; do
|
||||||
. $config
|
. $config
|
||||||
git remote | silent grep $appname || {
|
git remote | silent grep $appname || {
|
||||||
@@ -189,6 +190,7 @@ init_remotes(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
usage(){
|
usage(){
|
||||||
|
init_dirs
|
||||||
test -d .git && silent grep "bare = true" .git/config && error "dont use podi on production server"
|
test -d .git && silent grep "bare = true" .git/config && error "dont use podi on production server"
|
||||||
echo "usage: "
|
echo "usage: "
|
||||||
awk '/[a-zA-Z0-9_]+\(\){ #/ {
|
awk '/[a-zA-Z0-9_]+\(\){ #/ {
|
||||||
|
|||||||
Reference in New Issue
Block a user