forked from TerribleDev/OwinOAuthProviders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuget.rake
44 lines (35 loc) · 1.21 KB
/
nuget.rake
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
namespace :nuget do
# If we don't have a copy of nuget, download it
task :bootstrap do
puts 'Ensuring NuGet exists in tools/NuGet'
if !FileTest.exist?("#{NUGET}/nuget.exe")
puts 'Downloading nuget from nuget.org'
begin
FileUtils.mkdir_p("#{NUGET}")
File.open("#{NUGET}/nuget.exe", "wb") do |file|
file.write open('http://nuget.org/nuget.exe', {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
end
rescue
FileUtils.rm_rf("#{NUGET}/nuget.exe")
File.open("#{NUGET}/nuget.exe", "wb") do |file|
file.write open('https://dist.nuget.org/win-x86-commandline/v3.2.0/nuget.exe', {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
end
end
end
end
desc 'Fetch nuget dependencies for all packages'
task :fetch => :bootstrap do
# If we aren't running under windows, assume we're using mono
CMD_PREFIX = ""
if !OS.windows?
CMD_PREFIX = "mono"
begin
sh "mozroots --import --sync" #attempt to sync ssl things...
rescue
end
end
# Make sure we get solution-level deps
#sh "#{CMD_PREFIX} #{NUGET}/nuget.exe i .nuget/packages.config -o packages"
sh "nuget.exe restore"
end
end