-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathRakefile
59 lines (48 loc) · 1.32 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
require "rake/testtask"
task :default => :run
task :backup do
date = Time.now.strftime("%F")
backup_dir = "backup/#{date}"
FileUtils.mkdir_p(backup_dir)
`heroku pgbackups:capture --expire`
`curl -s -o #{backup_dir}/db.dump \`heroku pgbackups:url\``
`s3cmd sync s3://assets.hike.io/ #{backup_dir}`
end
task :build do
`psql -h localhost -l | grep -q hikeio || psql -h localhost -c "CREATE DATABASE hikeio"`
end
task :clean do
`psql -q -h localhost -c "DROP DATABASE hikeio" > /dev/null 2>&1`
`rm -rf .sass-cache`
end
task :push => [:clean, :static, :test] do
`git push heroku master`
end
task :run => [:build] do
system "rackup -p 4567"
end
task :static do
output = `node_modules/jshint/bin/jshint --config config/jshint.json \`find . -name "*.js" | grep -v -E "/lib/|/node_modules/" \``
if not $?.success?
puts "----- jshint errors -----"
puts output
fail
end
output = `roodi --config=config/roodi.yml server/**/**/**/**/**/**/**/**/**/**/*.rb`
if not $?.success?
puts "----- roodi errors -----"
puts output
fail
end
end
task :test_client do
system "node_modules/karma/bin/karma start config/karma.conf.js"
fail if not $?.success?
end
task :test_server => [:build] do
Rake::TestTask.new do |t|
t.test_files = FileList["server/test/**/*.rb"]
end
end
task :test => [:test_server, :test_client] do
end