Rhino: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<source lang="bash"> | <source lang="bash"> | ||
sudo wget -c https://github.com/mozilla/rhino/releases/download\ | sudo wget -c https://github.com/mozilla/rhino/releases/download\ | ||
/Rhino1_7_14_Release/rhino-1.7.14.zip -P /opt/cli/ | /Rhino1_7_14_Release/rhino-1.7.14.zip -P /opt/cli/ | ||
sudo unzip | sudo unzip -q /opt/cli/rhino-1.7.14.zip -d /opt/cli/ | ||
sudo rm -rf /opt/cli/rhino-1.7.14.zip | sudo rm -rf /opt/cli/rhino-1.7.14.zip | ||
sudo rm -rf /opt/cli/rhino1.7.14\ | sudo rm -rf /opt/cli/rhino1.7.14\ | ||
/{src,docs,*gradle*,*.txt,*.md} | /{src,docs,*gradle*,*.txt,*.md} | ||
</source> | </source> | ||
Line 12: | Line 12: | ||
<source lang="bash"> | <source lang="bash"> | ||
sudo mkdir -p /opt/cli/rhino1.7.14/bin | sudo mkdir -p /opt/cli/rhino1.7.14/bin | ||
sudo touch /opt/cli/rhino1.7.14/bin/rhino | |||
sudo chmod +x /opt/cli/rhino1.7.14/bin/rhino | |||
sudo tee -a /opt/cli/rhino1.7.14/bin/rhino >/dev/null <<'EOF' | sudo tee -a /opt/cli/rhino1.7.14/bin/rhino >/dev/null <<'EOF' | ||
#!/bin/bash | #!/bin/bash | ||
Line 22: | Line 24: | ||
export RHINO_HOME='/opt/cli/rhino1.7.14' | export RHINO_HOME='/opt/cli/rhino1.7.14' | ||
export RHINO_EXEC="java -jar ${RHINO_HOME}/lib/rhino-1.7.14.jar | export RHINO_EXEC="java -jar ${RHINO_HOME}/lib/rhino-1.7.14.jar" | ||
if [ -f "${JAVA_HOME}/bin/java" ];then ${JAVA_HOME}/bin/${RHINO_EXEC} | if [[ "${@}/arg/is/empty" != '/arg/is/empty' ]];then export RHINO_EXEC="${RHINO_EXEC} ${@}" | ||
else export RHINO_EXEC="${RHINO_EXEC} -debug -version 200";fi | |||
if [ -f "${JAVA_HOME}/bin/java" ];then ${JAVA_HOME}/bin/${RHINO_EXEC} | |||
elif [ -x "$(command -v java)" ];then ${RHINO_EXEC} | elif [ -x "$(command -v java)" ];then ${RHINO_EXEC} | ||
else printf '\njava | else printf '\njava \033[0;31mnot found! \033[0m:(\n';fi | ||
EOF | EOF | ||
</source> | |||
<source lang="bash"> | |||
sudo update-alternatives --install /usr/bin/rhino rhino\ | |||
/opt/cli/rhino1.7.14/bin/rhino 1983 | |||
</source> | |||
==Web Install== | |||
<source lang="bash"> | |||
sudo apt -qq update;\ | |||
bash <(curl -s 'https://cdn.chorke.org/exec/cli/bash/install/rhino/1.7.14.sh.txt') | |||
</source> | |||
==Examples== | |||
<source lang="bash"> | |||
rhino | |||
:' | |||
Rhino 1.7.14 | |||
js> load('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js'); | |||
js> var today = new Date(); | |||
js> var format = 'DD/MMM/YYYY'; | |||
js> var thisDate = moment(today).format(format); | |||
js> var nextDate = moment(today).add(1, 'months').format(format); | |||
js> thisDate | |||
10/Jul/2022 | |||
js> nextDate | |||
10/Aug/2022 | |||
js> | |||
' | |||
</source> | |||
==Knowledge== | |||
<source lang="bash"> | |||
(umask 022;\ | |||
touch /opt/cli/rhino1.7.14/bin/rhino) | |||
sudo chmod +x /opt/cli/rhino1.7.14/bin/rhino | sudo chmod +x /opt/cli/rhino1.7.14/bin/rhino | ||
stat -c '%a' /opt/cli/rhino1.7.14/bin/rhino | |||
stat /opt/cli/rhino1.7.14/bin/rhino | |||
</source> | </source> | ||
Line 37: | Line 78: | ||
* [https://www.googlecloudcommunity.com/gc/Apigee/Rhino-Cannot-modify-a-property-of-a-sealed-object/m-p/33852/highlight/true Rhino » Modify a Property of a Sealed Object] | * [https://www.googlecloudcommunity.com/gc/Apigee/Rhino-Cannot-modify-a-property-of-a-sealed-object/m-p/33852/highlight/true Rhino » Modify a Property of a Sealed Object] | ||
* [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Embedding_tutorial#usingJSObjs Rhino » Embedding Tutorial Using JS Object] | * [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Embedding_tutorial#usingJSObjs Rhino » Embedding Tutorial Using JS Object] | ||
* [https://stackoverflow.com/questions/69096454/ Rhino » Instantiate AJV JSON Schema] | |||
* [https://stackoverflow.com/questions/3995897 Rhino » Call JS function from Java] | * [https://stackoverflow.com/questions/3995897 Rhino » Call JS function from Java] | ||
* [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Embedding_tutorial Rhino » Embedding Tutorial] | * [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Embedding_tutorial Rhino » Embedding Tutorial] | ||
Line 42: | Line 84: | ||
* [https://dxr.mozilla.org/mozilla/source/js/rhino/examples Rhino » Examples] | * [https://dxr.mozilla.org/mozilla/source/js/rhino/examples Rhino » Examples] | ||
* [https://github.com/mozilla/rhino/releases Rhino » Release] | * [https://github.com/mozilla/rhino/releases Rhino » Release] | ||
* [ | * [https://www-archive.mozilla.org/rhino/shell Rhino » Shell] | ||
* [[Ant]] | * [[Ant]] | ||
| valign="top" | | | valign="top" | | ||
Line 52: | Line 93: | ||
* [[JSON Schema Validation]] | * [[JSON Schema Validation]] | ||
* [https://github.com/jgraph/drawio-desktop DrawIO Desktop] | * [https://github.com/jgraph/drawio-desktop DrawIO Desktop] | ||
* [[Nashorn]] | |||
* [[Maven]] | |||
* [[ExtJS]] | * [[ExtJS]] | ||
* [[J2V8]] | * [[J2V8]] | ||
* [[Ivy]] | |||
| valign="top" | | | valign="top" | | ||
* [[Yarn]] | |||
* [[NPM]] | |||
|- | |- |
Latest revision as of 07:36, 24 January 2024
sudo wget -c https://github.com/mozilla/rhino/releases/download\
/Rhino1_7_14_Release/rhino-1.7.14.zip -P /opt/cli/
sudo unzip -q /opt/cli/rhino-1.7.14.zip -d /opt/cli/
sudo rm -rf /opt/cli/rhino-1.7.14.zip
sudo rm -rf /opt/cli/rhino1.7.14\
/{src,docs,*gradle*,*.txt,*.md}
sudo mkdir -p /opt/cli/rhino1.7.14/bin
sudo touch /opt/cli/rhino1.7.14/bin/rhino
sudo chmod +x /opt/cli/rhino1.7.14/bin/rhino
sudo tee -a /opt/cli/rhino1.7.14/bin/rhino >/dev/null <<'EOF'
#!/bin/bash
: '
@vendor Chorke Academia, Inc.
@web https://cdn.chorke.org/docs/academia
@version 1.0.00
@since 1.0.00
'
export RHINO_HOME='/opt/cli/rhino1.7.14'
export RHINO_EXEC="java -jar ${RHINO_HOME}/lib/rhino-1.7.14.jar"
if [[ "${@}/arg/is/empty" != '/arg/is/empty' ]];then export RHINO_EXEC="${RHINO_EXEC} ${@}"
else export RHINO_EXEC="${RHINO_EXEC} -debug -version 200";fi
if [ -f "${JAVA_HOME}/bin/java" ];then ${JAVA_HOME}/bin/${RHINO_EXEC}
elif [ -x "$(command -v java)" ];then ${RHINO_EXEC}
else printf '\njava \033[0;31mnot found! \033[0m:(\n';fi
EOF
sudo update-alternatives --install /usr/bin/rhino rhino\
/opt/cli/rhino1.7.14/bin/rhino 1983
Web Install
sudo apt -qq update;\
bash <(curl -s 'https://cdn.chorke.org/exec/cli/bash/install/rhino/1.7.14.sh.txt')
Examples
rhino
:'
Rhino 1.7.14
js> load('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js');
js> var today = new Date();
js> var format = 'DD/MMM/YYYY';
js> var thisDate = moment(today).format(format);
js> var nextDate = moment(today).add(1, 'months').format(format);
js> thisDate
10/Jul/2022
js> nextDate
10/Aug/2022
js>
'
Knowledge
(umask 022;\
touch /opt/cli/rhino1.7.14/bin/rhino)
sudo chmod +x /opt/cli/rhino1.7.14/bin/rhino
stat -c '%a' /opt/cli/rhino1.7.14/bin/rhino
stat /opt/cli/rhino1.7.14/bin/rhino
References
| ||