forked from TerribleDev/OwinOAuthProviders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile.rb
71 lines (60 loc) · 1.89 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
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
require 'rake'
require 'erb'
require 'rake/clean'
require 'albacore'
require 'open-uri'
require 'fileutils'
require 'os'
require 'nokogiri'
require 'openssl'
import 'nuget.rake'
CLEAN.include(['src/**/obj', 'src/**/bin', 'tool', 'packages/**','src/**/*.nuspec', 'src/**/*.nupkg', 'tools', 'packages', '*.nupkg'])
Configuration = ENV['CONFIGURATION'] || 'Release'
PACKAGES = File.expand_path("packages")
TOOLS = File.expand_path("tools")
NUGET = File.expand_path("#{TOOLS}/nuget")
NUGET_EXE = File.expand_path("#{TOOLS}/nuget/nuget.exe")
@version = "2.14.0"
PROJECTS = Dir.glob('src/*').select{|dir| File.directory? dir }
desc 'Retrieve things'
task :retrieve => ["nuget:fetch"]
desc 'Does the build'
task :build => [:retrieve, :compile]
desc 'clean, retrieve, build, generate nuspecs'
task :preflight => [:clean, :build, :nuspec_gen]
desc 'publish'
task :publish => [:preflight,:nuspec_gen, :nuspec_pack, :nuspec_publish]
build :compile do |t|
t.prop 'Configuration', Configuration
t.sln = 'OwinOAuthProviders.sln'
end
desc "Generate nuspec files"
task :nuspec_gen do
template = ERB.new(File.read('nuspectemplate.nuspec.erb'))
@nugets = []
PROJECTS.each{|directory|
@id = File.basename(directory)
@nugets.push(@id)
output = template.result()
File.write(File.join(directory, "#{@id}.nuspec"), output)
}
File.write('Owin.Security.Providers.nuspec', ERB.new(File.read('global.nuspec.erb')).result())
end
desc 'pack nuspec files'
task :nuspec_pack do
PROJECTS.each{|dir|
Dir.chdir(dir) do
sh "#{NUGET_EXE} pack #{FileList["*.csproj"].first} -Prop Configuration=#{Configuration}"
end
}
sh "#{NUGET_EXE} pack Owin.Security.Providers.nuspec -Exclude \"**\""
end
desc 'publish nugets'
task :nuspec_publish do
PROJECTS.each{|dir|
Dir.chdir(dir) do
sh "#{NUGET_EXE} push #{FileList["*.nupkg"].first}"
end
}
sh "#{NUGET_EXE} push #{FileList["*.nupkg"].first}"
end