-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
42 lines (32 loc) · 1.13 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 'rubygems'
require 'jammit'
# Usage (with version parameter):
# rake build[0.5.0]
# Think before you change - this directory is removed!!!
BUILDDIR = "build"
desc "minify gettit source with jammit; build the docs; package the build"
task :build, [:version] do |t, args|
puts "Building version #{args.version} to #{BUILDDIR}/"
FileUtils.rm_rf BUILDDIR, :verbose => true
Jammit.package!({
:config_path => "assets.yml",
:output_folder => BUILDDIR
})
# Copy the license to the top of the minified files.
FileUtils.cp "gettit.js", BUILDDIR
copy_license "gettit.js", BUILDDIR + "/gettit.js"
copy_license BUILDDIR + '/gettit.min.js', BUILDDIR + '/gettit.min.js'
# Create the docs.
system "mkdir -p #{BUILDDIR}/docs/annotated"
system "rocco #{BUILDDIR}/gettit.js"
system "mv #{BUILDDIR}/gettit.html #{BUILDDIR}/docs/annotated/index.html"
# Zip it all up.
system "zip -r #{BUILDDIR}/gettit_#{args.version}.zip #{BUILDDIR}"
end
def copy_license(from, to)
File.open(BUILDDIR + "/temp.js","w") do |tempfile|
tempfile.puts File.read("LICENSE.js")
tempfile.puts File.read(from)
end
FileUtils.mv BUILDDIR + "/temp.js", to
end