forked from onefrankguy/rogue-reversal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile.rb
39 lines (31 loc) · 1.01 KB
/
rakefile.rb
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
#!/usr/bin/env ruby
require 'rake'
require 'rake/clean'
require 'autoprefixer-rails'
CLEAN.include 'game.zip'
CLEAN.include 'css/game.min.css'
task :default => :test
desc "Make sure the game isn't too big"
task :test => 'css/game.min.css' do
sh 'zip -r game.zip . -i@manifest.txt'
size = ::File.size('game.zip')
puts "zip size: #{size} bytes (used #{percent size}%)"
fail 'zip file too big!' if size > 13 * 1024
end
desc 'Publish to the website'
task :publish => 'css/game.min.css' do
sh 'rsync -avz --delete --files-from=manifest.txt ./ frankmitchell.org:/home/public/rogue-reversal/'
end
desc 'Run Autoprefixer on the CSS'
task :autoprefix => 'css/game.min.css'
file 'css/game.min.css' => 'css/game.css' do
css = ::File.read('css/game.css')
::File.open('css/game.min.css', 'w') do |io|
io << AutoprefixerRails.process(css)
end
sh 'cat css/game.min.css | ~/Development/node_modules/clean-css/bin/cleancss -o css/game.min.css'
end
def percent size
max = 13 * 1024
(size.to_f / max.to_f * 100).to_i
end