Difference between revisions of "JavascriptCompressionTesting"
Umar Sheikh (talk | contribs) m |
Umar Sheikh (talk | contribs) m (→Install instructions) |
||
| Line 21: | Line 21: | ||
[[Category:DevelopmentTeam]] | [[Category:DevelopmentTeam]] | ||
== Install instructions == | == Install instructions == | ||
| + | * Instructions taken from [http://www.mikechambers.com/blog/2003/12/06/shell-scripting-on-os-x-with-ecma-javascript/] | ||
# make sure you have java installed. You can check this by typing "java" at your command prompt and reading the output | # make sure you have java installed. You can check this by typing "java" at your command prompt and reading the output | ||
# download Rhino from [http://www.mozilla.org/rhino/download.html], (click on the "Rhino---.zip" file, the '---' representing version) | # download Rhino from [http://www.mozilla.org/rhino/download.html], (click on the "Rhino---.zip" file, the '---' representing version) | ||
| Line 30: | Line 31: | ||
alias js='java org.mozilla.javascript.tools.shell.Main' | alias js='java org.mozilla.javascript.tools.shell.Main' | ||
# close your shell prompt and reopen it to make the changes take effect | # close your shell prompt and reopen it to make the changes take effect | ||
| − | # Test your | + | # Test your installations: |
## create a js file, example helloworld.js, and write | ## create a js file, example helloworld.js, and write | ||
| − | + | ## print("Hello world"); | |
## save and close it | ## save and close it | ||
## run it by typing : | ## run it by typing : | ||
| − | + | ## java org.mozilla.javascript.tools.shell.Main helloworld.js | |
## your shell output should read: | ## your shell output should read: | ||
| − | + | ## Hello world | |
## Your are done! | ## Your are done! | ||
| − | ## | + | ## note: the line: "alias js='java org.mozilla.javascript.tools.shell.Main'" in the bashrc file enables you to write "js helloworld.js" instead of the lengthy "java org.mozilla.javascript.tools.shell.Main helloworld.js". |
</noinclude> | </noinclude> | ||
Revision as of 10:26, 31 January 2008
What (summary)
We want an automated test to make sure our javascript doesn't have invalid syntax that emerges when packed.
Why this is important
It is annoying to have to set $auPackJavascript = true; every time one wants to deploy new code. Setting javascript packing to false is useful to keep on during development.
DoneDone
If the javascript files contain a syntax error that causes decompression to fail, running "rake test integration" both show an error.
Steps to get to DoneDone
- Check to see how easy it is to get [Rhino|http://developer.mozilla.org/en/docs/Rhino_Shell] running on everyone's computer.
- Is it easy to install Java? If it seems like a too difficult process then forget about this entire task.
- On the other hand, there are many useful Java tools we may want to be able to use...and Mac OS already has it installed
- You'd probably want to distribute the Rhino [jar|http://www.mozilla.org/rhino/download.html] with the repo.
- Shelling out to the command line is probably how to go.
- Even if this doesn't prove useful I'm curious to know how it worked. -Stephen Judkins 23:51, 30 January 2008 (PST)
- useful link: [1]
Install instructions
- Instructions taken from [2]
- make sure you have java installed. You can check this by typing "java" at your command prompt and reading the output
- download Rhino from [3], (click on the "Rhino---.zip" file, the '---' representing version)
- unzip it, and copy the "js.jar" file to "/www/sites/branches/classpath/js.jar"
- open up your .bashrc file to export path to the jar file. Your paths shoudl look like this:
CLASSPATH="/www/sites/classpath:/www/sites/classpath/js.jar" PATH="/www/bin:/www/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/s bin:/bin:/usr/games" export PATH CLASSPATH alias js='java org.mozilla.javascript.tools.shell.Main'
- close your shell prompt and reopen it to make the changes take effect
- Test your installations:
- create a js file, example helloworld.js, and write
- print("Hello world");
- save and close it
- run it by typing :
- java org.mozilla.javascript.tools.shell.Main helloworld.js
- your shell output should read:
- Hello world
- Your are done!
- note: the line: "alias js='java org.mozilla.javascript.tools.shell.Main'" in the bashrc file enables you to write "js helloworld.js" instead of the lengthy "java org.mozilla.javascript.tools.shell.Main helloworld.js".

