forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assetfile
73 lines (57 loc) · 2.18 KB
/
Assetfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require 'ember-dev'
distros = {
"runtime" => %w(ember-metal rsvp container ember-runtime),
"template-compiler" => %w(ember-handlebars-compiler),
"data-deps" => %w(ember-metal rsvp container ember-runtime ember-states),
"full" => %w(ember-metal rsvp container ember-runtime ember-views metamorph handlebars ember-handlebars-compiler ember-handlebars ember-routing ember-application ember-states),
"old-router" => %w(ember-metal rsvp container ember-runtime ember-views ember-states ember-viewstates metamorph handlebars ember-handlebars-compiler ember-handlebars ember-old-router )
}
class AddMicroLoader < Rake::Pipeline::Filter
LOADER = File.expand_path("packages/loader/lib/main.js")
def initialize(options={}, &block)
super(&block)
@global = options[:global]
end
def generate_output(inputs, output)
output.write "(function() {\n" unless @global
output.write File.read(LOADER)
inputs.each do |input|
output.write input.read
end
output.write "\n})();\n" unless @global
end
def additional_dependencies(input)
[ LOADER ]
end
end
#MEGAHAX
ember_spade_postprocess = "filter AddMicroLoader, :global => true"
instance_eval File.read(EmberDev.support_path.join('Assetfile'))
distros.each do |name, modules|
name = name == "full" ? "ember" : "ember-#{name}"
input "dist/modules" do
module_paths = modules.map{|m| "#{m}.js" }
match "{#{module_paths.join(',')}}" do
concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
filter HandlebarsPrecompiler
filter AddMicroLoader unless name == "ember-template-compiler"
end
# Add debug to the main distro
match "{#{name}.js,ember-debug.js}" do
filter VersionInfo
concat ["ember-debug.js"], "#{name}.js" unless name == "ember-template-compiler"
filter EmberStub if name == "ember-template-compiler"
end
# Strip dev code
match "#{name}.prod.js" do
filter(EmberStripDebugMessagesFilter) { ["#{name}.prod.js", "min/#{name}.js"] }
end
# Minify
match "min/#{name}.js" do
uglify{ "#{name}.min.js" }
filter VersionInfo
filter EmberLicenseFilter
end
end
end
# vim: filetype=ruby