-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathRakefile
53 lines (44 loc) · 1.1 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$:.unshift File.join(File.dirname(__FILE__), *%w[lib])
require 'tasks/task_helpers'
# Rubygems
require 'bundler'
Bundler::GemHelper.install_tasks
# Dependencies
require 'uglifier'
require 'architect'
require 'sprockets'
# Tasks
desc 'Merge, compiles and minify CoffeeScript files'
task :compile do
@environment = Sprockets::Environment.new
@environment.append_path 'app/assets/javascripts'
@environment.js_compressor = Uglifier.new(mangle: true)
compile('architect.js')
compile('workers/proxy_worker.js')
compile('workers/ajax_worker.js')
compile('workers/jsonp_worker.js')
end
desc 'Run tests'
task :test do
puts `phantomjs test/runner.js test/index.html`
end
task :default => :compile
def compile(file)
minjs = @environment[file].to_s
out = "static/#{file.sub('.js', '.min.js')}"
File.open(out, 'w') { |f| f.write(copyright + minjs + "\n") }
success "Compiled #{out}"
end
def copyright
@copyright ||= <<-EOS
/*
* Architect v#{Architect::VERSION}
* http://architectjs.org
*
* Copyright 2013, Etienne Lemay http://heliom.ca
* Released under the MIT license
*
* Date: #{Time.now}
*/
EOS
end