From 9440ccaf7d9eac5cc4adff61e4a4b17b82660551 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Wed, 3 Oct 2012 16:27:20 +0200 Subject: [PATCH] make assetfile reusable --- AssetFile | 30 +- Gemfile.lock | 2 +- Guardfile | 2 +- lib/rake-pipeline/travis/filters.rb | 11 +- public/javascripts/application.js | 2 +- public/javascripts/application.min.js | 8478 +------------------------ public/stylesheets/application.css | 2978 ++++----- public/version | 2 +- 8 files changed, 1527 insertions(+), 9978 deletions(-) diff --git a/AssetFile b/AssetFile index 85294d28..9b7bd723 100644 --- a/AssetFile +++ b/AssetFile @@ -4,13 +4,15 @@ require 'rake-pipeline-web-filters' require 'rake-pipeline/travis' require 'compass' +roots ||= [Pathname.new(File.expand_path('.'))] + Compass.configuration.images_path = 'assets/images' Compass.configuration.add_import_path File.expand_path('../assets/stylesheets', __FILE__) Travis::Version.update output 'public/javascripts' -input 'assets/javascripts' do +input roots.map { |root| root.join('assets/javascripts').to_s } do match 'app/templates/**/*.hbs' do filter Travis::HandlebarsFilter concat 'app/templates.js' @@ -33,7 +35,7 @@ input 'assets/javascripts' do match 'min/**/*.js' do filter Travis::ProductionFilter - uglify max_line_length: 50, squeeze: true + uglify max_line_length: 32 * 1024, squeeze: true filter Travis::SafeConcatFilter do 'application.min.js' end @@ -45,7 +47,7 @@ input 'assets/javascripts' do end output 'public/stylesheets' -input 'assets/stylesheets' do +input roots.map { |root| root.join('assets/stylesheets').to_s } do match '**/*.{scss,sass}' do filter Rake::Pipeline::Web::Filters::SassFilter concat [], 'application.css' @@ -53,33 +55,15 @@ input 'assets/stylesheets' do end output 'public/images' -input 'assets/images' do +input roots.map { |root| root.join('assets/images').to_s } do match '**/*' do copy end end output 'public' -input 'assets/static' do +input roots.map { |root| root.join('assets/public').to_s } do match '**/*' do copy 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 diff --git a/Gemfile.lock b/Gemfile.lock index 6ffb0c32..5cef6770 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,7 +42,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-api.git - revision: f6957636fba447ed61565e16a466eed8325900a5 + revision: c9c9dc61d8e2f24b331fd0e1b1549aff32178b29 specs: travis-api (0.0.1) backports (~> 2.5) diff --git a/Guardfile b/Guardfile index 76bbfc9c..7d9e087e 100644 --- a/Guardfile +++ b/Guardfile @@ -1,7 +1,7 @@ $: << 'lib' guard 'assets' do - watch(%r(^AssetFile)) + watch(%r(^Assetfile)) watch(%r(^assets)) end diff --git a/lib/rake-pipeline/travis/filters.rb b/lib/rake-pipeline/travis/filters.rb index 12152197..f3abf3f5 100644 --- a/lib/rake-pipeline/travis/filters.rb +++ b/lib/rake-pipeline/travis/filters.rb @@ -1,18 +1,23 @@ require 'rake-pipeline' require 'execjs' require 'uglifier' +require 'pathname' module Travis class HandlebarsFilter < Rake::Pipeline::Filter class << self def source [ - File.read('lib/rake-pipeline/ember-headless.js'), - File.read('assets/javascripts/vendor/handlebars.js'), - File.read('assets/javascripts/vendor/ember.js') + File.read(root.join('lib/rake-pipeline/ember-headless.js')), + File.read(root.join('assets/javascripts/vendor/handlebars.js')), + File.read(root.join('assets/javascripts/vendor/ember.js')) ].join("\n") end + def root + @root ||= Pathname.new(File.expand_path('../../../../', __FILE__)) + end + def context @@context ||= ExecJS.compile(source) end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 87aa0e20..37e5b171 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -30146,4 +30146,4 @@ var _require=function(){function c(a,c){document.addEventListener?a.addEventList ++g&&setTimeout(c,0)})}}(); (function(){!window.WebSocket&&window.MozWebSocket&&(window.WebSocket=window.MozWebSocket);if(window.WebSocket)Pusher.Transport=window.WebSocket,Pusher.TransportType="native";var c=(document.location.protocol=="http:"?Pusher.cdn_http:Pusher.cdn_https)+Pusher.VERSION,a=[];window.JSON||a.push(c+"/json2"+Pusher.dependency_suffix+".js");if(!window.WebSocket)window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0,a.push(c+"/flashfallback"+Pusher.dependency_suffix+".js");var b=function(){return window.WebSocket?function(){Pusher.ready()}: function(){window.WebSocket?(Pusher.Transport=window.WebSocket,Pusher.TransportType="flash",window.WEB_SOCKET_SWF_LOCATION=c+"/WebSocketMain.swf",WebSocket.__addTask(function(){Pusher.ready()}),WebSocket.__initialize()):(Pusher.Transport=null,Pusher.TransportType="none",Pusher.ready())}}(),e=function(a){var b=function(){document.body?a():setTimeout(b,0)};b()},g=function(){e(b)};a.length>0?_require(a,g):g()})(); -minispade.register('app', "(function() {(function() {\nminispade.require('travis');\nminispade.require('auth');\nminispade.require('controllers');\nminispade.require('helpers');\nminispade.require('models');\nminispade.require('pusher');\nminispade.require('routes');\nminispade.require('slider');\nminispade.require('store');\nminispade.require('tailing');\nminispade.require('templates');\nminispade.require('views');\nminispade.require('config/locales');\nminispade.require('data/sponsors');\n\n Travis.reopen({\n App: Em.Application.extend({\n autoinit: false,\n currentUserBinding: 'auth.user',\n authStateBinding: 'auth.state',\n init: function() {\n this._super.apply(this, arguments);\n this.store = Travis.Store.create();\n this.store.loadMany(Travis.Sponsor, Travis.SPONSORS);\n this.set('auth', Travis.Auth.create({\n store: this.store,\n endpoint: Travis.config.api_endpoint\n }));\n this.slider = new Travis.Slider();\n this.pusher = new Travis.Pusher(Travis.config.pusher);\n return this.tailing = new Travis.Tailing();\n },\n signIn: function() {\n return this.get('auth').signIn();\n },\n signOut: function() {\n this.get('auth').signOut();\n return this.get('router').send('showAuthenticated');\n },\n receive: function() {\n return this.store.receive.apply(this.store, arguments);\n },\n toggleSidebar: function() {\n var element;\n $('body').toggleClass('maximized');\n element = $('');\n $('#top .profile').append(element);\n Em.run.later((function() {\n return element.remove();\n }), 10);\n element = $('');\n $('#repository').append(element);\n return Em.run.later((function() {\n return element.remove();\n }), 10);\n }\n })\n });\n\n}).call(this);\n\n})();\n//@ sourceURL=app");minispade.register('auth', "(function() {(function() {\n\n this.Travis.Auth = Ember.Object.extend({\n iframe: $('