Skip to content
This repository
Newer
Older
100644 122 lines (103 sloc) 3.017 kb
dafb8a4a »
2011-12-31 Update Assetfile and replace relative requires.
1 require "rake-pipeline-web-filters"
b3a7f763 »
2012-02-15 Evaluate tests in string mode for better debug info
2 require "json"
9cff1d89 »
2012-02-21 Use rake-pipeline to build
3 require "uglifier"
34d6abad »
2011-12-09 Set up RakePipeline in place of BPM
4
b9f5356f »
2012-03-06 More builds
5 class EmberProductionFilter < Rake::Pipeline::Filter
6 def generate_output(inputs, output)
7 inputs.each do |input|
8 result = File.read(input.fullpath)
9 result.gsub!(%r{^(\s)+ember_(assert|deprecate|warn)\((.*)\).*$}, "")
10 output.write result
11 end
12 end
13 end
14
15 class EmberLicenseFilter < Rake::Pipeline::Filter
16 def generate_output(inputs, output)
2523ac49 »
2012-03-27 Don't read files off disk n times.
17 license = File.read("generators/license.js")
b9f5356f »
2012-03-06 More builds
18 inputs.each do |input|
19 file = File.read(input.fullpath)
20 output.write "#{license}\n\n#{file}"
21 end
22 end
23 end
24
93193d68 »
2012-03-07 Run jshint with tests now
25 class JSHintRC < Rake::Pipeline::Filter
26 def generate_output(inputs, output)
2523ac49 »
2012-03-27 Don't read files off disk n times.
27 jshintrc = File.read(".jshintrc")
93193d68 »
2012-03-07 Run jshint with tests now
28 inputs.each do |input|
29 file = File.read(input.fullpath)
30 output.write "var JSHINTRC = #{jshintrc};\n\n#{file}"
31 end
32 end
33 end
34
b9f5356f »
2012-03-06 More builds
35 distros = {
36 :runtime => %w(ember-metal ember-runtime),
37 :full => %w(handlebars ember-metal ember-runtime ember-views ember-states metamorph ember-handlebars)
38 }
39
40 output "dist"
34d6abad »
2011-12-09 Set up RakePipeline in place of BPM
41
b3a7f763 »
2012-02-15 Evaluate tests in string mode for better debug info
42 input "packages" do
b9f5356f »
2012-03-06 More builds
43 output "tests"
44
9cff1d89 »
2012-02-21 Use rake-pipeline to build
45 match "*/tests/**/*.js" do
b3a7f763 »
2012-02-15 Evaluate tests in string mode for better debug info
46 minispade :rewrite_requires => true, :string => true, :module_id_generator => proc { |input|
47 id = input.path.dup
48 id.sub!(/\.js$/, '')
49 id.sub!(/\/main$/, '')
50 id.sub!('/tests', '/~tests')
51 id
52 }
53
9cff1d89 »
2012-02-21 Use rake-pipeline to build
54 concat "ember-tests.js"
34d6abad »
2011-12-09 Set up RakePipeline in place of BPM
55 end
93193d68 »
2012-03-07 Run jshint with tests now
56
57 match "ember-tests.js" do
58 filter JSHintRC
59 end
9cff1d89 »
2012-02-21 Use rake-pipeline to build
60 end
61
62 input "packages" do
63 match "*/lib/**/*.js" do
64 minispade :rewrite_requires => true, :string => true, :module_id_generator => proc { |input|
65 id = input.path.dup
66 id.sub!('/lib/', '/')
67 id.sub!(/\.js$/, '')
68 id.sub!(/\/main$/, '')
69 id
70 }
34d6abad »
2011-12-09 Set up RakePipeline in place of BPM
71
b9f5356f »
2012-03-06 More builds
72 concat "ember-spade.js"
b3a7f763 »
2012-02-15 Evaluate tests in string mode for better debug info
73 end
9cff1d89 »
2012-02-21 Use rake-pipeline to build
74 end
581304ea »
2012-01-01 Add the ignore-files hack back into the Assetfile.
75
9cff1d89 »
2012-02-21 Use rake-pipeline to build
76 input "packages" do
77 match "*/lib/**/main.js" do
c7d1e254 »
2012-03-22 Switched to RPWF's neuter
78 neuter(
79 :additional_dependencies => proc { |input|
80 Dir.glob(File.join(File.dirname(input.fullpath),'**','*.js'))
81 },
82 :path_transform => proc { |path, input|
83 package, path = path.split('/', 2)
84 current_package = input.path.split('/', 2)[0]
85 current_package == package && path ? File.join(package, "lib", "#{path}.js") : nil
86 },
87 :closure_wrap => true
88 ) do |filename|
9cff1d89 »
2012-02-21 Use rake-pipeline to build
89 File.join("modules/", filename.gsub('/lib/main.js', '.js'))
90 end
b3a7f763 »
2012-02-15 Evaluate tests in string mode for better debug info
91 end
b9f5356f »
2012-03-06 More builds
92 end
93
94 distros.each do |name, modules|
95 name = name == :full ? "ember" : "ember-#{name}"
581304ea »
2012-01-01 Add the ignore-files hack back into the Assetfile.
96
b9f5356f »
2012-03-06 More builds
97 input "dist/modules" do
98 module_paths = modules.map{|m| "#{m}.js" }
99 match "{#{module_paths.join(',')}}" do
100 concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
101 end
102
103 # Add debug to the main distro
104 match "{#{name}.js,ember-debug.js}" do
105 concat ["ember-debug.js"], "#{name}.js"
106 end
107
108 # Strip dev code
109 match "#{name}.prod.js" do
110 filter(EmberProductionFilter) { ["#{name}.prod.js", "#{name}.min.js"] }
111 end
112
113 # Minify
114 match "#{name}.min.js" do
115 uglify{ "#{name}.min.js" }
116 filter EmberLicenseFilter
117 end
b3a7f763 »
2012-02-15 Evaluate tests in string mode for better debug info
118 end
581304ea »
2012-01-01 Add the ignore-files hack back into the Assetfile.
119 end
120
b9f5356f »
2012-03-06 More builds
121 # vim: filetype=ruby
Something went wrong with that request. Please try again.