diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-12-18 09:03:37 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-12-18 09:03:37 +0100 |
commit | 3bfea3f9126bb991a1bdf25428a72e17963abf62 (patch) | |
tree | e068ae61c387560f3ed8ea5ecc152aa021f0ee3e /Algorithms | |
parent | 31f4e08b3b0df3058619da493d15334caa3d4f55 (diff) | |
download | coursera-3bfea3f9126bb991a1bdf25428a72e17963abf62.zip coursera-3bfea3f9126bb991a1bdf25428a72e17963abf62.tar.gz |
Algorithms : install algs4 in gittree/algs4
Diffstat (limited to 'Algorithms')
-rw-r--r-- | Algorithms/.gitignore | 1 | ||||
-rwxr-xr-x | Algorithms/Part-II/1-WordNet/run.sh | 7 | ||||
-rw-r--r-- | Algorithms/Part-II/2-SeamCarving/Makefile | 2 | ||||
-rwxr-xr-x | Algorithms/install-algs4.sh | 23 |
4 files changed, 20 insertions, 13 deletions
diff --git a/Algorithms/.gitignore b/Algorithms/.gitignore index 813b968..02c9e5c 100644 --- a/Algorithms/.gitignore +++ b/Algorithms/.gitignore @@ -1,2 +1,3 @@ *.class *.zip +algs4 diff --git a/Algorithms/Part-II/1-WordNet/run.sh b/Algorithms/Part-II/1-WordNet/run.sh index 8c01871..7ec80c5 100755 --- a/Algorithms/Part-II/1-WordNet/run.sh +++ b/Algorithms/Part-II/1-WordNet/run.sh @@ -1,16 +1,17 @@ #! /bin/bash -export "CLASSPATH=$CLASSPATH:.:$HOME/algs4/algs4.jar:$HOME/algs4/stdlib.jar" +ALGS4=../../algs4 +export CLASSPATH="$ALGS4/algs4.jar:$ALGS4/stdlib.jar:." CLASSES="SpecializedBFS WordNet SAP Outcast" rm *.class *.zip 2>/dev/null for kls in $CLASSES; do - ~/algs4/bin/checkstyle ${kls}.java + $ALGS4/bin/checkstyle ${kls}.java javac -Xlint ${kls}.java || exit 1 done -~/algs4/bin/findbugs *.class +$ALGS4/bin/findbugs *.class java Outcast || exit 1 diff --git a/Algorithms/Part-II/2-SeamCarving/Makefile b/Algorithms/Part-II/2-SeamCarving/Makefile index 8e826fe..335e05e 100644 --- a/Algorithms/Part-II/2-SeamCarving/Makefile +++ b/Algorithms/Part-II/2-SeamCarving/Makefile @@ -1,6 +1,6 @@ CC = javac -ALGS4 = $(HOME)/algs4 +ALGS4 = ../../algs4 BIN = SeamCarver SRCS = SeamCarver.java CLASSES = PrintEnergy.class PrintSeams.class ResizeDemo.class SCUtility.class ShowEnergy.class ShowSeams.class diff --git a/Algorithms/install-algs4.sh b/Algorithms/install-algs4.sh index e0ba67e..9ec52da 100755 --- a/Algorithms/install-algs4.sh +++ b/Algorithms/install-algs4.sh @@ -1,32 +1,37 @@ #! /bin/bash -DST=$HOME/algs4 +FULLPATH=$(readlink -f $0) +DST=${FULLPATH%/*}/algs4 mkdir -p $DST pushd $DST + mkdir bin -wget http://algs4.cs.princeton.edu/linux/drjava.jar -wget http://algs4.cs.princeton.edu/linux/drjava -chmod 700 drjava -mv drjava bin wget http://algs4.cs.princeton.edu/code/stdlib.jar wget http://algs4.cs.princeton.edu/code/algs4.jar wget http://algs4.cs.princeton.edu/linux/checkstyle.zip wget http://algs4.cs.princeton.edu/linux/findbugs.zip + unzip checkstyle.zip rm checkstyle.zip unzip findbugs.zip rm findbugs.zip + wget http://algs4.cs.princeton.edu/linux/checkstyle.xml wget http://algs4.cs.princeton.edu/linux/findbugs.xml wget http://algs4.cs.princeton.edu/linux/checkstyle wget http://algs4.cs.princeton.edu/linux/findbugs -chmod 700 checkstyle findbugs -mv checkstyle findbugs bin +wget http://algs4.cs.princeton.edu/linux/config.sh + +chmod 700 checkstyle findbugs config.sh +mv checkstyle findbugs config.sh bin mv checkstyle.xml checkstyle-5.5 mv findbugs.xml findbugs-2.0.1 -wget http://algs4.cs.princeton.edu/linux/config.sh -mv config.sh bin + +sed -i "s'INSTALL=.*$'INSTALL=$DST'" $DST/bin/checkstyle +sed -i "s'INSTALL=.*$'INSTALL=$DST'" $DST/bin/findbugs +sed -i "s'\(if \[.*$\)'\1\n\n\tDST=$DST'" $DST/bin/config.sh +sed -i "s'HOME\/algs4'DST'g" $DST/bin/config.sh popd |