update travis and start func

This commit is contained in:
chabad360 2018-08-02 16:03:25 -07:00
parent 86755f4a65
commit 71bb7b340e
2 changed files with 15 additions and 6 deletions

View file

@ -19,7 +19,7 @@ before_install:
- chmod u+x ./dbench - chmod u+x ./dbench
install: install:
- ./dbench --setup -d - ./dbench --setup -u
- ./dbench --init - ./dbench --init
- ./dbench --start - ./dbench --start
- pip install --upgrade virtualenv - pip install --upgrade virtualenv

19
dbench
View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
if ! options=$(getopt -o hd:ac:e:: --long add,help,developer:,setup::,start::,init:: -- "$@") if ! options=$(getopt -o hd:ace --long add,help,developer:,setup,start,init -- "$@")
then then
echo "entering container" echo "entering container"
docker exec -it frappe bash docker exec -it frappe bash
@ -8,6 +8,7 @@ fi
add=0 add=0
setup=0 setup=0
d=0
start=0 start=0
init=0 init=0
dev=0 dev=0
@ -23,8 +24,8 @@ function usage {
echo ' -c command send a command to bench in the container' echo ' -c command send a command to bench in the container'
echo ' -d sitename enables developer mode for specified site' echo ' -d sitename enables developer mode for specified site'
echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access'
echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' echo ' --setup [-u] builds docker containers, NOTE: assumes you have docker installed'
echo ' -d start up docker containers as well' echo ' -u start up docker containers as well'
echo ' --start [-b] starts frappe docker' echo ' --start [-b] starts frappe docker'
echo ' -b starts bench as well' echo ' -b starts bench as well'
echo ' --init [-e] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' --init [-e] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)'
@ -58,11 +59,14 @@ while true; do
-d | --developer) -d | --developer)
shift; # The arg is next in position args shift; # The arg is next in position args
dev=1 dev=1
site=$optopt site=$1
;; ;;
-c) -c)
docker exec -it frappe bash -c "$optopt" docker exec -it frappe bash -c "$optopt"
;; ;;
-u)
d=1
;;
--setup) --setup)
setup=1 setup=1
;; ;;
@ -78,5 +82,10 @@ while true; do
done done
if setup; then if setup; then
docker-compose docker-compose build
if d; then
docker-compose -d
else
docker-compose
fi
fi fi