Skip to content

Commit

Permalink
use rakep to build ember-data and phantomejs for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak committed Mar 29, 2012
1 parent ca5c550 commit 601cbe2
Show file tree
Hide file tree
Showing 16 changed files with 444 additions and 337 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,5 @@ dist/

.DS_Store
.project

tests/ember-data-tests.js
83 changes: 69 additions & 14 deletions Assetfile
@@ -1,37 +1,92 @@
require "rake-pipeline-web-filters"
require "json"
require "uglifier"
require "./neuter"

output "tests/source"
class EmberProductionFilter < Rake::Pipeline::Filter
def generate_output(inputs, output)
inputs.each do |input|
result = File.read(input.fullpath)
result.gsub!(%r{^(\s)+ember_(assert|deprecate|warn)\((.*)\).*$}, "")
output.write result
end
end
end

class EmberLicenseFilter < Rake::Pipeline::Filter
def generate_output(inputs, output)
inputs.each do |input|
file = File.read(input.fullpath)
license = File.read("generators/license.js")
output.write "#{license}\n\n#{file}"
end
end
end

distros = {
:full => %w(ember-data)
}

output "dist"

input "packages" do
match "*/{lib,tests}/**/*.js" do
output "tests"

match "*/tests/**/*.js" do
minispade :rewrite_requires => true, :string => true, :module_id_generator => proc { |input|
id = input.path.dup
id.sub!('/lib/', '/')
id.sub!(/\.js$/, '')
id.sub!(/\/main$/, '')
id.sub!('/tests', '/~tests')
id
}

concat do |filename|
filename =~ %r{/tests/} ? "ember-tests.js" : "ember.js"
end
concat "ember-data-tests.js"
end
end

# Hack to ignore certain files
match "**/*.{json,md}" do
concat "trash"
end
input "packages" do
match "*/lib/**/*.js" do
minispade :rewrite_requires => true, :string => true, :module_id_generator => proc { |input|
id = input.path.dup
id.sub!('/lib/', '/')
id.sub!(/\.js$/, '')
id.sub!(/\/main$/, '')
id
}

match "**/README" do
concat "trash"
concat "ember-data-spade.js"
end
end

match "*/*.js" do
concat "trash"
input "packages" do
match "*/lib/**/main.js" do
neuter do |filename|
File.join("modules/", filename.gsub('/lib/main.js', '.js'))
end
end
end

distros.each do |name, modules|
name = "ember-data"

input "dist/modules" do
module_paths = modules.map{|m| "#{m}.js" }
match "{#{module_paths.join(',')}}" do
concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
end

# Strip dev code
match "#{name}.prod.js" do
filter(EmberProductionFilter) { ["#{name}.prod.js", "#{name}.min.js"] }
end

# Minify
match "#{name}.min.js" do
uglify{ "#{name}.min.js" }
filter EmberLicenseFilter
end
end
end

# vim: filetype=ruby
14 changes: 9 additions & 5 deletions Gemfile
@@ -1,9 +1,13 @@
source "http://rubygems.org"

gem "sproutcore", :git => "https://github.com/wycats/abbot-from-scratch.git"
gem "uglifier", "~> 1.0.3"
gem "execjs", "~> 1.2.6"
gem "rack"
gem "rake-pipeline", :git => "https://github.com/livingsocial/rake-pipeline.git"
gem "rake-pipeline-web-filters", :git => "https://github.com/wycats/rake-pipeline-web-filters.git"
gem "github-upload"
gem "colored"
gem "uglifier", "~> 1.0.3"

group :development do
gem "rack"
gem "github-upload"
gem "ember-docs", :git => "https://github.com/wagenet/ember-docs.git"
gem "kicker"
end
17 changes: 12 additions & 5 deletions Gemfile.lock
Expand Up @@ -7,10 +7,12 @@ GIT
thor

GIT
remote: https://github.com/wycats/abbot-from-scratch.git
revision: 29dfaa6c3c120847e61f742f74c414e4872cc142
remote: https://github.com/wagenet/ember-docs.git
revision: b32c0cb5ceea286c755a17640cb7f6750543e71c
specs:
sproutcore (0.0.1)
ember-docs (0.1)
rack
thor

GIT
remote: https://github.com/wycats/rake-pipeline-web-filters.git
Expand All @@ -23,6 +25,7 @@ GIT
GEM
remote: http://rubygems.org/
specs:
colored (1.2)
confparser (0.0.2.1)
execjs (1.2.13)
multi_json (~> 1.0)
Expand All @@ -33,6 +36,8 @@ GEM
net-github-upload (>= 0.0.6)
httpclient (2.2.4)
json (1.6.4)
kicker (2.5.0)
rb-fsevent
libxml-ruby (2.2.2)
multi_json (1.0.4)
net-github-upload (0.0.7)
Expand All @@ -43,6 +48,7 @@ GEM
nokogiri (1.5.0)
rack (1.4.1)
rake (0.9.2.2)
rb-fsevent (0.9.0)
thor (0.14.6)
uglifier (1.0.4)
execjs (>= 0.3.0)
Expand All @@ -52,10 +58,11 @@ PLATFORMS
ruby

DEPENDENCIES
execjs (~> 1.2.6)
colored
ember-docs!
github-upload
kicker
rack
rake-pipeline!
rake-pipeline-web-filters!
sproutcore!
uglifier (~> 1.0.3)

0 comments on commit 601cbe2

Please sign in to comment.