Spruced up docs and added before/after to wizard
This commit is contained in:
parent
2f305d592c
commit
d6eb3109f0
2 changed files with 57 additions and 5 deletions
40
README.md
40
README.md
|
@ -1,4 +1,38 @@
|
||||||
ship
|
# ship
|
||||||
====
|
|
||||||
|
First you build, then you `ship`.
|
||||||
|
|
||||||
|
`ship` was born out of [my][joshtronic] desire to have a simple way to pull
|
||||||
|
down code from Github to a location to a remote server. I wasn’t satisfied with
|
||||||
|
the existing options out there as they often times required manual setup steps
|
||||||
|
on either the remote server or for new developers on the project.
|
||||||
|
|
||||||
|
The only dependencies of `ship` are that you must have access to the repository
|
||||||
|
because we use `ForwardAgent` and access to the remote server as the configured
|
||||||
|
user We accomplish this by using `ssh-copy-id username@server` from each
|
||||||
|
trusted system. This project allows multiple developers to be able to ship code
|
||||||
|
out to production without setting up deployment keys, webhooks or any other
|
||||||
|
manual steps when working with a fresh local copy.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### OS X
|
||||||
|
|
||||||
|
```shell
|
||||||
|
brew tap fetchlogic/formulae
|
||||||
|
brew install ship
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Initializing a project
|
||||||
|
|
||||||
|
From the root of the project, run `ship init` and follow the on screen prompts.
|
||||||
|
This will create a configuration file named `.ship` in the project as well as
|
||||||
|
initializing the remote deployment location on the specified server.
|
||||||
|
|
||||||
|
### Deploying code
|
||||||
|
|
||||||
|
Deployments are performed by running `ship` anywhere in a previously
|
||||||
|
initialized project.
|
||||||
|
|
||||||
First you build, then you ship. Repeat.
|
|
||||||
|
|
22
ship
22
ship
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
SSH="ssh -o ForwardAgent=yes"
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0)
|
0)
|
||||||
while [[ "$PWD" != "/" ]]
|
while [[ "$PWD" != "/" ]]
|
||||||
|
@ -31,7 +33,7 @@ case $# in
|
||||||
COMMANDS="$COMMANDS $AFTER;"
|
COMMANDS="$COMMANDS $AFTER;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh $USER@$SERVER "$COMMANDS"
|
$SSH $USER@$SERVER "$COMMANDS"
|
||||||
else
|
else
|
||||||
if [[ -e ".ship" ]]
|
if [[ -e ".ship" ]]
|
||||||
then
|
then
|
||||||
|
@ -68,9 +70,15 @@ case $# in
|
||||||
echo -n "Destination on server to deploy to: "
|
echo -n "Destination on server to deploy to: "
|
||||||
read DESTINATION
|
read DESTINATION
|
||||||
|
|
||||||
|
echo -n "Commands to run before shipment (optional): "
|
||||||
|
read BEFORE
|
||||||
|
|
||||||
|
echo -n "Commands to run after shipment (also optional): "
|
||||||
|
read AFTER
|
||||||
|
|
||||||
CLONEURL=`git config --get remote.origin.url`
|
CLONEURL=`git config --get remote.origin.url`
|
||||||
|
|
||||||
ssh captain@$SERVER "
|
$SSH $USER@$SERVER "
|
||||||
if [ -a $DESTINATION ]
|
if [ -a $DESTINATION ]
|
||||||
then
|
then
|
||||||
echo "Error: Destination exists"
|
echo "Error: Destination exists"
|
||||||
|
@ -83,6 +91,16 @@ case $# in
|
||||||
echo "USER=$USER" > .ship
|
echo "USER=$USER" > .ship
|
||||||
echo "SERVER=$SERVER" >> .ship
|
echo "SERVER=$SERVER" >> .ship
|
||||||
echo "DESTINATION=$DESTINATION" >> .ship
|
echo "DESTINATION=$DESTINATION" >> .ship
|
||||||
|
|
||||||
|
if [ -n "$BEFORE" ]
|
||||||
|
then
|
||||||
|
echo "BEFORE=$BEFORE" >> .ship
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$AFTER" ]
|
||||||
|
then
|
||||||
|
echo "AFTER=$AFTER" >> .ship
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Error: Invalid argument '$1'"
|
echo "Error: Invalid argument '$1'"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue