sproutcore-coffeescript 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +7 -0
- data/README.md +16 -3
- data/lib/buildtasks/build.rake +1 -1
- data/lib/buildtasks/manifest.rake +10 -1
- data/lib/sproutcore-coffeescript/version.rb +2 -2
- data/lib/sproutcore/builders/coffeescript.rb +5 -8
- data/sproutcore-coffeescript.gemspec +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.1.4
|
2
|
+
|
3
|
+
- FIX: coffeescript test files are not loaded into application anymore
|
4
|
+
- coffeescript generated javascript are now prefixed with semicolon, because Sproutcore sometimes doesn't put semicolons at the end of javascript files and coffeescript generated javascript is wrapped in parentheses, so joining such files results in unexpected behaviour
|
5
|
+
- coffeescript builder now reuses all functionality of javascript builder
|
6
|
+
|
7
|
+
|
1
8
|
== 0.1.3
|
2
9
|
|
3
10
|
- sc_require '...' is now matched even without parentheses
|
data/README.md
CHANGED
@@ -13,15 +13,28 @@ Install the gem
|
|
13
13
|
|
14
14
|
Add to the top of the Buildfile in the root of your project:
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
begin
|
17
|
+
gem "sproutcore-coffeescript", "~> 0.1.4"
|
18
|
+
require "sproutcore-coffeescript"
|
19
|
+
rescue LoadError
|
20
|
+
puts "sproutcore-coffeescript not installed, please run:\n\n gem install sproutcore-coffeescript\n\n"
|
21
|
+
exit
|
22
|
+
end
|
18
23
|
|
19
24
|
Use .coffee instead of .js. Enjoy.
|
20
25
|
|
21
26
|
|
27
|
+
Disclaimer
|
28
|
+
----------
|
29
|
+
|
30
|
+
This gem monkey-patches SproutCore build tools on several places, which is ugly and can break with any future update of SproutCore. Also, I doubt I have covered all places in the build tools where javascript files are handled. It is not unlikely it won't work properly in all situations. You've been warned.
|
31
|
+
|
32
|
+
Having said that, I use this gem in my applications and it works for me. If you find a bug, [let me know](https://github.com/bobes/sproutcore-coffeescript/issues).
|
33
|
+
|
34
|
+
|
22
35
|
Acknowledgment
|
23
36
|
--------------
|
24
37
|
|
25
|
-
|
38
|
+
First version of the code was taken from [Brandon Dimcheff](https://github.com/bdimcheff)'s
|
26
39
|
fork of Abbot [here](https://github.com/bdimcheff/abbot/commit/b46596db3a8fae1b7e91deda1650eeca163375a7),
|
27
40
|
updated to SproutCore 1.5 and packaged as a separate gem.
|
data/lib/buildtasks/build.rake
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
namespace :manifest do
|
2
2
|
|
3
|
+
# here we're adding behaviour to an existing task
|
4
|
+
# we need to 'unhide' *.coffee entries
|
5
|
+
task :hide_buildfiles do |task, env|
|
6
|
+
manifest = env[:manifest]
|
7
|
+
manifest.entries(:hidden => true).each do |entry|
|
8
|
+
entry.hidden = false if entry[:ext] == "coffee"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
3
12
|
namespace :prepare_build_tasks do
|
4
13
|
|
5
14
|
desc "scans for coffeescript files, annotates them and prepares combined entries for each output target"
|
@@ -7,7 +16,7 @@ namespace :manifest do
|
|
7
16
|
manifest = env[:manifest]
|
8
17
|
config = CONFIG
|
9
18
|
|
10
|
-
entries = manifest.entries
|
19
|
+
entries = manifest.entries.select do |e|
|
11
20
|
e.original? && e[:ext] == "coffee"
|
12
21
|
end
|
13
22
|
|
@@ -1,23 +1,20 @@
|
|
1
1
|
module SC
|
2
2
|
|
3
|
-
class Builder::
|
3
|
+
class Builder::CoffeeScript < Builder::JavaScript
|
4
4
|
|
5
5
|
def self.build(entry, dst_path)
|
6
6
|
new(entry).build(dst_path)
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def readlines(src_path)
|
10
|
+
";" + ::CoffeeScript.compile(super)
|
11
|
+
rescue NameError
|
10
12
|
begin
|
11
13
|
require "coffee-script"
|
14
|
+
retry
|
12
15
|
rescue LoadError => e
|
13
16
|
raise "Cannot compile #{entry.source_path} because coffeescript is not installed. Please install coffeescript to continue."
|
14
17
|
end
|
15
|
-
|
16
|
-
coffee = readlines(entry.source_path)
|
17
|
-
js = CoffeeScript.compile(coffee)
|
18
|
-
js = rewrite_inline_code(js)
|
19
|
-
js = handle_debug_code(js)
|
20
|
-
writeline dst_path, js
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -4,7 +4,7 @@ require "sproutcore-coffeescript/version"
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "sproutcore-coffeescript"
|
7
|
-
s.version = Sproutcore::
|
7
|
+
s.version = Sproutcore::CoffeeScript::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Vladimír Bobeš Tužinský"]
|
10
10
|
s.email = ["vladimir.tuzinsky@gmail.com"]
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: sproutcore-coffeescript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Vladim\xC3\xADr Bobe\xC5\xA1 Tu\xC5\xBEinsk\xC3\xBD"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-10 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sproutcore
|