mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
bumping to 0.1.3 ... here we go
This commit is contained in:
parent
e7e8e243a2
commit
c4ba971d39
7 changed files with 129 additions and 71 deletions
|
@ -1,7 +1,7 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = 'coffee-script'
|
||||
s.version = '0.1.2' # Keep version in sync with coffee-script.rb
|
||||
s.date = '2009-12-24'
|
||||
s.version = '0.1.3' # Keep version in sync with coffee-script.rb
|
||||
s.date = '2009-12-25'
|
||||
|
||||
s.homepage = "http://jashkenas.github.com/coffee-script/"
|
||||
s.summary = "The CoffeeScript Compiler"
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
equivalent in JavaScript, it's just another way of saying it.
|
||||
</p>
|
||||
|
||||
<!-- <%# code_for('intro') %>-->
|
||||
|
||||
<p>
|
||||
<b>Disclaimer:</b>
|
||||
CoffeeScript is just for fun and seriously alpha. I'm sure that there are still
|
||||
|
@ -95,14 +93,31 @@ gem install coffee-script</pre>
|
|||
<p>
|
||||
Installing the gem provides the <tt>coffee-script</tt> command, which can
|
||||
be used to compile CoffeeScript <tt>.cs</tt> files into JavaScript, as
|
||||
well as debug them. By default, <tt>coffee-script</tt> writes out the
|
||||
JavaScript as <tt>.js</tt> files in the same directory, but output
|
||||
well as debug them. In conjunction with
|
||||
<a href="http://narwhaljs.org/">Narwhal</a>, the <tt>coffee-script</tt>
|
||||
command also provides direct evaluation and an interactive REPL.
|
||||
When compiling to JavaScript, <tt>coffee-script</tt> writes the output
|
||||
as <tt>.js</tt> files in the same directory by default, but output
|
||||
can be customized with the following options:
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="25%"><code>-o, --output [DIR]</code></td>
|
||||
<td width="25%"><code>-i, --interactive</code></td>
|
||||
<td>
|
||||
Launch an interactive CoffeeScript session.
|
||||
Requires <a href="http://narwhaljs.org/">Narwhal</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-r, --run</code></td>
|
||||
<td>
|
||||
Compile and execute the CoffeeScripts without saving the intermediate
|
||||
JavaScript. Requires <a href="http://narwhaljs.org/">Narwhal</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-o, --output [DIR]</code></td>
|
||||
<td>
|
||||
Write out all compiled JavaScript files into the specified directory.
|
||||
</td>
|
||||
|
@ -428,6 +443,20 @@ coffee-script --print app/scripts/*.cs > concatenation.js</pre>
|
|||
|
||||
<h2 id="change_log">Change Log</h2>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.3</b>
|
||||
The <tt>coffee-script</tt> command now includes <tt>--interactive</tt>,
|
||||
which launches an interactive CoffeeScript session, and <tt>--run</tt>,
|
||||
which directly compiles and executes a script. Both options depend on a
|
||||
working installation of Narwhal.
|
||||
The <tt>aint</tt> keyword has been replaced by <tt>isnt</tt>, which goes
|
||||
together a little smoother with <tt>is</tt>.
|
||||
Quoted strings are now allowed as identifiers within object literals: eg.
|
||||
<tt>{"5+5": 10}</tt>.
|
||||
All assignment operators now use a colon: <tt>+:</tt>, <tt>-:</tt>,
|
||||
<tt>*:</tt>, etc.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.2</b>
|
||||
Fixed a bug with calling <tt>super()</tt> through more than one level of
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
// Eat lunch.
|
||||
var lunch;
|
||||
var a = ['toast', 'cheese', 'wine'];
|
||||
var d = [];
|
||||
for (var b=0, c=a.length; b<c; b++) {
|
||||
var food = a[b];
|
||||
d[b] = food.eat();
|
||||
var __a = ['toast', 'cheese', 'wine'];
|
||||
var __d = [];
|
||||
for (var __b=0, __c=__a.length; __b<__c; __b++) {
|
||||
var food = __a[__b];
|
||||
__d[__b] = food.eat();
|
||||
}
|
||||
lunch = d;
|
||||
lunch = __d;
|
||||
// Zebra-stripe a table.
|
||||
var e = table;
|
||||
for (var f=0, g=e.length; f<g; f++) {
|
||||
var row = e[f];
|
||||
var i = f;
|
||||
var __e = table;
|
||||
for (var __f=0, __g=__e.length; __f<__g; __f++) {
|
||||
var row = __e[__f];
|
||||
var i = __f;
|
||||
i % 2 === 0 ? highlight(row) : null;
|
||||
}
|
||||
})();
|
|
@ -23,11 +23,11 @@
|
|||
};
|
||||
// Array comprehensions:
|
||||
var cubed_list;
|
||||
var a = list;
|
||||
var d = [];
|
||||
for (var b=0, c=a.length; b<c; b++) {
|
||||
var num = a[b];
|
||||
d[b] = math.cube(num);
|
||||
var __a = list;
|
||||
var __d = [];
|
||||
for (var __b=0, __c=__a.length; __b<__c; __b++) {
|
||||
var num = __a[__b];
|
||||
__d[__b] = math.cube(num);
|
||||
}
|
||||
cubed_list = d;
|
||||
cubed_list = __d;
|
||||
})();
|
83
index.html
83
index.html
|
@ -23,8 +23,6 @@
|
|||
equivalent in JavaScript, it's just another way of saying it.
|
||||
</p>
|
||||
|
||||
<!-- -->
|
||||
|
||||
<p>
|
||||
<b>Disclaimer:</b>
|
||||
CoffeeScript is just for fun and seriously alpha. I'm sure that there are still
|
||||
|
@ -112,13 +110,13 @@ cubed_list<span class="Keyword">:</span> math.cube(num) <span class="Keyword">fo
|
|||
};
|
||||
<span class="Comment"><span class="Comment">//</span> Array comprehensions:</span>
|
||||
<span class="Storage">var</span> cubed_list;
|
||||
<span class="Storage">var</span> a <span class="Keyword">=</span> list;
|
||||
<span class="Storage">var</span> d <span class="Keyword">=</span> [];
|
||||
<span class="Keyword">for</span> (<span class="Storage">var</span> b<span class="Keyword">=</span><span class="Number">0</span>, c<span class="Keyword">=</span>a.<span class="LibraryConstant">length</span>; b<span class="Keyword"><</span>c; b<span class="Keyword">++</span>) {
|
||||
<span class="Storage">var</span> num <span class="Keyword">=</span> a[b];
|
||||
d[b] <span class="Keyword">=</span> math.cube(num);
|
||||
<span class="Storage">var</span> __a <span class="Keyword">=</span> list;
|
||||
<span class="Storage">var</span> __d <span class="Keyword">=</span> [];
|
||||
<span class="Keyword">for</span> (<span class="Storage">var</span> __b<span class="Keyword">=</span><span class="Number">0</span>, __c<span class="Keyword">=</span>__a.<span class="LibraryConstant">length</span>; __b<span class="Keyword"><</span>__c; __b<span class="Keyword">++</span>) {
|
||||
<span class="Storage">var</span> num <span class="Keyword">=</span> __a[__b];
|
||||
__d[__b] <span class="Keyword">=</span> math.cube(num);
|
||||
}
|
||||
cubed_list <span class="Keyword">=</span> d;
|
||||
cubed_list <span class="Keyword">=</span> __d;
|
||||
</pre><button onclick='javascript:
|
||||
// Assignment:
|
||||
var number = 42;
|
||||
|
@ -143,13 +141,13 @@ var math = {
|
|||
};
|
||||
// Array comprehensions:
|
||||
var cubed_list;
|
||||
var a = list;
|
||||
var d = [];
|
||||
for (var b=0, c=a.length; b<c; b++) {
|
||||
var num = a[b];
|
||||
d[b] = math.cube(num);
|
||||
var __a = list;
|
||||
var __d = [];
|
||||
for (var __b=0, __c=__a.length; __b<__c; __b++) {
|
||||
var num = __a[__b];
|
||||
__d[__b] = math.cube(num);
|
||||
}
|
||||
cubed_list = d;
|
||||
cubed_list = __d;
|
||||
;alert(cubed_list);'>run: cubed_list</button><br class='clear' /></div>
|
||||
|
||||
<h2 id="installation">Installation and Usage</h2>
|
||||
|
@ -165,14 +163,31 @@ gem install coffee-script</pre>
|
|||
<p>
|
||||
Installing the gem provides the <tt>coffee-script</tt> command, which can
|
||||
be used to compile CoffeeScript <tt>.cs</tt> files into JavaScript, as
|
||||
well as debug them. By default, <tt>coffee-script</tt> writes out the
|
||||
JavaScript as <tt>.js</tt> files in the same directory, but output
|
||||
well as debug them. In conjunction with
|
||||
<a href="http://narwhaljs.org/">Narwhal</a>, the <tt>coffee-script</tt>
|
||||
command also provides direct evaluation and an interactive REPL.
|
||||
When compiling to JavaScript, <tt>coffee-script</tt> writes the output
|
||||
as <tt>.js</tt> files in the same directory by default, but output
|
||||
can be customized with the following options:
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="25%"><code>-o, --output [DIR]</code></td>
|
||||
<td width="25%"><code>-i, --interactive</code></td>
|
||||
<td>
|
||||
Launch an interactive CoffeeScript session.
|
||||
Requires <a href="http://narwhaljs.org/">Narwhal</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-r, --run</code></td>
|
||||
<td>
|
||||
Compile and execute the CoffeeScripts without saving the intermediate
|
||||
JavaScript. Requires <a href="http://narwhaljs.org/">Narwhal</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-o, --output [DIR]</code></td>
|
||||
<td>
|
||||
Write out all compiled JavaScript files into the specified directory.
|
||||
</td>
|
||||
|
@ -543,18 +558,18 @@ highlight(row) <span class="Keyword">for</span> row, i <span class="Keyword">in<
|
|||
</pre><pre class="idle">
|
||||
<span class="Comment"><span class="Comment">//</span> Eat lunch.</span>
|
||||
<span class="Storage">var</span> lunch;
|
||||
<span class="Storage">var</span> a <span class="Keyword">=</span> [<span class="String"><span class="String">'</span>toast<span class="String">'</span></span>, <span class="String"><span class="String">'</span>cheese<span class="String">'</span></span>, <span class="String"><span class="String">'</span>wine<span class="String">'</span></span>];
|
||||
<span class="Storage">var</span> d <span class="Keyword">=</span> [];
|
||||
<span class="Keyword">for</span> (<span class="Storage">var</span> b<span class="Keyword">=</span><span class="Number">0</span>, c<span class="Keyword">=</span>a.<span class="LibraryConstant">length</span>; b<span class="Keyword"><</span>c; b<span class="Keyword">++</span>) {
|
||||
<span class="Storage">var</span> food <span class="Keyword">=</span> a[b];
|
||||
d[b] <span class="Keyword">=</span> food.eat();
|
||||
<span class="Storage">var</span> __a <span class="Keyword">=</span> [<span class="String"><span class="String">'</span>toast<span class="String">'</span></span>, <span class="String"><span class="String">'</span>cheese<span class="String">'</span></span>, <span class="String"><span class="String">'</span>wine<span class="String">'</span></span>];
|
||||
<span class="Storage">var</span> __d <span class="Keyword">=</span> [];
|
||||
<span class="Keyword">for</span> (<span class="Storage">var</span> __b<span class="Keyword">=</span><span class="Number">0</span>, __c<span class="Keyword">=</span>__a.<span class="LibraryConstant">length</span>; __b<span class="Keyword"><</span>__c; __b<span class="Keyword">++</span>) {
|
||||
<span class="Storage">var</span> food <span class="Keyword">=</span> __a[__b];
|
||||
__d[__b] <span class="Keyword">=</span> food.eat();
|
||||
}
|
||||
lunch <span class="Keyword">=</span> d;
|
||||
lunch <span class="Keyword">=</span> __d;
|
||||
<span class="Comment"><span class="Comment">//</span> Zebra-stripe a table.</span>
|
||||
<span class="Storage">var</span> e <span class="Keyword">=</span> table;
|
||||
<span class="Keyword">for</span> (<span class="Storage">var</span> f<span class="Keyword">=</span><span class="Number">0</span>, g<span class="Keyword">=</span>e.<span class="LibraryConstant">length</span>; f<span class="Keyword"><</span>g; f<span class="Keyword">++</span>) {
|
||||
<span class="Storage">var</span> row <span class="Keyword">=</span> e[f];
|
||||
<span class="Storage">var</span> i <span class="Keyword">=</span> f;
|
||||
<span class="Storage">var</span> __e <span class="Keyword">=</span> table;
|
||||
<span class="Keyword">for</span> (<span class="Storage">var</span> __f<span class="Keyword">=</span><span class="Number">0</span>, __g<span class="Keyword">=</span>__e.<span class="LibraryConstant">length</span>; __f<span class="Keyword"><</span>__g; __f<span class="Keyword">++</span>) {
|
||||
<span class="Storage">var</span> row <span class="Keyword">=</span> __e[__f];
|
||||
<span class="Storage">var</span> i <span class="Keyword">=</span> __f;
|
||||
i <span class="Keyword">%</span> <span class="Number">2</span> <span class="Keyword">===</span> <span class="Number">0</span> ? highlight(row) : <span class="BuiltInConstant">null</span>;
|
||||
}
|
||||
</pre><br class='clear' /></div>
|
||||
|
@ -807,6 +822,20 @@ world...";
|
|||
|
||||
<h2 id="change_log">Change Log</h2>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.3</b>
|
||||
The <tt>coffee-script</tt> command now includes <tt>--interactive</tt>,
|
||||
which launches an interactive CoffeeScript session, and <tt>--run</tt>,
|
||||
which directly compiles and executes a script. Both options depend on a
|
||||
working installation of Narwhal.
|
||||
The <tt>aint</tt> keyword has been replaced by <tt>isnt</tt>, which goes
|
||||
together a little smoother with <tt>is</tt>.
|
||||
Quoted strings are now allowed as identifiers within object literals: eg.
|
||||
<tt>{"5+5": 10}</tt>.
|
||||
All assignment operators now use a colon: <tt>+:</tt>, <tt>-:</tt>,
|
||||
<tt>*:</tt>, etc.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">0.1.2</b>
|
||||
Fixed a bug with calling <tt>super()</tt> through more than one level of
|
||||
|
|
|
@ -9,7 +9,7 @@ require "coffee_script/parse_error"
|
|||
# Namespace for all CoffeeScript internal classes.
|
||||
module CoffeeScript
|
||||
|
||||
VERSION = '0.1.2' # Keep in sync with the gemspec.
|
||||
VERSION = '0.1.3' # Keep in sync with the gemspec.
|
||||
|
||||
# Compile a script (String or IO) to JavaScript.
|
||||
def self.compile(script, options={})
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
"description": "Unfancy JavaScript",
|
||||
"keywords": ["javascript", "language"],
|
||||
"author": "Jeremy Ashkenas",
|
||||
"version": "0.1.2"
|
||||
"version": "0.1.3"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue