diff --git a/algs4/download-others b/algs4/download-others new file mode 100755 index 0000000..cbf8e8c --- /dev/null +++ b/algs4/download-others @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e +set -x + +OTHERS=" +11model/RightTriangle.java +11model/Tone.java +11model/Scale.java +11model/Binomial.java +11model/Wget.java +" + +cd src/java + +for other in $OTHERS +do + bn=$(basename "$other") + if [ ! -f "$bn" ] + then + curl -O "http://algs4.cs.princeton.edu/${other}" + chmod 444 "$bn" + fi +done diff --git a/algs4/extract-jars b/algs4/extract-jars index 055fb55..0e4c0da 100755 --- a/algs4/extract-jars +++ b/algs4/extract-jars @@ -1,9 +1,11 @@ #!/bin/bash set -e +set -x cd src/java -chmod 644 *.java *.class *.jar +chmod 644 *.java *.class jar xf ../../algs4.jar jar xf ../../stdlib.jar -chmod 444 *.java *.class *.jar +rm stdlib.jar +chmod 444 *.java *.class diff --git a/algs4/setup b/algs4/setup index 229e9e5..29720d2 100755 --- a/algs4/setup +++ b/algs4/setup @@ -4,49 +4,6 @@ set -e set -x mkdir -p bin -test -f drjava.jar || wget http://algs4.cs.princeton.edu/linux/drjava.jar -if [ ! -f bin/drjava ] -then - wget http://algs4.cs.princeton.edu/linux/drjava - chmod 700 drjava - mv drjava bin/ -fi -test -f stdlib.jar || wget http://algs4.cs.princeton.edu/code/stdlib.jar -test -f algs4.jar || wget http://algs4.cs.princeton.edu/code/algs4.jar -if [ ! -d checkstyle-5.4 ] -then - wget http://algs4.cs.princeton.edu/linux/checkstyle.zip - unzip checkstyle.zip -fi -if [ ! -d findbugs-1.3.9 ] -then - wget http://algs4.cs.princeton.edu/linux/findbugs.zip - unzip findbugs.zip -fi -if [ ! -f checkstyle-5.4/checkstyle.xml ] -then - wget http://algs4.cs.princeton.edu/linux/checkstyle.xml - mv checkstyle.xml checkstyle-5.4 -fi -if [ ! -f findbugs-1.3.9/findbugs.xml ] -then - wget http://algs4.cs.princeton.edu/linux/findbugs.xml - mv findbugs.xml findbugs-1.3.9 -fi -if [ ! -f bin/checkstyle ] -then - wget http://algs4.cs.princeton.edu/linux/checkstyle - chmod 700 checkstyle - mv checkstyle bin -fi -if [ ! -f bin/findbugs ] -then - wget http://algs4.cs.princeton.edu/linux/findbugs - chmod 700 findbugs - mv findbugs bin -fi -if [ ! -f bin/config.sh ] -then - wget http://algs4.cs.princeton.edu/linux/config.sh - mv config.sh bin -fi +./setup-algs4-stuff +./extract-jars +./download-others diff --git a/algs4/setup-algs4-stuff b/algs4/setup-algs4-stuff new file mode 100755 index 0000000..4fb05b9 --- /dev/null +++ b/algs4/setup-algs4-stuff @@ -0,0 +1,51 @@ +#!/bin/bash + +set -e +set -x + +test -f drjava.jar || wget http://algs4.cs.princeton.edu/linux/drjava.jar +if [ ! -f bin/drjava ] +then + wget http://algs4.cs.princeton.edu/linux/drjava + chmod 700 drjava + mv drjava bin/ +fi +test -f stdlib.jar || wget http://algs4.cs.princeton.edu/code/stdlib.jar +test -f algs4.jar || wget http://algs4.cs.princeton.edu/code/algs4.jar +if [ ! -d checkstyle-5.4 ] +then + wget http://algs4.cs.princeton.edu/linux/checkstyle.zip + unzip checkstyle.zip +fi +if [ ! -d findbugs-1.3.9 ] +then + wget http://algs4.cs.princeton.edu/linux/findbugs.zip + unzip findbugs.zip +fi +if [ ! -f checkstyle-5.4/checkstyle.xml ] +then + wget http://algs4.cs.princeton.edu/linux/checkstyle.xml + mv checkstyle.xml checkstyle-5.4 +fi +if [ ! -f findbugs-1.3.9/findbugs.xml ] +then + wget http://algs4.cs.princeton.edu/linux/findbugs.xml + mv findbugs.xml findbugs-1.3.9 +fi +if [ ! -f bin/checkstyle ] +then + wget http://algs4.cs.princeton.edu/linux/checkstyle + chmod 700 checkstyle + mv checkstyle bin +fi +if [ ! -f bin/findbugs ] +then + wget http://algs4.cs.princeton.edu/linux/findbugs + chmod 700 findbugs + mv findbugs bin +fi +if [ ! -f bin/config.sh ] +then + wget http://algs4.cs.princeton.edu/linux/config.sh + mv config.sh bin +fi diff --git a/algs4/src/java/.gitignore b/algs4/src/java/.gitignore index 0570439..63f5374 100644 --- a/algs4/src/java/.gitignore +++ b/algs4/src/java/.gitignore @@ -152,3 +152,8 @@ /StdRandom.java /StdStats.java /mandrill.jpg +/Binomial.java +/RightTriangle.java +/Scale.java +/Tone.java +/Wget.java