Project

General

Profile

Download (1.47 KB) Statistics
| Branch: | Tag: | Revision:

runcible / release.sh @ 27b106f4

1
#!/bin/bash
2

    
3

    
4
NAME="runcible"
5
VERSION=`cat ./lib/runcible/version.rb | grep VERSION | awk -F "'" '{print $2}'` 
6

    
7
read -p "Would you like to release $NAME-$VERSION (yes/no/skip)? "
8
if [ "$REPLY" == "yes" ]; then
9
  gem build runcible.gemspec || exit -1
10
  gem push runcible-$VERSION.gem || exit -1
11
elif [ "$REPLY" == "skip" ]; then
12
  echo "Skipping"
13
else 
14
  echo "Exiting"
15
  exit -1
16
fi
17

    
18

    
19
read -p "Would you like to release documentation for $NAME-$VERSION (yes/no/skip)? "
20
if [ "$REPLY" == "yes" ]; then
21
  #validate upstream remote
22
  git remote | grep upstream
23
  if [ $? -eq 0 ]; then
24
    REMOTE="upstream"
25
  fi
26

    
27
  git remote | grep origin
28
  if [ $? -eq 0 -a -z "$REMOTE" ]; then
29
    REMOTE="origin"
30
  fi
31

    
32
  if [ -z "$REMOTE" ]; then
33
    echo "Cannot find git remote named 'upstream' or 'origin'" && exit -1
34
  fi
35

    
36
  FILE_COUNT=`git ls-files --exclude-standard --others | wc -l`
37
  if [ "$FILE_COUNT" != "0" ]; then
38
    echo "Untracked files found, cannot build.  Please clean your tree before building." && exit -1
39
  fi
40

    
41
  #checkout gh-pages branch if needed
42
  git branch | grep gh-pages
43
  if [ $? -ne 0 ]; then
44
    git branch gh-pages $REMOTE/gh-pages || exit -1
45
  fi
46
  
47
  echo "Building docs"
48
  yard doc || exit -1
49
  git checkout gh-pages || exit -1
50
  cp -rf doc/* ./
51
  git add ./
52
  git commit -a -m "Updating docs to version $VERSION"
53
  echo "* To push out new docs:"
54
  echo "  git push $REMOTE gh-pages:gh-pages"
55

    
56

    
57
elif [ "$REPLY" == "skip" ]; then
58
  echo "Skipping"
59
else 
60
  echo "Exiting"
61
  exit -1
62
fi