From ca3af60029dc98082b5de42c730286ba24beb426 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 21 Nov 2016 12:34:15 -0500 Subject: [PATCH] Hatch docs/scripts consolidation; linux/windows host json files Signed-off-by: Bill Erickson --- INSTALL.adoc | 33 ++++++--- README.linux | 33 --------- README.win | 68 ------------------- extension/app/README | 5 -- extension/host/README | 13 ---- ...son => org.evergreen_ils.hatch.json.LINUX} | 2 +- .../host/org.evergreen_ils.hatch.json.WINDOWS | 9 +++ hatch.bat | 7 ++ run.sh => hatch.sh | 13 ++-- run-win.bat | 6 -- start-hatch | 3 - 11 files changed, 44 insertions(+), 148 deletions(-) delete mode 100644 README.linux delete mode 100644 README.win delete mode 100644 extension/app/README delete mode 100644 extension/host/README rename extension/host/{org.evergreen_ils.hatch.json => org.evergreen_ils.hatch.json.LINUX} (79%) create mode 100644 extension/host/org.evergreen_ils.hatch.json.WINDOWS create mode 100755 hatch.bat rename run.sh => hatch.sh (75%) delete mode 100644 run-win.bat delete mode 100755 start-hatch diff --git a/INSTALL.adoc b/INSTALL.adoc index d9543b70cd..9a94eccf6a 100644 --- a/INSTALL.adoc +++ b/INSTALL.adoc @@ -39,7 +39,7 @@ $ cd ../ [source,sh] ------------------------------------------------------------------------- -$ ./run.sh compile +$ ./hatch.sh compile ------------------------------------------------------------------------- ==== Test Hatch Java ==== @@ -48,7 +48,7 @@ Assuming the Java code compiles OK, this will run a series of tests. [source,sh] ------------------------------------------------------------------------- -$ ./run.sh test +$ ./hatch.sh test ------------------------------------------------------------------------- NOTE: print commands are disabled by default in the tests to avoid @@ -62,14 +62,14 @@ them in src/org/evergreen_ils/hatch/TestHatch.java and recompiling. ==== Tweak Extension Values ==== -Edit extension/app/manifest.json and change the "eg-dev-local" value found -here to the hostname of your Evergreen server. +Edit extension/app/manifest.json and change the "egserver.example.org" value +found here to the hostname of your Evergreen server. [source,js] ------------------------------------------------------------------------- ... "externally_connectable": { - "matches": ["*://eg-dev-local/*"] + "matches": ["*://egserver.example.org/*"] } ... ------------------------------------------------------------------------- @@ -93,14 +93,23 @@ patches included in the http://git.evergreen-ils.org/?p=working/Evergreen.git;a= === Setup Chrome Native Messaging Host === -Edit extension/host/org.evergreen_ils.hatch.json and change the "path" value -to match the location of your copy of "start-hatch", found in the root +==== Linux ==== + +Edit extension/host/org.evergreen_ils.hatch.json.LINUX and change the "path" +value to match the location of your copy of "hatch.sh", found in the root directory of the Hatch repository. +==== Windows ==== + +Edit extension/host/org.evergreen_ils.hatch.json.WINDOWS and change the +"path" value to match the location of your copy of "hatch.bat", found in the +root directory of the Hatch repository. + + [source,js] ------------------------------------------------------------------------- ... - "path": "/home/berick/code/Hatch/start-hatch", + "path": "/home/berick/code/Hatch/hatchsh", ... ------------------------------------------------------------------------- @@ -119,14 +128,16 @@ For Chrome: [source,sh] ------------------------------------------------------------------------- $ mkdir -p ~/.config/google-chrome/NativeMessagingHosts/ -$ cp extension/host/org.evergreen_ils.hatch.json ~/.config/google-chrome/NativeMessagingHosts/ +$ cp extension/host/org.evergreen_ils.hatch.json.LINUX \ + ~/.config/google-chrome/NativeMessagingHosts/org.evergreen_ils.hatch.json ------------------------------------------------------------------------- For Chromium: + [source,sh] ------------------------------------------------------------------------- $ mkdir -p ~/.config/chromium/NativeMessagingHosts/ -$ cp extension/host/org.evergreen_ils.hatch.json ~/.config/chromium/NativeMessagingHosts/ +$ cp extension/host/org.evergreen_ils.hatch.json.LINUX \ + ~/.config/chromium/NativeMessagingHosts/org.evergreen_ils.hatch.json ------------------------------------------------------------------------- - diff --git a/README.linux b/README.linux deleted file mode 100644 index 780f856b47..0000000000 --- a/README.linux +++ /dev/null @@ -1,33 +0,0 @@ -Hatch Developer Install Notes - -1. Download JDK 8 from Oracle - - 1.a Go here, accept the license, and download the Linux .tar.gz: - - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html - - 1.b Extract the file and link it into place where run.sh can find it. - - $ tar -zxf jdk*tar.gz - $ ln -s jdk1.8* jdk1.8 - - NOTE: We may some day use openjdk, but its JavaFX libs are not ready - for prime time as of writing. - -2. Get the org.json library - - $ mkdir -p lib - $ cd lib - $ wget -O json-20160810.jar \ - 'https://search.maven.org/remotecontent?filepath=org/json/json/20160810/json-20160810.jar' - $ cd ../ - -3. Compile, test, run. - -$ ./run.sh compile - -$ ./run.sh test - -$ ./run.sh run - - diff --git a/README.win b/README.win deleted file mode 100644 index a0dc37a3cb..0000000000 --- a/README.win +++ /dev/null @@ -1,68 +0,0 @@ -Hatch - Java Print / Storage / Etc Service - -** ROUGH SETUP NOTES ** - -!!! TODO: refactor these for hatch-as-native-messaging-host changes !!! - -Install Hatch on your desktop -- Windows edition: - -If you're reading this online, first download hatch to your desktop. - -The canonical location for this project is: -http://git.evergreen-ils.org/?p=Hatch.git - -But a convenient snapshot as of 2015-08-20 is here: -https://github.com/phasefx/random/archive/hatch.zip - -Unzip the file wherever you'd like to install the application, such as in C:\Program Files\ - -Then go to http://download.eclipse.org/jetty/ - -Download the latest stable-9 .zip version into the same directory as this README file. - -Unzip and rename the folder to "jetty". - -Then go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html - -Download the Development Kit .exe for your version of Windows. - -Install it. - -In the same directory as this README file, create a subdirectory named "lib". - -Then go to http://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util-ajax - -Download the latest 9.2.x .jar file into the "lib" directory. - -Create a dummy SSL certificate for Jetty. -For step 2, modify the JDK path to match your version/location. -The password used when creating the certicate will have to be added -to hatch.xml, unless you use "password". -1. cd jetty\etc -2. C:\"Program Files"\Java\jdk1.8.0_60\bin\keytool.exe -keystore keystore -alias jetty -genkey -keyalg RSA - -Edit the run-win.bat file, and, if needed, change the JAVA_HOME variable to the location where you installed the Java Development Kit. In my case, I changed the line: - -SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_20" - -to - -SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_31" - -Then open a Command window and cd into the same directory as this README file. One easy way to do this is to click into the address of the bar of window displaying the directory, typing "cmd" and pressing enter. - -Then enter: -run-win.bat - -Choose Allow for any Firewall/Security prompt. - -Then go to https://localhost:8443/ in Chrome and click through the security warning. -(In my case, I clicked on the link "Advanced" and then "Proceed to localhost (unsafe)") - -You should expect a 404 Not Found page. - -Then open the browser client. - -Set "This workstation uses a remote print / storage service ("Hatch")?" under Admin -> Workstation - -Optionally configure / test printing diff --git a/extension/app/README b/extension/app/README deleted file mode 100644 index 4a326caaa8..0000000000 --- a/extension/app/README +++ /dev/null @@ -1,5 +0,0 @@ - -See "Load unpacked extension" from: - -https://developer.chrome.com/extensions/getstarted - diff --git a/extension/host/README b/extension/host/README deleted file mode 100644 index fea5b3162f..0000000000 --- a/extension/host/README +++ /dev/null @@ -1,13 +0,0 @@ -https://developer.chrome.com/extensions/nativeMessaging - -1. Edit org.evergreen_ils.hatch.json "path" variable -2. Copy org.evergreen_ils.hatch.json to: - -Windows: - TODO - -Linux: - - Google Chrome: ~/.config/google-chrome/NativeMessagingHosts/ - - Chromium: ~/.config/chromium/NativeMessagingHosts/ diff --git a/extension/host/org.evergreen_ils.hatch.json b/extension/host/org.evergreen_ils.hatch.json.LINUX similarity index 79% rename from extension/host/org.evergreen_ils.hatch.json rename to extension/host/org.evergreen_ils.hatch.json.LINUX index 49640a5055..426133f884 100644 --- a/extension/host/org.evergreen_ils.hatch.json +++ b/extension/host/org.evergreen_ils.hatch.json.LINUX @@ -1,7 +1,7 @@ { "name": "org.evergreen_ils.hatch", "description": "Hatch Native Messaging Host", - "path": "/home/berick/code/Hatch/start-hatch", + "path": "/home/berick/code/Hatch/hatch.sh", "type": "stdio", "allowed_origins": [ "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/" diff --git a/extension/host/org.evergreen_ils.hatch.json.WINDOWS b/extension/host/org.evergreen_ils.hatch.json.WINDOWS new file mode 100644 index 0000000000..7335af72cb --- /dev/null +++ b/extension/host/org.evergreen_ils.hatch.json.WINDOWS @@ -0,0 +1,9 @@ +{ + "name": "org.evergreen_ils.hatch", + "description": "Hatch Native Messaging Host", + "path": "C:\\Users\berick\Code\Hatch\hatch.bat", + "type": "stdio", + "allowed_origins": [ + "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/" + ] +} diff --git a/hatch.bat b/hatch.bat new file mode 100755 index 0000000000..125bc3c31f --- /dev/null +++ b/hatch.bat @@ -0,0 +1,7 @@ +REM Windows Hatch Execution Script + +SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_60" + +%JAVA_HOME%\bin\javac -cp "lib\*" -Xdiags:verbose -d lib src\org\evergreen_ils\hatch\*.java + +%JAVA_HOME%\bin\java -cp "lib\*;lib" org.evergreen_ils.hatch.Hatch diff --git a/run.sh b/hatch.sh similarity index 75% rename from run.sh rename to hatch.sh index 4ef34dde22..20627e8994 100755 --- a/run.sh +++ b/hatch.sh @@ -1,15 +1,17 @@ #!/bin/bash +# +# Linux/Mac Hatch Execution Script JAVA_HOME=jdk1.8 JAVA=$JAVA_HOME/bin/java -#LOGS=-Djava.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$-6s %5$s%6$s%n' +JAVAC=$JAVA_HOME/bin/javac LOGS=-Djava.util.logging.config.file=logging.properties COMMAND="$1" if [ "$COMMAND" == "compile" ]; then - $JAVA_HOME/bin/javac -Xdiags:verbose -Xlint:unchecked \ + $JAVAC -Xdiags:verbose -Xlint:unchecked \ -cp lib:lib/\* -d lib src/org/evergreen_ils/hatch/*.java elif [ "$COMMAND" == "test" ]; then @@ -22,13 +24,8 @@ elif [ "$COMMAND" == "test" ]; then | $JAVA "$LOGS" -cp lib:lib/\* org.evergreen_ils.hatch.Hatch \ | $JAVA "$LOGS" -cp lib:lib/\* org.evergreen_ils.hatch.TestHatch receive -elif [ "$COMMAND" == "run" ]; then +else # run Hatch $JAVA "$LOGS" -cp lib:lib/\* org.evergreen_ils.hatch.Hatch - -else - - echo "Usage: $0 [compile|test|run]"; - fi; diff --git a/run-win.bat b/run-win.bat deleted file mode 100644 index 59ac9c5aa6..0000000000 --- a/run-win.bat +++ /dev/null @@ -1,6 +0,0 @@ -SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_31" -SET JETTY_HOME=jetty - -%JAVA_HOME%\bin\javac -cp "%JETTY_HOME%\lib\*;%JETTY_HOME%\lib\websocket\*;lib\*" -Xdiags:verbose -d lib src\org\evergreen_ils\hatch\*.java - -%JAVA_HOME%\bin\java -cp "%JETTY_HOME%\lib\*;%JETTY_HOME%\lib\websocket\*;lib\*;lib" org.evergreen_ils.hatch.Hatch diff --git a/start-hatch b/start-hatch deleted file mode 100755 index f0995ad292..0000000000 --- a/start-hatch +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -./run.sh run -- 2.43.2