forked from rwjblue/pivot.js
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
42 lines (37 loc) · 1.09 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
require 'uglifier'
require_relative './demo_csv_builder.rb'
# Order matters.
@manifest = [ 'begin.js',
'init.js',
'utils.js',
'processing.js',
'filters.js',
'fields.js',
'data.js',
'display.js',
'results.js',
'entry.js',
'end.js'
]
namespace :pivot do
desc "Compiles docs"
task :docs => :compile do
system("jsduck ./pivot.js --output ./docs")
$stdout.puts "Docs have generated"
end
desc "Compiles individual .js files into pivot.js and pivot.min.js"
task :compile do
lines = []
@manifest.each do |file|
lines << File.open(File.join('./src', file)).readlines
end
pivot_js = File.open('./pivot.js','w') {|f| f.puts(lines) }
File.open('./pivot.min.js', 'w') {|f| f.puts Uglifier.new.compile(File.read('./pivot.js')) }
end
desc "Generates demo CSV for pivot.js gh-pages."
task :csv do
dcsv = DemoCSV.new(5000)
dcsv.to_file "./lib/csv/demo.csv"
$stdout.puts "Generate demo CSV successful"
end
end