-
Notifications
You must be signed in to change notification settings - Fork 63
/
Rakefile
38 lines (29 loc) · 894 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
require 'rake/clean'
require 'rexml/document'
def nupkg(nuspec)
name = File.basename(nuspec, '.nuspec')
doc = REXML::Document.new(File.open(nuspec))
version = REXML::XPath.first(doc, '/package/metadata/version').text
"#{name}.#{version}.nupkg"
end
CLOBBER.include('**/*.nupkg')
SPECS = FileList['packages/**/*.nuspec']
PACKAGES = SPECS.map{ |file| File.join('bin', nupkg(file)) }
task :default => [:pack]
directory 'bin'
desc 'Build all packages'
task :pack => PACKAGES
desc 'Optimize icons'
task :optimize do
`git ls-files --others --modified --exclude-standard -- *.png`.split("\n").each do |file|
system("pngout \"#{file}\"")
end
end
SPECS.zip PACKAGES do |nuspec, nupkg|
file nupkg => ['bin', nuspec] do
nuspec = File.expand_path(nuspec)
Dir.chdir('bin') do
system("choco pack \"#{nuspec}\"")
end
end
end