Skip to content

Commit 0d4300c

Browse files
committed
Version 2.0.0
1 parent f8f465c commit 0d4300c

7 files changed

Lines changed: 46 additions & 73 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Installation
2626

2727
$ easy_install CoffeeScript
2828

29-
coffee-script.js
29+
coffeescript.js
3030
----------------
3131

32-
The latest version of coffee-script.js (the script for browser
32+
The latest version of coffeescript.js (the script for browser
3333
\<script type="text/coffeescript"\> tags) can be download from
3434
<http://coffeescript.org/extras/coffee-script.js>
3535

@@ -38,12 +38,13 @@ License
3838

3939
Released under the MIT license. See LICENSE for details.
4040

41-
You can download current version of coffee-script.js from
42-
<http://coffeescript.org/extras/coffee-script.js>
43-
4441
Changes
4542
-------
4643

44+
### 2.0.0
45+
46+
* Updated coffeescript.js to v2.0.0.
47+
4748
### 1.1.2
4849

4950
* Updated coffee-script.js to v1.10.0.

coffeescript/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# On the other hand, it is impossible that `from coffeescript import __version__`
3535
# in spite of a dependency on execjs.
3636
# i.e. the import in setup.py fails if execjs has not been installed yet.
37-
__version__ = str("1.1.2")
37+
__version__ = str("2.0.0")
3838

3939

4040
__all__ = str('''
@@ -116,7 +116,7 @@ def get_compiler_script():
116116
which is used in coffeescript.compile() and coffeescript.compile_file()
117117
'''
118118
from os.path import dirname, join
119-
filename = join(dirname(__file__), 'coffee-script.js')
119+
filename = join(dirname(__file__), 'coffeescript.js')
120120
with io.open(filename, encoding='utf8') as fp:
121121
return fp.read()
122122

coffeescript/coffee-script.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

coffeescript/coffeescript.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name='CoffeeScript',
12-
version='1.1.2',
12+
version='2.0.0',
1313
author='OMOTO Kenji',
1414
description='A bridge to the JS CoffeeScript compiler',
1515

test_coffeescript.py

Lines changed: 28 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,7 @@
4242

4343
class CoffeeScriptTest(unittest.TestCase):
4444
def setUp(self):
45-
self.runtimes = list(execjs.available_runtimes().values())
46-
4745
self.encodings = "shift-jis utf-8 euc-jp".split()
48-
self.compilers = []
49-
self.compilers.append(coffeescript) # default compiler
50-
51-
from os.path import join, dirname
52-
script_path = join(dirname(coffeescript.__file__), "coffee-script.js")
53-
with io.open(script_path) as fp:
54-
compiler_script = fp.read()
55-
56-
for runtime in self.runtimes:
57-
self.compilers.append(
58-
coffeescript.Compiler(compiler_script, runtime))
59-
6046

6147
def assertExprsSuccess(self, ctx):
6248
self.assertEqual(ctx.call("add", 1, 2), 3)
@@ -72,39 +58,29 @@ def assertExprsFail(self, ctx):
7258
ctx.eval("helloworld")
7359

7460
def test_compile(self):
75-
for compiler, runtime in product(self.compilers, self.runtimes):
76-
compile = compiler.compile
77-
78-
# test bare=True
79-
jscode = compile(coffee_code, bare=True)
80-
ctx = runtime.compile(jscode)
81-
self.assertExprsSuccess(ctx)
82-
83-
# test bare=False
84-
jscode = compile(coffee_code, bare=False)
85-
ctx = runtime.compile(jscode)
86-
self.assertExprsFail(ctx)
87-
88-
def combinations_for_compile_file(self):
89-
return product(
90-
self.compilers,
91-
self.encodings,
92-
self.runtimes,
93-
)
94-
95-
def assert_compile_file_success(self, compiler, runtime, filename, encoding, bare):
96-
jscode = compiler.compile_file(filename, encoding=encoding, bare=bare)
97-
ctx = runtime.compile(jscode)
61+
# test bare=True
62+
jscode = coffeescript.compile(coffee_code, bare=True)
63+
ctx = execjs.compile(jscode)
64+
self.assertExprsSuccess(ctx)
65+
66+
# test bare=False
67+
jscode = coffeescript.compile(coffee_code, bare=False)
68+
ctx = execjs.compile(jscode)
69+
self.assertExprsFail(ctx)
70+
71+
def assert_compile_file_success(self, filename, encoding, bare):
72+
jscode = coffeescript.compile_file(filename, encoding=encoding, bare=bare)
73+
ctx = execjs.compile(jscode)
9874
self.assertExprsSuccess(ctx)
9975

100-
def assert_compile_file_fail(self, compiler, runtime, filename, encoding, bare):
101-
jscode = compiler.compile_file(filename, encoding=encoding, bare=bare)
102-
ctx = runtime.compile(jscode)
76+
def assert_compile_file_fail(self, filename, encoding, bare):
77+
jscode = coffeescript.compile_file(filename, encoding=encoding, bare=bare)
78+
ctx = execjs.compile(jscode)
10379
self.assertExprsFail(ctx)
10480

105-
def assert_compile_file_decode_error(self, compiler, runtime, filename, encoding, bare):
81+
def assert_compile_file_decode_error(self, filename, encoding, bare):
10682
with self.assertRaises(UnicodeDecodeError):
107-
compiler.compile_file(filename, encoding=encoding, bare=bare)
83+
coffeescript.compile_file(filename, encoding=encoding, bare=bare)
10884

10985
def write_temp_files(self, strings, encoding):
11086
paths = []
@@ -121,34 +97,34 @@ def remove_files(self, paths):
12197
os.remove(p)
12298

12399
def test_compile_files(self):
124-
for compiler, encoding, runtime in self.combinations_for_compile_file():
100+
for encoding in self.encodings:
125101
paths = self.write_temp_files([coffee_code], encoding)
126102
try:
127103
filename = paths[0]
128104

129-
self.assert_compile_file_success(compiler, runtime, filename, encoding, True)
130-
self.assert_compile_file_fail(compiler, runtime, filename, encoding, False)
105+
self.assert_compile_file_success(filename, encoding, True)
106+
self.assert_compile_file_fail(filename, encoding, False)
131107
for wrong_encoding in set(self.encodings) - set([encoding]):
132108
self.assert_compile_file_decode_error(
133-
compiler, runtime, filename, wrong_encoding, True)
109+
filename, wrong_encoding, True)
134110
self.assert_compile_file_decode_error(
135-
compiler, runtime, filename, wrong_encoding, False)
111+
filename, wrong_encoding, False)
136112
finally:
137113
self.remove_files(paths)
138114

139115
def test_compile_splitted_files(self):
140-
for compiler, encoding, runtime in self.combinations_for_compile_file():
116+
for encoding in self.encodings:
141117
paths = self.write_temp_files(splitted_coffee_code, encoding)
142118
try:
143119
filename = paths
144120

145-
self.assert_compile_file_success(compiler, runtime, filename, encoding, True)
146-
self.assert_compile_file_fail(compiler, runtime, filename, encoding, False)
121+
self.assert_compile_file_success(filename, encoding, True)
122+
self.assert_compile_file_fail(filename, encoding, False)
147123
for wrong_encoding in set(self.encodings) - set([encoding]):
148124
self.assert_compile_file_decode_error(
149-
compiler, runtime, filename, wrong_encoding, True)
125+
filename, wrong_encoding, True)
150126
self.assert_compile_file_decode_error(
151-
compiler, runtime, filename, wrong_encoding, False)
127+
filename, wrong_encoding, False)
152128
finally:
153129
self.remove_files(paths)
154130

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27, py32, py33, py34
2+
envlist = py27, py34, py35, py36
33

44
[testenv]
55
deps=PyExecJS

0 commit comments

Comments
 (0)