Skip to content

Instantly share code, notes, and snippets.

@inedo-builds
inedo-builds / FlattenPackages.ps1
Created May 30, 2019 02:47
Copy and flatten package files into single directory
$sourceDir = '<Feed Storage Path>'
$targetDir = '<Target Drop Folder Path>'
$packageIndex = 1
Get-ChildItem $sourceDir *.* -Recurse | foreach($_) {
if (-not $_.PSIsContainer) {
$ext = [System.IO.Path]::GetExtension($_.Name)
Copy-Item -Path $_.FullName -Destination (Join-Path -Path $targetDir -ChildPath "$packageIndex$ext")
$packageIndex = $packageIndex + 1
@inedo-builds
inedo-builds / ImportMavenFeed.sql
Created May 30, 2019 02:16
Imports Maven feed metadata into ProGet
DECLARE @Target_Feed_Id INT = <Target Feed ID>
DECLARE @xmldata XML =(
SELECT *
FROM OPENROWSET(BULK 'C:\path\to\exported\data.xml', SINGLE_BLOB) AS X)
INSERT INTO [MavenArtifacts]
SELECT [Feed_Id] = @Target_Feed_Id,
[GroupId_Text] = P.A.value('@Group','NVARCHAR(200)'),
[ArtifactId_Text] = P.A.value('@Id', 'NVARCHAR(100)'),
@inedo-builds
inedo-builds / ExportMavenFeedPostgres.sql
Last active May 30, 2019 02:13
Export Maven metadata from ProGet (PostgreSQL)
SELECT xmlelement(name "Package", xmlattributes("GroupId_Text" AS "Group",
"ArtifactId_Text" AS "Id",
"Name_Text" AS "Name",
"Description_Text" AS "Description",
"ReleaseVersion_Text" AS "Release",
"LatestVersion_Text" AS "Latest"),
(SELECT xmlagg(xmlelement(name "Version", xmlattributes("Version_Text" AS "Version",
"File_Type" AS "Type",
"File_SHA1_Bytes" AS "SHA1",
"File_MD5_Bytes" AS "MD5",
@inedo-builds
inedo-builds / ExportMavenFeed.sql
Created May 30, 2019 02:09
Export Maven feed metadata from ProGet
DECLARE @Feed_Id INT = <FEED ID>
SELECT [@Group] = M.[GroupId_Text],
[@Id] = M.[ArtifactId_Text],
[@Name] = M.[Name_Text],
[@Description] = M.[Description_Text],
[@Release] = M.[ReleaseVersion_Text],
[@Latest] = [LatestVersion_Text],
(SELECT [@Version] = F.[Version_Text],
[@Type] = F.[File_Type],
@inedo-builds
inedo-builds / Upload-ProGetAsset.ps1
Created August 16, 2017 17:30
PowerShell script to transfer a file to a ProGet asset directory
<#
.Synopsis
Transfers a file to a ProGet asset directory.
.Description
Transfers a file to a ProGet asset directory. This function performs automatic chunking
if the file is larger than a specified threshold.
.Parameter FileName
Name of the file to upload from the local file system.