forked from sproutit/sproutcore-abbot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
combine.rb
30 lines (23 loc) · 847 Bytes
/
combine.rb
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
require File.expand_path(File.join(File.dirname(__FILE__), 'base'))
require 'fileutils'
module SC
# This builder combines several javascript files into a single file. It is
# used to prepare a single javascript file for production use. This build
# tool expects the javascript files to have already been processed for any
# build directives such sc_static().
#
class Builder::Combine < Builder::Base
def build(dst_path)
lines = []
entries = entry.ordered_entries || entry.source_entries
entries.each do |entry|
src_path = entry.stage!.staging_path
next unless File.exist?(src_path)
lines << "/* >>>>>>>>>> BEGIN #{entry.filename} */\n"
lines += readlines(src_path)
lines << "\n"
end
writelines dst_path, lines
end
end
end