Last active
January 2, 2016 14:39
-
-
Save ChrisAnn/8318532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'albacore' | |
desc "Download the NuGet.exe" | |
msbuild :download_nuget do |cmd| | |
cmd.solution = ".nuget/nuget.targets" | |
cmd.targets = [:CheckPrerequisites] | |
verbosity = :detailed | |
end | |
task :default => [:download_nuget] do | |
sh %{".nuget/nuget.exe" sources Add -Source http://companyName/feed.svc -Name InternalNuGetFeed} do |ok,res| | |
#empty block to ignore error reporting already added source | |
end | |
#restore the packages so that nuget.exe can find them | |
sh %{".nuget/nuget.exe" restore %system.teamcity.projectName%.sln} | |
FileList['./**/packages.config'].each do |config| | |
puts "---Reading packages in #{config}---" | |
f = File.open(config) | |
doc = Nokogiri::XML(f) | |
packageIds = doc.xpath('//packages/package/@id').collect {|x| x.value} | |
f.close | |
companyNamePackageIds = packageIds.select{|x| x.start_with?('CompanyName.')} | |
if companyNamePackageIds.length > 0 | |
puts "Found CompanyName packageIds:" | |
puts companyNamePackageIds | |
else | |
puts "No CompanyName packages found" | |
end | |
companyNamePackageIds.each do |package| | |
nugetCmd = ".nuget/nuget.exe update #{File.expand_path(config)} -Id #{package} -Verbose" | |
sh %{#{nugetCmd}} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment