forked from MiniProfiler/rack-mini-profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
46 lines (38 loc) · 1008 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
43
44
45
# Rakefile
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :test)
task :default => [:spec]
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
desc "builds a gem"
task :build => :update_asset_version do
`gem build rack-mini-profiler.gemspec 1>&2`
end
desc "compile less"
task :compile_less => :copy_files do
`lessc lib/html/includes.less > lib/html/includes.css`
end
desc "update asset version file"
task :update_asset_version => :compile_less do
require 'digest/md5'
h = []
Dir.glob('lib/html/*.{js,html,css,tmpl}').each do |f|
h << Digest::MD5.hexdigest(::File.read(f))
end
File.open('lib/mini_profiler/version.rb','w') do |f|
f.write \
"module Rack
class MiniProfiler
VERSION = '#{Digest::MD5.hexdigest(h.sort.join(''))}'.freeze
end
end"
end
end
desc "copy files from other parts of the tree"
task :copy_files do
# TODO grab files from MiniProfiler/UI
end