Remove rake-pipeline related files
This commit is contained in:
parent
3710dd8167
commit
ab822c95e0
98
Assetfile
98
Assetfile
|
@ -1,98 +0,0 @@
|
||||||
$: << 'lib'
|
|
||||||
|
|
||||||
require 'rake-pipeline-web-filters'
|
|
||||||
require 'travis/assets'
|
|
||||||
require 'compass'
|
|
||||||
|
|
||||||
Encoding.default_external = Encoding::UTF_8
|
|
||||||
Encoding.default_internal = Encoding::UTF_8
|
|
||||||
|
|
||||||
assets ||= Travis::Assets.new
|
|
||||||
assets.setup_compass
|
|
||||||
assets.update_version
|
|
||||||
|
|
||||||
output 'public/scripts'
|
|
||||||
input assets.scripts do
|
|
||||||
match '**/*.hbs' do
|
|
||||||
travis_handlebars :precompile => false#assets.production?
|
|
||||||
concat 'templates.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
match '**/*.coffee' do
|
|
||||||
coffee_script
|
|
||||||
end
|
|
||||||
|
|
||||||
match 'vendor/**/*.js' do
|
|
||||||
if assets.production?
|
|
||||||
reject 'ember.js'
|
|
||||||
reject 'ember-data.js'
|
|
||||||
else
|
|
||||||
reject 'ember.prod.js'
|
|
||||||
reject 'ember-data.prod.js'
|
|
||||||
end
|
|
||||||
safe_concat assets.vendor_order, 'vendor.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
match '{spec,spec/integration,spec/unit,spec/unit/views}/*.js' do
|
|
||||||
concat 'spec/specs.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
match 'spec/support/*.js' do
|
|
||||||
concat 'spec/support.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
match 'spec/vendor/*.js' do
|
|
||||||
concat assets.spec_vendor_order, 'spec/vendor.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
match 'spec/{vendor,support,specs}.js' do
|
|
||||||
concat ['spec/vendor.js', 'spec/support.js', 'spec/specs.js'], 'specs.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
match %r(^(?!vendor|spec).*\.js$) do
|
|
||||||
modules = proc { |input| input.path.gsub(%r((^app/|lib/|\.js$)), '') }
|
|
||||||
# why did we use the string strategy for development? makes it impossible to set breakpoints
|
|
||||||
# minispade(string: assets.development?, rewrite_requires: true, module_id_generator: modules)
|
|
||||||
minispade(string: false, rewrite_requires: true, module_id_generator: modules)
|
|
||||||
end
|
|
||||||
|
|
||||||
match %r(^(?!spec).*\.js$) do
|
|
||||||
paths = ['min/app.js']
|
|
||||||
paths.push 'app.js' unless assets.production?
|
|
||||||
concat ['vendor.js'], paths
|
|
||||||
end
|
|
||||||
|
|
||||||
if assets.production?
|
|
||||||
match 'min/app.js' do
|
|
||||||
uglify squeeze: true
|
|
||||||
concat 'app.js'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
output 'public/styles'
|
|
||||||
input assets.styles do
|
|
||||||
match 'app/**/*.{scss,sass,css}' do
|
|
||||||
sass assets.production? ? { style: :compressed } : {}
|
|
||||||
concat assets.styles_order, ['app.css']
|
|
||||||
end
|
|
||||||
|
|
||||||
match 'dashboard/**/*.{scss,sass,css}' do
|
|
||||||
sass assets.production? ? { style: :compressed } : {}
|
|
||||||
concat assets.dashboard_styles_order, ['dashboard.css']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
output 'public/images'
|
|
||||||
input assets.images do
|
|
||||||
match '**/*' do
|
|
||||||
copy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# output 'public'
|
|
||||||
# input assets.static do
|
|
||||||
# match '**/*' do
|
|
||||||
# copy
|
|
||||||
# end
|
|
||||||
# end
|
|
12
Gemfile
12
Gemfile
|
@ -9,15 +9,6 @@ gem 'rack-mobile-detect'
|
||||||
gem 'sinatra'
|
gem 'sinatra'
|
||||||
gem 'hashr'
|
gem 'hashr'
|
||||||
|
|
||||||
gem 'rake-pipeline', github: 'livingsocial/rake-pipeline'
|
|
||||||
gem 'rake-pipeline-web-filters', github: 'wycats/rake-pipeline-web-filters'
|
|
||||||
gem 'coffee-script'
|
|
||||||
gem 'compass'
|
|
||||||
gem 'tilt'
|
|
||||||
gem 'uglifier'
|
|
||||||
gem 'yui-compressor'
|
|
||||||
gem 'libv8', '~> 3.16.0'
|
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
end
|
end
|
||||||
|
@ -26,9 +17,6 @@ end
|
||||||
group :development do
|
group :development do
|
||||||
# gem 'debugger'
|
# gem 'debugger'
|
||||||
gem 'foreman'
|
gem 'foreman'
|
||||||
gem 'rerun', '~> 0.10.0'
|
|
||||||
gem 'guard'
|
|
||||||
gem 'rb-fsevent', '~> 0.9.1'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|
83
Gemfile.lock
83
Gemfile.lock
|
@ -1,20 +1,3 @@
|
||||||
GIT
|
|
||||||
remote: git://github.com/livingsocial/rake-pipeline.git
|
|
||||||
revision: a75d96fbadcc659a35a0ae59212e0bc60b58cc54
|
|
||||||
specs:
|
|
||||||
rake-pipeline (0.8.0)
|
|
||||||
json
|
|
||||||
rake (~> 10.1.0)
|
|
||||||
thor
|
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git://github.com/wycats/rake-pipeline-web-filters.git
|
|
||||||
revision: 7bd283aac83d7c46a8908f089033a6087d7cd68f
|
|
||||||
specs:
|
|
||||||
rake-pipeline-web-filters (0.6.0)
|
|
||||||
rack
|
|
||||||
rake-pipeline (~> 0.6)
|
|
||||||
|
|
||||||
PATH
|
PATH
|
||||||
remote: server
|
remote: server
|
||||||
specs:
|
specs:
|
||||||
|
@ -24,57 +7,15 @@ GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
backports (3.6.3)
|
backports (3.6.3)
|
||||||
celluloid (0.16.0)
|
|
||||||
timers (~> 4.0.0)
|
|
||||||
chunky_png (1.3.1)
|
|
||||||
coderay (1.1.0)
|
|
||||||
coffee-script (2.3.0)
|
|
||||||
coffee-script-source
|
|
||||||
execjs
|
|
||||||
coffee-script-source (1.8.0)
|
|
||||||
compass (1.0.1)
|
|
||||||
chunky_png (~> 1.2)
|
|
||||||
compass-core (~> 1.0.1)
|
|
||||||
compass-import-once (~> 1.0.5)
|
|
||||||
rb-fsevent (>= 0.9.3)
|
|
||||||
rb-inotify (>= 0.9)
|
|
||||||
sass (>= 3.3.13, < 3.5)
|
|
||||||
compass-core (1.0.1)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
sass (>= 3.3.0, < 3.5)
|
|
||||||
compass-import-once (1.0.5)
|
|
||||||
sass (>= 3.2, < 3.5)
|
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
dotenv (0.11.1)
|
dotenv (0.11.1)
|
||||||
dotenv-deployment (~> 0.0.2)
|
dotenv-deployment (~> 0.0.2)
|
||||||
dotenv-deployment (0.0.2)
|
dotenv-deployment (0.0.2)
|
||||||
execjs (2.2.1)
|
|
||||||
ffi (1.9.6)
|
|
||||||
foreman (0.75.0)
|
foreman (0.75.0)
|
||||||
dotenv (~> 0.11.1)
|
dotenv (~> 0.11.1)
|
||||||
thor (~> 0.19.1)
|
thor (~> 0.19.1)
|
||||||
formatador (0.2.5)
|
|
||||||
guard (2.6.1)
|
|
||||||
formatador (>= 0.2.4)
|
|
||||||
listen (~> 2.7)
|
|
||||||
lumberjack (~> 1.0)
|
|
||||||
pry (>= 0.9.12)
|
|
||||||
thor (>= 0.18.1)
|
|
||||||
hashr (0.0.22)
|
hashr (0.0.22)
|
||||||
hitimes (1.2.2)
|
|
||||||
json (1.8.1)
|
|
||||||
libv8 (3.16.14.7)
|
|
||||||
listen (2.7.11)
|
|
||||||
celluloid (>= 0.15.2)
|
|
||||||
rb-fsevent (>= 0.9.3)
|
|
||||||
rb-inotify (>= 0.9)
|
|
||||||
lumberjack (1.0.9)
|
|
||||||
method_source (0.8.2)
|
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
pry (0.10.1)
|
|
||||||
coderay (~> 1.1.0)
|
|
||||||
method_source (~> 0.8.1)
|
|
||||||
slop (~> 3.4)
|
|
||||||
puma (2.9.1)
|
puma (2.9.1)
|
||||||
rack (>= 1.1, < 2.0)
|
rack (>= 1.1, < 2.0)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
|
@ -87,11 +28,6 @@ GEM
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rake (10.1.1)
|
rake (10.1.1)
|
||||||
rb-fsevent (0.9.4)
|
|
||||||
rb-inotify (0.9.5)
|
|
||||||
ffi (>= 0.5.0)
|
|
||||||
rerun (0.10.0)
|
|
||||||
listen (~> 2.7, >= 2.7.3)
|
|
||||||
rspec (2.99.0)
|
rspec (2.99.0)
|
||||||
rspec-core (~> 2.99.0)
|
rspec-core (~> 2.99.0)
|
||||||
rspec-expectations (~> 2.99.0)
|
rspec-expectations (~> 2.99.0)
|
||||||
|
@ -100,7 +36,6 @@ GEM
|
||||||
rspec-expectations (2.99.2)
|
rspec-expectations (2.99.2)
|
||||||
diff-lcs (>= 1.1.3, < 2.0)
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
rspec-mocks (2.99.2)
|
rspec-mocks (2.99.2)
|
||||||
sass (3.4.5)
|
|
||||||
sinatra (1.4.5)
|
sinatra (1.4.5)
|
||||||
rack (~> 1.4)
|
rack (~> 1.4)
|
||||||
rack-protection (~> 1.4)
|
rack-protection (~> 1.4)
|
||||||
|
@ -112,39 +47,21 @@ GEM
|
||||||
rack-test
|
rack-test
|
||||||
sinatra (~> 1.4.0)
|
sinatra (~> 1.4.0)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
slop (3.6.0)
|
|
||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
timers (4.0.1)
|
|
||||||
hitimes
|
|
||||||
uglifier (2.5.3)
|
|
||||||
execjs (>= 0.3.0)
|
|
||||||
json (>= 1.8.0)
|
|
||||||
yui-compressor (0.12.0)
|
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
coffee-script
|
|
||||||
compass
|
|
||||||
foreman
|
foreman
|
||||||
guard
|
|
||||||
hashr
|
hashr
|
||||||
libv8 (~> 3.16.0)
|
|
||||||
puma
|
puma
|
||||||
rack-mobile-detect
|
rack-mobile-detect
|
||||||
rack-protection (~> 1.3)
|
rack-protection (~> 1.3)
|
||||||
rack-ssl (~> 1.3)
|
rack-ssl (~> 1.3)
|
||||||
rake
|
rake
|
||||||
rake-pipeline!
|
|
||||||
rake-pipeline-web-filters!
|
|
||||||
rb-fsevent (~> 0.9.1)
|
|
||||||
rerun (~> 0.10.0)
|
|
||||||
rspec (~> 2.11)
|
rspec (~> 2.11)
|
||||||
sinatra
|
sinatra
|
||||||
sinatra-contrib
|
sinatra-contrib
|
||||||
tilt
|
|
||||||
travis-web!
|
travis-web!
|
||||||
uglifier
|
|
||||||
yui-compressor
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
$: << 'lib'
|
|
||||||
|
|
||||||
guard 'assets' do
|
|
||||||
watch(%r(^Assetfile))
|
|
||||||
watch(%r(^assets))
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
$: << 'lib'
|
|
||||||
|
|
||||||
guard 'specs' do
|
|
||||||
watch(%r(^public))
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,34 +1,4 @@
|
||||||
$: << 'lib'
|
$: << 'lib'
|
||||||
namespace :localeapp do
|
|
||||||
desc "syncs localeapp, yaml and handlebars"
|
|
||||||
task :update do
|
|
||||||
require 'localeapp-handlebars_i18n'
|
|
||||||
Localeapp::HandlebarsI18n.configure($stdout) do |config|
|
|
||||||
config.hbs_load_path = Dir[File.expand_path '../assets/scripts/app/templates/**/*.hbs', __FILE__]
|
|
||||||
config.yml_load_path = File.expand_path '../locales/', __FILE__
|
|
||||||
config.localeapp_api_key = ENV['LOCALEAPP_API_KEY']
|
|
||||||
end
|
|
||||||
system "localeapp push locales/#{Localeapp::HandlebarsI18n.default_locale}.yml"
|
|
||||||
Localeapp::HandlebarsI18n.send_missing_translations
|
|
||||||
system "localeapp pull"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace :ember do
|
|
||||||
desc 'update ember'
|
|
||||||
task :update do
|
|
||||||
if File.exists?('tmp/ember.js')
|
|
||||||
system 'cd tmp/ember.js; git fetch origin; git reset --hard origin/master'
|
|
||||||
else
|
|
||||||
system 'git clone https://github.com/emberjs/ember.js.git tmp/ember.js'
|
|
||||||
end
|
|
||||||
|
|
||||||
system 'cd tmp/ember.js; bundle update'
|
|
||||||
system 'cd tmp/ember.js; rake dist'
|
|
||||||
system 'cp tmp/ember.js/dist/ember.js assets/javascripts/vendor/ember.js'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
task :update_emojis do
|
task :update_emojis do
|
||||||
s = Dir.glob('assets/images/emoji/*.png').map {|png| png.split('/', 4)[3].gsub('.png', '')}.map{|png| "'#{png}'"}.join(", ")
|
s = Dir.glob('assets/images/emoji/*.png').map {|png| png.split('/', 4)[3].gsub('.png', '')}.map{|png| "'#{png}'"}.join(", ")
|
||||||
e = "@EmojiDictionary = [#{s}]"
|
e = "@EmojiDictionary = [#{s}]"
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
$stdout.sync = true
|
|
||||||
|
|
||||||
require 'guard'
|
|
||||||
require 'guard/guard'
|
|
||||||
require 'rake-pipeline'
|
|
||||||
|
|
||||||
module Guard
|
|
||||||
class Assets < Guard
|
|
||||||
def start
|
|
||||||
UI.info "Guard::Assets is running."
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_all
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_on_change(paths)
|
|
||||||
puts "change: #{paths.inspect}"
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def run
|
|
||||||
started = Time.now
|
|
||||||
print 'Compiling ... '
|
|
||||||
project.invoke_clean
|
|
||||||
puts "done (#{(Time.now - started).round(2)}s)."
|
|
||||||
end
|
|
||||||
|
|
||||||
def project
|
|
||||||
@project ||= Rake::Pipeline::Project.new('./Assetfile')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
$stdout.sync = true
|
|
||||||
|
|
||||||
require 'guard'
|
|
||||||
require 'guard/guard'
|
|
||||||
|
|
||||||
module Guard
|
|
||||||
class Specs < Guard
|
|
||||||
def start
|
|
||||||
UI.info "Guard::Specs is running."
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_all
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_on_change(paths)
|
|
||||||
puts "change: #{paths.inspect}"
|
|
||||||
run
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def run
|
|
||||||
system './run_jasmine.coffee public/spec.html'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
// DOM
|
|
||||||
var Element = {};
|
|
||||||
Element.firstChild = function () { return Element; };
|
|
||||||
Element.innerHTML = function () { return Element; };
|
|
||||||
|
|
||||||
var document = { createRange: false, createElement: function() { return Element; } };
|
|
||||||
var window = this;
|
|
||||||
this.document = document;
|
|
||||||
|
|
||||||
// Console
|
|
||||||
var console = window.console = {};
|
|
||||||
console.log = console.info = console.warn = console.error = function(){};
|
|
||||||
|
|
||||||
// jQuery
|
|
||||||
var jQuery = function() { return jQuery; };
|
|
||||||
jQuery.ready = function() { return jQuery; };
|
|
||||||
jQuery.inArray = function() { return jQuery; };
|
|
||||||
jQuery.jquery = "1.7.2";
|
|
||||||
jQuery.event = { fixHooks: {} };
|
|
||||||
var $ = jQuery;
|
|
||||||
window.jQuery = $;
|
|
||||||
|
|
||||||
ENV = {};
|
|
||||||
window.ENV = ENV;
|
|
||||||
ENV.FORCE_JQUERY = true;
|
|
||||||
|
|
||||||
// Ember
|
|
||||||
function compileHandlebarsTemplate(source) {
|
|
||||||
return Ember.Handlebars.precompile(source).toString();
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
require 'rake-pipeline'
|
|
||||||
|
|
||||||
module Travis
|
|
||||||
class Assets
|
|
||||||
autoload :Filters, 'travis/assets/filters'
|
|
||||||
autoload :Helpers, 'travis/assets/helpers'
|
|
||||||
autoload :Version, 'travis/assets/version'
|
|
||||||
|
|
||||||
TYPES = [:styles, :scripts, :images, :static, :vendor]
|
|
||||||
VENDOR_ORDER = %w(jquery.min minispade handlebars ember)
|
|
||||||
PRODUCTION_VENDOR_ORDER = %w(jquery.min minispade handlebars ember.prod)
|
|
||||||
SPEC_VENDOR_ORDER = %w(jasmine jasmine-html jasmine-runner sinon)
|
|
||||||
STYLES_ORDER = %w(app/main/tools)
|
|
||||||
DASHBOARD_STYLES_ORDER = %w(dashboard/foundation)
|
|
||||||
|
|
||||||
attr_reader :roots, :env
|
|
||||||
|
|
||||||
def initialize(roots = '.')
|
|
||||||
@roots = Array(roots).map { |root| Pathname.new(File.expand_path(root)) }
|
|
||||||
@env = ENV['ENV']
|
|
||||||
end
|
|
||||||
|
|
||||||
def staging?
|
|
||||||
ENV['API_ENDPOINT'] =~ /staging/ unless development?
|
|
||||||
end
|
|
||||||
|
|
||||||
def production?
|
|
||||||
!staging? and !development?
|
|
||||||
end
|
|
||||||
|
|
||||||
def development?
|
|
||||||
env != 'production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def vendor_order
|
|
||||||
order = production? ? PRODUCTION_VENDOR_ORDER : VENDOR_ORDER
|
|
||||||
order.map { |name| "vendor/#{name}.js" }
|
|
||||||
end
|
|
||||||
|
|
||||||
def styles_order
|
|
||||||
STYLES_ORDER.map { |name| "#{name}.css" }
|
|
||||||
end
|
|
||||||
|
|
||||||
def dashboard_styles_order
|
|
||||||
DASHBOARD_STYLES_ORDER.map { |name| "#{name}.css" }
|
|
||||||
end
|
|
||||||
|
|
||||||
def spec_vendor_order
|
|
||||||
SPEC_VENDOR_ORDER.map { |name| "spec/vendor/#{name}.js" }
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup_compass
|
|
||||||
Compass.configuration.images_path = images.first
|
|
||||||
styles.each do |path|
|
|
||||||
Compass.configuration.add_import_path(path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_version
|
|
||||||
Travis::Assets::Version.new(roots).update
|
|
||||||
end
|
|
||||||
|
|
||||||
TYPES.each { |type| define_method(type) { paths[type] } }
|
|
||||||
|
|
||||||
def paths
|
|
||||||
@paths ||= TYPES.inject({}) do |paths, type|
|
|
||||||
paths.merge(type.to_sym => roots.map { |root| root.join("assets/#{type}").to_s })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Rake::Pipeline::DSL::PipelineDSL.send(:include, Travis::Assets::Helpers)
|
|
|
@ -1,93 +0,0 @@
|
||||||
require 'rake-pipeline'
|
|
||||||
require 'execjs'
|
|
||||||
require 'uglifier'
|
|
||||||
require 'pathname'
|
|
||||||
require 'json'
|
|
||||||
|
|
||||||
module Travis
|
|
||||||
class Assets
|
|
||||||
module Filters
|
|
||||||
class Drop < Rake::Pipeline::Matcher
|
|
||||||
def output_files
|
|
||||||
input_files.reject { |f| f.path =~ @pattern }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Handlebars < Rake::Pipeline::Filter
|
|
||||||
class << self
|
|
||||||
def source
|
|
||||||
[
|
|
||||||
File.read(root.join('lib/rake-pipeline/ember-headless.js')),
|
|
||||||
File.read(root.join('assets/scripts/vendor/handlebars.js')),
|
|
||||||
File.read(root.join('assets/scripts/vendor/ember.js'))
|
|
||||||
].join("\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
def root
|
|
||||||
@root ||= Pathname.new(File.expand_path('../../../../', __FILE__))
|
|
||||||
end
|
|
||||||
|
|
||||||
def context
|
|
||||||
@@context ||= ExecJS.compile(source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
attr_reader :options
|
|
||||||
|
|
||||||
def initialize(*args, &block)
|
|
||||||
@options = args.last.is_a?(Hash) ? args.pop : {}
|
|
||||||
super
|
|
||||||
end
|
|
||||||
|
|
||||||
def generate_output(inputs, output)
|
|
||||||
inputs.each do |input|
|
|
||||||
source = input.read
|
|
||||||
source = options[:precompile] ? compile(source) : escape(source)
|
|
||||||
source = wrap(name(input.path), source)
|
|
||||||
output.write source
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def compile(source)
|
|
||||||
self.class.context.call('compileHandlebarsTemplate', source + "\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
def escape(source)
|
|
||||||
source.to_json
|
|
||||||
end
|
|
||||||
|
|
||||||
def wrap(name, source)
|
|
||||||
method = options[:precompile] ? 'template' : 'compile'
|
|
||||||
"\nEmber.TEMPLATES['#{name}'] = Ember.Handlebars.#{method}(#{source});\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
def name(path)
|
|
||||||
path.gsub(%r(app/|templates/|.hbs), '')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class SafeConcat < Rake::Pipeline::ConcatFilter
|
|
||||||
def generate_output(inputs, output)
|
|
||||||
inputs.each do |input|
|
|
||||||
output.write File.read(input.fullpath) + ";"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class OrderingSafeConcat < SafeConcat
|
|
||||||
def initialize(ordering, string = nil, &block)
|
|
||||||
@ordering = ordering
|
|
||||||
super(string, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def generate_output(inputs, output)
|
|
||||||
@ordering.reverse.each do |name|
|
|
||||||
file = inputs.find { |i| i.path == name }
|
|
||||||
inputs.unshift(inputs.delete(file)) if file
|
|
||||||
end
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,28 +0,0 @@
|
||||||
require 'rake-pipeline/dsl'
|
|
||||||
|
|
||||||
module Travis
|
|
||||||
class Assets
|
|
||||||
module Helpers
|
|
||||||
def travis_handlebars(*args, &block)
|
|
||||||
filter(Filters::Handlebars, *args, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def safe_concat(*args, &block)
|
|
||||||
if args.first.kind_of?(Array)
|
|
||||||
filter(Filters::OrderingSafeConcat, *args, &block)
|
|
||||||
else
|
|
||||||
filter(Filters::SafeConcat, *args, &block)
|
|
||||||
end
|
|
||||||
# filter(Filters::SafeConcat, *args, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def drop(pattern)
|
|
||||||
matcher = pipeline.copy(Filters::Drop)
|
|
||||||
matcher.glob = pattern
|
|
||||||
pipeline.add_filter matcher
|
|
||||||
matcher
|
|
||||||
end
|
|
||||||
alias :skip :drop
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,62 +0,0 @@
|
||||||
require 'pathname'
|
|
||||||
require 'digest/md5'
|
|
||||||
|
|
||||||
module Travis
|
|
||||||
class Assets
|
|
||||||
class Version
|
|
||||||
FILE_NAME = 'public/version'
|
|
||||||
SOURCES = %w(AssetFile Gemfile.lock assets)
|
|
||||||
|
|
||||||
def self.update
|
|
||||||
new.update
|
|
||||||
end
|
|
||||||
|
|
||||||
attr_reader :roots
|
|
||||||
|
|
||||||
def initialize(roots = nil)
|
|
||||||
@roots = roots
|
|
||||||
end
|
|
||||||
|
|
||||||
def read
|
|
||||||
file.read
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
@hash = nil
|
|
||||||
write(hash)
|
|
||||||
hash
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def cwd
|
|
||||||
Pathname.new(File.expand_path('.'))
|
|
||||||
end
|
|
||||||
|
|
||||||
def file
|
|
||||||
cwd.join(FILE_NAME)
|
|
||||||
end
|
|
||||||
|
|
||||||
def write(version)
|
|
||||||
file.open('w+') { |f| f.write(version) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def hash
|
|
||||||
@hash ||= digest.to_s[0..7]
|
|
||||||
end
|
|
||||||
|
|
||||||
def digest
|
|
||||||
Digest::MD5.new << `ls -lAR #{sources.join(' ')} | awk '{ print $5, $6, $7, $8, $9, $10 }'`
|
|
||||||
end
|
|
||||||
|
|
||||||
def sources
|
|
||||||
roots.map do |root|
|
|
||||||
SOURCES.map do |source|
|
|
||||||
source = Pathname.new(root).join(source)
|
|
||||||
source.to_s if source.exist?
|
|
||||||
end
|
|
||||||
end.flatten.compact
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user