Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CoffeeScript 0.3.2, just in time for the Github feature

  • Loading branch information...
commit e2d75e6771c3765c2623019e8123a48756e5f1e2 1 parent 1aa966b
@jashkenas jashkenas authored
View
4 coffee-script.gemspec
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'coffee-script'
- s.version = '0.3.1' # Keep version in sync with coffee-script.rb
- s.date = '2010-1-27'
+ s.version = '0.3.2' # Keep version in sync with coffee-script.rb
+ s.date = '2010-2-8'
s.homepage = "http://jashkenas.github.com/coffee-script/"
s.summary = "The CoffeeScript Compiler"
View
2  documentation/coffee/aliases.coffee
@@ -5,3 +5,5 @@ volume: 10 if band isnt spinal_tap
let_the_wild_rumpus_begin() unless answer is no
if car.speed < speed_limit then accelerate()
+
+print "My name is " + @name
View
6 documentation/coffee/fat_arrow.coffee
@@ -1,6 +1,6 @@
Account: (customer, cart) ->
- this.customer: customer
- this.cart: cart
+ @customer: customer
+ @cart: cart
$('.shopping_cart').bind 'click', (event) =>
- this.customer.purchase this.cart
+ @customer.purchase @cart
View
6 documentation/coffee/super.coffee
@@ -1,14 +1,14 @@
Animal: ->
Animal::move: (meters) ->
- alert this.name + " moved " + meters + "m."
+ alert @name + " moved " + meters + "m."
-Snake: (name) -> this.name: name
+Snake: (name) -> @name: name
Snake extends Animal
Snake::move: ->
alert "Slithering..."
super 5
-Horse: (name) -> this.name: name
+Horse: (name) -> @name: name
Horse extends Animal
Horse::move: ->
alert "Galloping..."
View
24 documentation/index.html.erb
@@ -51,7 +51,7 @@
<p>
<b>Latest Version:</b>
- <a href="http://gemcutter.org/gems/coffee-script">0.3.1</a>
+ <a href="http://gemcutter.org/gems/coffee-script">0.3.2</a>
</p>
<h2>Table of Contents</h2>
@@ -118,7 +118,7 @@ gem install coffee-script</pre>
Installing the gem provides the <tt>coffee</tt> command, which can
be used to compile CoffeeScript <tt>.coffee</tt> files into JavaScript, as
well as debug them. In conjunction with
- <a href="http://nodejs.org/">Node.js</a>, the <tt>coffee</tt>
+ <a href="http://nodejs.org/">Node.js</a> (or <a href="http://narwhaljs.org/">Narwhal</a>), the <tt>coffee</tt>
command also provides direct evaluation and an interactive REPL.
When compiling to JavaScript, <tt>coffee</tt> writes the output
as <tt>.js</tt> files in the same directory by default, but output
@@ -130,14 +130,16 @@ gem install coffee-script</pre>
<td width="25%"><code>-i, --interactive</code></td>
<td>
Launch an interactive CoffeeScript session.
- Requires <a href="http://nodejs.org/">Node.js</a>.
+ Requires <a href="http://nodejs.org/">Node.js</a>,
+ or <a href="http://narwhaljs.org/">Narwhal</a>, with <tt>--narwhal</tt>.
</td>
</tr>
<tr>
<td><code>-r, --run</code></td>
<td>
Compile and execute scripts without saving the intermediate
- JavaScript. Requires <a href="http://nodejs.org/">Node.js</a>.
+ JavaScript. Requires <a href="http://nodejs.org/">Node.js</a>,
+ or <a href="http://narwhaljs.org/">Narwhal</a>, with <tt>--narwhal</tt>.
</td>
</tr>
<tr>
@@ -367,6 +369,9 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
<p>
For single-line statements, <tt>unless</tt> can be used as the inverse of <tt>if</tt>.
</p>
+ <p>
+ As a shortcut for <tt>this.property</tt>, you can use <tt>@property</tt>.
+ </p>
<%= code_for('aliases') %>
<p id="splats">
@@ -624,10 +629,10 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
<ul>
<li>
<a href="http://github.com/jashkenas/coffee-script/">Source Code</a><br />
- After checking out the source, make sure to run <tt>rake build:parser</tt>
- to generate an up-to-date version of the Racc parser.
Use <tt>bin/coffee</tt> to test your changes,
<tt>rake test</tt> to run the test suite,
+ <tt>rake build:parser</tt> to regenerate the Racc parser if you're
+ working on the grammar,
and <tt>rake gem:install</tt> to
create and install a custom version of the gem.
</li>
@@ -663,6 +668,13 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
</ul>
<h2 id="change_log">Change Log</h2>
+
+ <p>
+ <b class="header" style="margin-top: 20px;">0.3.2</b>
+ <tt>@property</tt> is now a shorthand for <tt>this.property</tt>.<br />
+ Switched the default JavaScript engine from Narwhal to Node.js. Pass
+ the <tt>--narwhal</tt> flag if you'd like to continue using it.
+ </p>
<p>
<b class="header" style="margin-top: 20px;">0.3.0</b>
View
1  documentation/js/aliases.js
@@ -10,4 +10,5 @@
let_the_wild_rumpus_begin();
}
car.speed < speed_limit ? accelerate() : null;
+ print("My name is " + this.name);
})();
View
2  documentation/js/existence.js
@@ -1,6 +1,6 @@
(function(){
var solipsism, speed;
- if ((typeof mind !== "undefined" && mind !== null) && !(typeof world !== "undefined" && world !== null)) {
+ if ((typeof mind !== "undefined" && mind !== null) && (typeof !world !== "undefined" && !world !== null)) {
solipsism = true;
}
speed = (typeof speed !== "undefined" && speed !== null) ? speed : 140;
View
43 index.html
@@ -37,7 +37,7 @@
<p>
<b>Latest Version:</b>
- <a href="http://gemcutter.org/gems/coffee-script">0.3.1</a>
+ <a href="http://gemcutter.org/gems/coffee-script">0.3.2</a>
</p>
<h2>Table of Contents</h2>
@@ -215,7 +215,7 @@ <h2 id="installation">Installation and Usage</h2>
Installing the gem provides the <tt>coffee</tt> command, which can
be used to compile CoffeeScript <tt>.coffee</tt> files into JavaScript, as
well as debug them. In conjunction with
- <a href="http://nodejs.org/">Node.js</a>, the <tt>coffee</tt>
+ <a href="http://nodejs.org/">Node.js</a> (or <a href="http://narwhaljs.org/">Narwhal</a>), the <tt>coffee</tt>
command also provides direct evaluation and an interactive REPL.
When compiling to JavaScript, <tt>coffee</tt> writes the output
as <tt>.js</tt> files in the same directory by default, but output
@@ -227,14 +227,16 @@ <h2 id="installation">Installation and Usage</h2>
<td width="25%"><code>-i, --interactive</code></td>
<td>
Launch an interactive CoffeeScript session.
- Requires <a href="http://nodejs.org/">Node.js</a>.
+ Requires <a href="http://nodejs.org/">Node.js</a>,
+ or <a href="http://narwhaljs.org/">Narwhal</a>, with <tt>--narwhal</tt>.
</td>
</tr>
<tr>
<td><code>-r, --run</code></td>
<td>
Compile and execute scripts without saving the intermediate
- JavaScript. Requires <a href="http://nodejs.org/">Node.js</a>.
+ JavaScript. Requires <a href="http://nodejs.org/">Node.js</a>,
+ or <a href="http://narwhaljs.org/">Narwhal</a>, with <tt>--narwhal</tt>.
</td>
</tr>
<tr>
@@ -557,6 +559,9 @@ <h2 id="installation">Installation and Usage</h2>
<p>
For single-line statements, <tt>unless</tt> can be used as the inverse of <tt>if</tt>.
</p>
+ <p>
+ As a shortcut for <tt>this.property</tt>, you can use <tt>@property</tt>.
+ </p>
<div class='code'><pre class="idle">launch() <span class="Keyword">if</span> ignition <span class="Keyword">is</span> <span class="BuiltInConstant">on</span>
<span class="FunctionName">volume</span><span class="Keyword">:</span> <span class="Number">10</span> <span class="Keyword">if</span> band <span class="Keyword">isnt</span> spinal_tap
@@ -564,6 +569,8 @@ <h2 id="installation">Installation and Usage</h2>
let_the_wild_rumpus_begin() <span class="Keyword">unless</span> answer <span class="Keyword">is</span> <span class="BuiltInConstant">no</span>
<span class="Keyword">if</span> car.speed <span class="Keyword">&lt;</span> speed_limit <span class="Keyword">then</span> accelerate()
+
+print <span class="String"><span class="String">&quot;</span>My name is <span class="String">&quot;</span></span> <span class="Keyword">+</span> <span class="Variable">@name</span>
</pre><pre class="idle"><span class="Storage">var</span> volume;
<span class="Keyword">if</span> (ignition <span class="Keyword">===</span> <span class="BuiltInConstant">true</span>) {
launch();
@@ -575,6 +582,7 @@ <h2 id="installation">Installation and Usage</h2>
let_the_wild_rumpus_begin();
}
car.speed <span class="Keyword">&lt;</span> speed_limit ? accelerate() : <span class="BuiltInConstant">null</span>;
+<span class="LibraryFunction">print</span>(<span class="String"><span class="String">&quot;</span>My name is <span class="String">&quot;</span></span> <span class="Keyword">+</span> <span class="Variable">this</span>.<span class="LibraryConstant">name</span>);
</pre><br class='clear' /></div>
<p id="splats">
@@ -1050,12 +1058,12 @@ <h2 id="installation">Installation and Usage</h2>
</pre><pre class="idle"><span class="Storage">var</span> solipsism, speed;
-<span class="Keyword">if</span> ((<span class="Keyword">typeof</span> mind <span class="Keyword">!</span><span class="Keyword">==</span> <span class="String"><span class="String">&quot;</span>undefined<span class="String">&quot;</span></span> <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> mind <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>) <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> <span class="Keyword">!</span>(<span class="Keyword">typeof</span> world <span class="Keyword">!</span><span class="Keyword">==</span> <span class="String"><span class="String">&quot;</span>undefined<span class="String">&quot;</span></span> <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> world <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>)) {
+<span class="Keyword">if</span> ((<span class="Keyword">typeof</span> mind <span class="Keyword">!</span><span class="Keyword">==</span> <span class="String"><span class="String">&quot;</span>undefined<span class="String">&quot;</span></span> <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> mind <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>) <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> (<span class="Keyword">typeof</span> <span class="Keyword">!</span>world <span class="Keyword">!</span><span class="Keyword">==</span> <span class="String"><span class="String">&quot;</span>undefined<span class="String">&quot;</span></span> <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> <span class="Keyword">!</span>world <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>)) {
solipsism <span class="Keyword">=</span> <span class="BuiltInConstant">true</span>;
}
speed <span class="Keyword">=</span> (<span class="Keyword">typeof</span> speed <span class="Keyword">!</span><span class="Keyword">==</span> <span class="String"><span class="String">&quot;</span>undefined<span class="String">&quot;</span></span> <span class="Keyword">&amp;</span><span class="Keyword">&amp;</span> speed <span class="Keyword">!</span><span class="Keyword">==</span> <span class="BuiltInConstant">null</span>) ? speed : <span class="Number">140</span>;
</pre><button onclick='javascript: var solipsism, speed;
-if ((typeof mind !== "undefined" && mind !== null) && !(typeof world !== "undefined" && world !== null)) {
+if ((typeof mind !== "undefined" && mind !== null) && (typeof !world !== "undefined" && !world !== null)) {
solipsism = true;
}
speed = (typeof speed !== "undefined" && speed !== null) ? speed : 140;
@@ -1101,15 +1109,15 @@ <h2 id="installation">Installation and Usage</h2>
</p>
<div class='code'><pre class="idle"><span class="FunctionName">Animal</span><span class="Keyword">:</span> <span class="Storage">-&gt;</span>
<span class="FunctionName">Animal::move</span><span class="Keyword">:</span> <span class="FunctionArgument">(</span><span class="FunctionArgument">meters</span><span class="FunctionArgument">)</span> <span class="Storage">-&gt;</span>
- alert <span class="Variable">this</span>.name <span class="Keyword">+</span> <span class="String"><span class="String">&quot;</span> moved <span class="String">&quot;</span></span> <span class="Keyword">+</span> meters <span class="Keyword">+</span> <span class="String"><span class="String">&quot;</span>m.<span class="String">&quot;</span></span>
+ alert <span class="Variable">@name</span> <span class="Keyword">+</span> <span class="String"><span class="String">&quot;</span> moved <span class="String">&quot;</span></span> <span class="Keyword">+</span> meters <span class="Keyword">+</span> <span class="String"><span class="String">&quot;</span>m.<span class="String">&quot;</span></span>
-<span class="FunctionName">Snake</span><span class="Keyword">:</span> <span class="FunctionArgument">(</span><span class="FunctionArgument">name</span><span class="FunctionArgument">)</span> <span class="Storage">-&gt;</span> <span class="FunctionName">this.name</span><span class="Keyword">:</span> name
+<span class="FunctionName">Snake</span><span class="Keyword">:</span> <span class="FunctionArgument">(</span><span class="FunctionArgument">name</span><span class="FunctionArgument">)</span> <span class="Storage">-&gt;</span> <span class="Variable">@name</span><span class="Keyword">:</span> name
Snake <span class="Variable">extends</span> Animal
<span class="FunctionName">Snake::move</span><span class="Keyword">:</span> <span class="Storage">-&gt;</span>
alert <span class="String"><span class="String">&quot;</span>Slithering...<span class="String">&quot;</span></span>
<span class="Variable">super</span> <span class="Number">5</span>
-<span class="FunctionName">Horse</span><span class="Keyword">:</span> <span class="FunctionArgument">(</span><span class="FunctionArgument">name</span><span class="FunctionArgument">)</span> <span class="Storage">-&gt;</span> <span class="FunctionName">this.name</span><span class="Keyword">:</span> name
+<span class="FunctionName">Horse</span><span class="Keyword">:</span> <span class="FunctionArgument">(</span><span class="FunctionArgument">name</span><span class="FunctionArgument">)</span> <span class="Storage">-&gt;</span> <span class="Variable">@name</span><span class="Keyword">:</span> name
Horse <span class="Variable">extends</span> Animal
<span class="FunctionName">Horse::move</span><span class="Keyword">:</span> <span class="Storage">-&gt;</span>
alert <span class="String"><span class="String">&quot;</span>Galloping...<span class="String">&quot;</span></span>
@@ -1314,11 +1322,11 @@ <h2 id="installation">Installation and Usage</h2>
properties of the <tt>this</tt> where they're defined.
</p>
<div class='code'><pre class="idle"><span class="FunctionName">Account</span><span class="Keyword">:</span> <span class="FunctionArgument">(</span><span class="FunctionArgument">customer, cart</span><span class="FunctionArgument">)</span> <span class="Storage">-&gt;</span>
- <span class="FunctionName">this.customer</span><span class="Keyword">:</span> customer
- <span class="FunctionName">this.cart</span><span class="Keyword">:</span> cart
+ <span class="Variable">@customer</span><span class="Keyword">:</span> customer
+ <span class="Variable">@cart</span><span class="Keyword">:</span> cart
$(<span class="String"><span class="String">'</span>.shopping_cart<span class="String">'</span></span>).bind <span class="String"><span class="String">'</span>click<span class="String">'</span></span>, <span class="FunctionArgument">(</span><span class="FunctionArgument">event</span><span class="FunctionArgument">)</span> <span class="Storage">=&gt;</span>
- <span class="Variable">this</span>.customer.purchase <span class="Variable">this</span>.cart
+ <span class="Variable">@customer</span>.purchase <span class="Variable">@cart</span>
</pre><pre class="idle"><span class="Storage">var</span> Account;
Account <span class="Keyword">=</span> <span class="Storage">function</span> <span class="FunctionName">Account</span>(<span class="FunctionArgument">customer, cart</span>) {
<span class="Storage">var</span> __a;
@@ -1489,10 +1497,10 @@ <h2 id="resources">Resources</h2>
<ul>
<li>
<a href="http://github.com/jashkenas/coffee-script/">Source Code</a><br />
- After checking out the source, make sure to run <tt>rake build:parser</tt>
- to generate an up-to-date version of the Racc parser.
Use <tt>bin/coffee</tt> to test your changes,
<tt>rake test</tt> to run the test suite,
+ <tt>rake build:parser</tt> to regenerate the Racc parser if you're
+ working on the grammar,
and <tt>rake gem:install</tt> to
create and install a custom version of the gem.
</li>
@@ -1528,6 +1536,13 @@ <h2 id="resources">Resources</h2>
</ul>
<h2 id="change_log">Change Log</h2>
+
+ <p>
+ <b class="header" style="margin-top: 20px;">0.3.2</b>
+ <tt>@property</tt> is now a shorthand for <tt>this.property</tt>.<br />
+ Switched the default JavaScript engine from Narwhal to Node.js. Pass
+ the <tt>--narwhal</tt> flag if you'd like to continue using it.
+ </p>
<p>
<b class="header" style="margin-top: 20px;">0.3.0</b>
View
2  lib/coffee-script.rb
@@ -10,7 +10,7 @@
# Namespace for all CoffeeScript internal classes.
module CoffeeScript
- VERSION = '0.3.1' # Keep in sync with the gemspec.
+ VERSION = '0.3.2' # Keep in sync with the gemspec.
# Compile a script (String or IO) to JavaScript.
def self.compile(script, options={})
View
2  package.json
@@ -4,5 +4,5 @@
"description": "Unfancy JavaScript",
"keywords": ["javascript", "language"],
"author": "Jeremy Ashkenas",
- "version": "0.3.1"
+ "version": "0.3.2"
}
Please sign in to comment.
Something went wrong with that request. Please try again.