-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
42 lines (35 loc) · 938 Bytes
/
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 "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.pattern = "test/test_*.rb"
end
desc "Start test server"
task :test_server do
require File.expand_path 'test/app', File.dirname(__FILE__)
App.start
end
task :default => :test
desc "generate JavaScript lib for browser"
task :jslib do
dest = "rocketio.js"
dest_min = "rocketio.min.js"
require "rubygems"
require "sinatra/websocketio"
require "sinatra/cometio"
require "sinatra/rocketio"
require "erb"
websocketio_url = nil
cometio_url = nil
header = ERB.new(File.open(File.expand_path "HEADER.erb", File.dirname(__FILE__)).read).result(binding)
js = ERB.new(Sinatra::RocketIO.javascript).result(binding)
File.open(dest, "w+") do |f|
f.puts header
f.write js
end
puts " => #{dest}"
File.open(dest_min, "w+") do |f|
f.puts header
end
system "uglifyjs #{dest} >> #{dest_min}"
puts " => #{dest_min}"
end