-
Notifications
You must be signed in to change notification settings - Fork 162
/
Rakefile
38 lines (28 loc) · 1.01 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
task :default => [:compile]
task :compile do
require File.expand_path("gem/lib/angular-table/version")
require "coffee-script"
require "uglifier"
script = CoffeeScript.compile collect_coffees
prepend_author_notice(script)
File.open("angular-table.js", "w") { |file| file.write(script) }
File.open("gem/app/assets/javascripts/angular-table.js", "w") { |file| file.write(script) }
File.open("angular-table.min.js", "w") { |file| file.write(prepend_author_notice(Uglifier.new.compile(script))) }
end
def collect_coffees
files = ["atTable", "atImplicit", "atPagination", "metaCollector", "setupFactory"]
script = ""
files.each do |file|
script << File.read("coffee/#{file}.coffee") << "\n"
end
script
end
def prepend_author_notice script
comments = ""
comments << "// author: Samuel Mueller \n"
comments << "// version: #{AngularTable::VERSION} \n"
comments << "// license: MIT \n"
comments << "// homepage: http://github.com/ssmm/angular-table \n"
script.prepend comments
script
end