make assetfile reusable

This commit is contained in:
Sven Fuchs 2012-10-03 16:27:20 +02:00
parent b8be2678c0
commit 9440ccaf7d
8 changed files with 1527 additions and 9978 deletions

View File

@ -4,13 +4,15 @@ require 'rake-pipeline-web-filters'
require 'rake-pipeline/travis' require 'rake-pipeline/travis'
require 'compass' require 'compass'
roots ||= [Pathname.new(File.expand_path('.'))]
Compass.configuration.images_path = 'assets/images' Compass.configuration.images_path = 'assets/images'
Compass.configuration.add_import_path File.expand_path('../assets/stylesheets', __FILE__) Compass.configuration.add_import_path File.expand_path('../assets/stylesheets', __FILE__)
Travis::Version.update Travis::Version.update
output 'public/javascripts' output 'public/javascripts'
input 'assets/javascripts' do input roots.map { |root| root.join('assets/javascripts').to_s } do
match 'app/templates/**/*.hbs' do match 'app/templates/**/*.hbs' do
filter Travis::HandlebarsFilter filter Travis::HandlebarsFilter
concat 'app/templates.js' concat 'app/templates.js'
@ -33,7 +35,7 @@ input 'assets/javascripts' do
match 'min/**/*.js' do match 'min/**/*.js' do
filter Travis::ProductionFilter filter Travis::ProductionFilter
uglify max_line_length: 50, squeeze: true uglify max_line_length: 32 * 1024, squeeze: true
filter Travis::SafeConcatFilter do filter Travis::SafeConcatFilter do
'application.min.js' 'application.min.js'
end end
@ -45,7 +47,7 @@ input 'assets/javascripts' do
end end
output 'public/stylesheets' output 'public/stylesheets'
input 'assets/stylesheets' do input roots.map { |root| root.join('assets/stylesheets').to_s } do
match '**/*.{scss,sass}' do match '**/*.{scss,sass}' do
filter Rake::Pipeline::Web::Filters::SassFilter filter Rake::Pipeline::Web::Filters::SassFilter
concat [], 'application.css' concat [], 'application.css'
@ -53,33 +55,15 @@ input 'assets/stylesheets' do
end end
output 'public/images' output 'public/images'
input 'assets/images' do input roots.map { |root| root.join('assets/images').to_s } do
match '**/*' do match '**/*' do
copy copy
end end
end end
output 'public' output 'public'
input 'assets/static' do input roots.map { |root| root.join('assets/public').to_s } do
match '**/*' do match '**/*' do
copy copy
end end
end end
# # DOH. how to simplify this.
# input 'assets/javascripts/spec' do
# match 'vendor/*.js' do
# files = %w(
# vendor/jasmine.js
# vendor/jasmine-html.js
# vendor/jasmine-runner.js
# vendor/sinon.js
# )
# concat files, 'specs/vendor.js'
# end
#
# match '**/*.coffee' do
# coffee_script
# concat 'specs/specs.js'
# end
# end

View File

@ -42,7 +42,7 @@ GIT
GIT GIT
remote: git://github.com/travis-ci/travis-api.git remote: git://github.com/travis-ci/travis-api.git
revision: f6957636fba447ed61565e16a466eed8325900a5 revision: c9c9dc61d8e2f24b331fd0e1b1549aff32178b29
specs: specs:
travis-api (0.0.1) travis-api (0.0.1)
backports (~> 2.5) backports (~> 2.5)

View File

@ -1,7 +1,7 @@
$: << 'lib' $: << 'lib'
guard 'assets' do guard 'assets' do
watch(%r(^AssetFile)) watch(%r(^Assetfile))
watch(%r(^assets)) watch(%r(^assets))
end end

View File

@ -1,18 +1,23 @@
require 'rake-pipeline' require 'rake-pipeline'
require 'execjs' require 'execjs'
require 'uglifier' require 'uglifier'
require 'pathname'
module Travis module Travis
class HandlebarsFilter < Rake::Pipeline::Filter class HandlebarsFilter < Rake::Pipeline::Filter
class << self class << self
def source def source
[ [
File.read('lib/rake-pipeline/ember-headless.js'), File.read(root.join('lib/rake-pipeline/ember-headless.js')),
File.read('assets/javascripts/vendor/handlebars.js'), File.read(root.join('assets/javascripts/vendor/handlebars.js')),
File.read('assets/javascripts/vendor/ember.js') File.read(root.join('assets/javascripts/vendor/ember.js'))
].join("\n") ].join("\n")
end end
def root
@root ||= Pathname.new(File.expand_path('../../../../', __FILE__))
end
def context def context
@@context ||= ExecJS.compile(source) @@context ||= ExecJS.compile(source)
end end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
73435ff6 c192dd6c