Disable CoffeeScript evaluation until issue #92 is fixed

This commit is contained in:
walterhiggins 2013-08-11 22:15:19 +01:00
parent 9a9188cf47
commit d3831bb910
2 changed files with 35 additions and 18 deletions

View file

@ -1,6 +1,7 @@
<project name="scriptcraft" default="package" basedir="."> <project name="scriptcraft" default="package" basedir=".">
<property file="build.properties"/> <property file="build.properties"/>
<description>Builds the scriptcraft.jar file - a plugin for bukkit</description> <description>Builds the scriptcraft.jar file - a plugin for bukkit
</description>
<property name="src" location="src/main/java"/> <property name="src" location="src/main/java"/>
<property name="build" location="target/classes"/> <property name="build" location="target/classes"/>
<property name="dist" location="target/" /> <property name="dist" location="target/" />
@ -22,7 +23,8 @@
unless="minecraft.present"> unless="minecraft.present">
<mkdir dir="${minecraft.dir}" /> <mkdir dir="${minecraft.dir}" />
<echo>Retrieving CraftBukkit artifact info</echo> <echo>Retrieving CraftBukkit artifact info
</echo>
<get src="http://dl.bukkit.org/api/1.0/downloads/projects/CraftBukkit?_accept=application/xml" <get src="http://dl.bukkit.org/api/1.0/downloads/projects/CraftBukkit?_accept=application/xml"
dest="${minecraft.dir}/bukkit.xml" /> dest="${minecraft.dir}/bukkit.xml" />
@ -31,22 +33,22 @@
style="build/bukkit-to-url.xsl"/> style="build/bukkit-to-url.xsl"/>
<xmlproperty file="${minecraft.dir}/ant.properties.xml" keeproot="true"/> <xmlproperty file="${minecraft.dir}/ant.properties.xml" keeproot="true"/>
<echo>Retrieving CraftBukkit jar</echo> <echo>Retrieving CraftBukkit jar
</echo>
<get src="${bukkit.url}" <get src="${bukkit.url}"
dest="${minecraft.dir}/craftbukkit.jar" dest="${minecraft.dir}/craftbukkit.jar"
verbose="true"/> verbose="true"/>
<echo>Creating default ops.txt for your user</echo> <echo>Creating default ops.txt for your user
</echo>
<echo message="${op.name}" file="${minecraft.dir}/ops.txt" /> <echo message="${op.name}" file="${minecraft.dir}/ops.txt" />
<echo>Retrieving Coffeescript compiler</echo>
<mkdir dir="${minecraft.dir}/js-plugins/core" />
<get src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"
dest="${minecraft.dir}/js-plugins/core/_coffeescript.js"/>
</target> </target>
<target name="run" depends="server-setup, package, update-live-cb" description="Starts Bukkit with ScriptCraft"> <target name="run" depends="server-setup, package, update-live-cb" description="Starts Bukkit with ScriptCraft">
<echo>Starting Bukkit with ScriptCraft</echo> <echo>Starting Bukkit with ScriptCraft
</echo>
<java jar="${minecraft.dir}/craftbukkit.jar" <java jar="${minecraft.dir}/craftbukkit.jar"
maxmemory="1024m" maxmemory="1024m"
fork="true" fork="true"
@ -69,8 +71,19 @@
</java> </java>
</target> </target>
<target name="zip_js" depends="init"> <target name="coffeescript_setup" depends="init" description="Gets latest coffeescript compiler">
<zip zipfile="${build}/js-plugins.zip" basedir="./src/main/javascript"/> <echo>Retrieving Coffeescript compiler
</echo>
<mkdir dir="${build}/coffeescript/core" />
<get src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"
dest="${build}/coffeescript/core/_coffeescript.js"/>
</target>
<target name="zip_js" depends="coffeescript_setup">
<zip destfile="${build}/js-plugins.zip">
<zipfileset dir="./src/main/javascript" />
<zipfileset dir="${build}/coffeescript" />
</zip>
</target> </target>
<target name="package" depends="gendocs,zip_js,compile" <target name="package" depends="gendocs,zip_js,compile"
@ -79,7 +92,8 @@
<delete file="${build}/plugin.yml" /> <delete file="${build}/plugin.yml" />
<copy file="src/main/resources/plugin.yml" todir="${build}"/> <copy file="src/main/resources/plugin.yml" todir="${build}"/>
<replace file="${build}/plugin.yml" value="${bukkit-version}-${DSTAMP}"> <replace file="${build}/plugin.yml" value="${bukkit-version}-${DSTAMP}">
<replacetoken>[[version]]</replacetoken> <replacetoken>[[version]]
</replacetoken>
</replace> </replace>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->

View file

@ -99,10 +99,13 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
this.engine.put("__script",boot.getCanonicalPath().replaceAll("\\\\","/")); this.engine.put("__script",boot.getCanonicalPath().replaceAll("\\\\","/"));
reader = new FileReader(boot); reader = new FileReader(boot);
this.engine.eval(reader); this.engine.eval(reader);
/*
wph 20130811 Need to disable coffeescript support until issues loading and evaluating it are resolved.
See issue #92
// Load the CoffeeScript compiler // Load the CoffeeScript compiler
File coffeescript = new File(JS_PLUGINS_DIR + "/core/_coffeescript.js"); File coffeescript = new File(JS_PLUGINS_DIR + "/core/_coffeescript.js");
this.engine.eval(new FileReader(coffeescript)); this.engine.eval(new FileReader(coffeescript));
*/
}catch(Exception e){ }catch(Exception e){
e.printStackTrace(); e.printStackTrace();
@ -153,10 +156,10 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
this.engine.put("__cmdArgs",args); this.engine.put("__cmdArgs",args);
result = true; result = true;
} else if (cmd.getName().equalsIgnoreCase("coffee")) { } else if (cmd.getName().equalsIgnoreCase("coffee")) {
for (int i = 0;i < args.length; i++) for (int i = 0;i < args.length; i++)
javascriptCode += args[i] + " "; javascriptCode += args[i] + " ";
javascriptCode = "eval(CoffeeScript.compile(\""+javascriptCode+"\", {bare: true}))"; javascriptCode = "eval(CoffeeScript.compile(\""+javascriptCode+"\", {bare: true}))";
result = true; result = true;
} }
if (result){ if (result){