sproutcore-coffeescript 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +2 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/lib/buildtasks/build.rake +7 -0
- data/lib/buildtasks/manifest.rake +32 -0
- data/lib/sproutcore-coffeescript.rb +4 -0
- data/lib/sproutcore-coffeescript/version.rb +5 -0
- data/lib/sproutcore/builders/coffeescript.rb +21 -0
- data/sproutcore-coffeescript.gemspec +22 -0
- metadata +87 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
SproutCore + CoffeeScript
|
2
|
+
=========================
|
3
|
+
|
4
|
+
This ruby gem adds support for CoffeeScript files in SproutCore projects.
|
5
|
+
|
6
|
+
|
7
|
+
Usage
|
8
|
+
-----
|
9
|
+
|
10
|
+
Install the gem
|
11
|
+
|
12
|
+
gem install sproutcore-coffeescript
|
13
|
+
|
14
|
+
Add to the top of the Buildfile in the root of your project:
|
15
|
+
|
16
|
+
require "coffee-script"
|
17
|
+
require "sproutcore-coffeescript"
|
18
|
+
|
19
|
+
Use .coffee instead of .js. Enjoy.
|
20
|
+
|
21
|
+
|
22
|
+
Acknowledgment
|
23
|
+
--------------
|
24
|
+
|
25
|
+
Most of the code was taken from [Brandon Dimcheff](https://github.com/bdimcheff)'s
|
26
|
+
fork of Abbot [here](https://github.com/bdimcheff/abbot/commit/b46596db3a8fae1b7e91deda1650eeca163375a7),
|
27
|
+
updated to SproutCore 1.5 and packaged as a separate gem.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
namespace :manifest do
|
2
|
+
|
3
|
+
namespace :prepare_build_tasks do
|
4
|
+
|
5
|
+
desc "scans for coffeescript files, annotates them and prepares combined entries for each output target"
|
6
|
+
task :coffeescript => :setup do |task, env|
|
7
|
+
manifest = env[:manifest]
|
8
|
+
config = CONFIG
|
9
|
+
|
10
|
+
entries = manifest.entries(:hidden => true).select do |e|
|
11
|
+
e.original? && e[:ext] == "coffee"
|
12
|
+
end
|
13
|
+
|
14
|
+
entries.each do |entry|
|
15
|
+
entry = manifest.add_transform entry,
|
16
|
+
:lazy_instantiation => config[:lazy_instantiation],
|
17
|
+
:notify_onload => !config[:combine_javascript],
|
18
|
+
:filename => ["source", entry[:filename]].join("/"),
|
19
|
+
:build_path => File.join(manifest[:build_root], 'source', entry[:filename]),
|
20
|
+
:url => [manifest[:url_root], "source", entry[:filename]].join("/"),
|
21
|
+
:build_task => "build:coffeescript",
|
22
|
+
:resource => "javascript",
|
23
|
+
:ext => "js",
|
24
|
+
:entry_type => :javascript
|
25
|
+
entry.discover_build_directives!
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# inject :coffeescript as a :javascript dependency, so we don't have to replace :all
|
30
|
+
task :javascript => :coffeescript
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SC
|
2
|
+
|
3
|
+
class Builder::Coffeescript < Builder::JavaScript
|
4
|
+
|
5
|
+
def self.build(entry, dst_path)
|
6
|
+
new(entry).build(dst_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def build(dst_path)
|
10
|
+
begin
|
11
|
+
require "coffee-script"
|
12
|
+
rescue LoadError => e
|
13
|
+
raise "Cannot compile #{entry.source_path} because coffeescript is not installed. Please install coffeescript to continue."
|
14
|
+
end
|
15
|
+
|
16
|
+
content = readlines(entry.source_path)
|
17
|
+
js = CoffeeScript.compile(content)
|
18
|
+
writeline dst_path, js
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sproutcore-coffeescript/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "sproutcore-coffeescript"
|
7
|
+
s.version = Sproutcore::Coffeescript::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Vladimír Bobeš Tužinský"]
|
10
|
+
s.email = ["vladimir.tuzinsky@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{SproutCore + CoffeeScript in love}
|
13
|
+
s.description = %q{Adds support for CoffeeScript to SproutCore}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_dependency("sproutcore")
|
21
|
+
s.add_dependency("coffee-script")
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sproutcore-coffeescript
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Vladim\xC3\xADr Bobe\xC5\xA1 Tu\xC5\xBEinsk\xC3\xBD"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-20 00:00:00 +10:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: sproutcore
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coffee-script
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
description: Adds support for CoffeeScript to SproutCore
|
39
|
+
email:
|
40
|
+
- vladimir.tuzinsky@gmail.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files: []
|
46
|
+
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- lib/buildtasks/build.rake
|
53
|
+
- lib/buildtasks/manifest.rake
|
54
|
+
- lib/sproutcore-coffeescript.rb
|
55
|
+
- lib/sproutcore-coffeescript/version.rb
|
56
|
+
- lib/sproutcore/builders/coffeescript.rb
|
57
|
+
- sproutcore-coffeescript.gemspec
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: ""
|
60
|
+
licenses: []
|
61
|
+
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.6.2
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: SproutCore + CoffeeScript in love
|
86
|
+
test_files: []
|
87
|
+
|