This repository was archived by the owner on Apr 16, 2022. It is now read-only.
forked from kyleburton/transition.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
112 lines (96 loc) · 2.36 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
require 'rubygems'
require 'fileutils'
require 'colorize'
def chdir! path
unless File.exist? path
FileUtils.mkdir_p path
end
Dir.chdir(path) do |p|
yield p
end
end
PHANTOM_URL = "https://phantomjs.googlecode.com/files/phantomjs-1.9.0-source.zip"
PHANTOM_DIR = "phantomjs-1.9.0"
PHANTOM_URLS = {
"Darwin" => "https://phantomjs.googlecode.com/files/phantomjs-1.9.0-macosx.zip",
"Linux" => "https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2"
}
def phantom_url
sys = `uname`.chomp!
PHANTOM_URLS[sys]
end
def unarchive url
fname = File.basename(phantom_url)
if fname.include? ".zip"
system "unzip", File.basename(phantom_url)
elsif fname.include? ".tar.bz2"
system "tar", "xjvf", File.basename(phantom_url)
end
end
def install_phantom
chdir!("software") do
unless File.exist? File.basename(phantom_url)
system "wget", phantom_url
end
phantom_dir = File.basename(File.basename(phantom_url,".zip"), ".tar.bz2")
unless File.exist? phantom_dir
unarchive(phantom_url)
end
# Dir.chdir(PHANTOM_DIR) do |p|
# system "bash", "build.sh"
# end
end
end
desc "run jslint on js files"
task :lint do
%w[examples/todo-sinatra/public/test-suite.js].concat(Dir["public/js/transition*.js"]).each do |f|
puts "jslint: #{f}"
res = system "jslint", f
unless res
$stderr.puts "JSLINT FAILED: #{f}".red
end
end
end
namespace :jslint do
desc "watch a file"
task :watch, :file do |t,args|
system "watch", "-d", "-n2", "jslint", args[:file]
end
end
namespace :test do
desc "run stats collector"
task :stats do
system('ruby stats.rb')
end
end
namespace :phantom do
desc "install"
task :install do
install_phantom
end
end
namespace :twitter_bootstrap do
desc "download"
task :download do
unless File.exist? "software"
Dir.mkdir "software"
end
Dir.chdir "software" do
tbs_url = "http://twitter.github.com/bootstrap/assets/bootstrap.zip"
unless File.exist? File.basename(tbs_url)
system "wget", tbs_url
end
unless File.exist? "bootstrap"
system "unzip", File.basename(tbs_url)
end
end
end
end
desc "Run the TODO application"
task :todo do
Dir.chdir("examples/todo-sinatra") do
system "bundle", "install"
system "rake", "db:migrate"
system "rake", "rerun"
end
end