Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dawoe committed Jul 25, 2022
2 parents e1ad697 + 78bade5 commit ae6c5ed
Show file tree
Hide file tree
Showing 33 changed files with 200 additions and 460 deletions.
64 changes: 3 additions & 61 deletions Packaging/BuildPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

$CurrentDir = Split-Path $MyInvocation.MyCommand.Path
$RootDir = Split-Path -Path $CurrentDir -Parent
$UtilitiesDir = "$RootDir\Utilities"
$DistDir = "$RootDir\dist"
$SrcDir = "$RootDir\src"
$SolutionFile = "$SrcDir\Dawoe.OEmbedPickerPropertyEditor.sln"
Expand All @@ -16,13 +15,6 @@ if(Test-Path -Path $DistDir)

Write-Host "Preparing solution"

#Prepare build
. $UtilitiesDir\Prepare.ps1

Prepare-Solution -CurrentDir $UtilitiesDir -Configuration 'Release'

$buildFolder = Join-Path -Path $RootDir -ChildPath 'build';

Write-Host "Create nuget packages"

if(-Not([string]::IsNullOrEmpty($versionSuffix)))
Expand All @@ -31,59 +23,9 @@ if(-Not([string]::IsNullOrEmpty($versionSuffix)))
{
$VersionSuffix = "$VersionSuffix-$env:APPVEYOR_BUILD_NUMBER"
}
dotnet pack $SolutionFile -c Release -o $DistDir --version-suffix $VersionSuffix --no-build
dotnet pack $SolutionFile -c Release -o $DistDir --version-suffix $VersionSuffix
}
else
{
dotnet pack $SolutionFile -c Release -o $DistDir --no-build
}

Write-Host "Getting version for package"

#Get version number
$buildPropsXml = New-Object System.Xml.XmlDocument
$buildPropsXml.Load("$SrcDir\Directory.Build.props")

$version = Select-XML -xml $buildPropsXml -XPath '(//VersionPrefix)[1]'

if(-Not([string]::IsNullOrEmpty($versionSuffix)))
{
$version = "$version-$VersionSuffix"
}

Write-Host "Assembling Umbraco Package"

$umbFolder = Join-Path -Path $buildFolder -ChildPath "__umb";
if (!(Test-Path -Path $umbFolder)) {New-Item -Path $umbFolder -Type Directory;}

$umbracoManifest = Join-Path -Path $CurrentDir -ChildPath "manifest-umbraco.xml";
$umbracoPackageXml = [xml](Get-Content $umbracoManifest);
$umbracoPackageXml.umbPackage.info.package.version = "$($version)";

$filesXml = $umbracoPackageXml.CreateElement("files");

$assetFiles = Get-ChildItem -Path $buildFolder -File -Recurse;
foreach($assetFile in $assetFiles){

$hash = Get-FileHash -Path $assetFile.FullName -Algorithm MD5;
$guid = $hash.Hash.ToLower() + $assetFile.Extension;
$orgPath = "~" + $assetFile.Directory.FullName.Replace($buildFolder, "").Replace("\", "/");

$fileXml = $umbracoPackageXml.CreateElement("file");
$fileXml.set_InnerXML("<guid>${guid}</guid><orgPath>${orgPath}</orgPath><orgName>$($assetFile.Name)</orgName>");
$filesXml.AppendChild($fileXml);

Copy-Item -Path $assetFile.FullName -Destination "${umbFolder}\${guid}";
}

$umbracoPackageXml.umbPackage.ReplaceChild($filesXml, $umbracoPackageXml.SelectSingleNode("/umbPackage/files")) | Out-Null;
$umbracoPackageXml.Save("${umbFolder}\package.xml");

Write-Host "Creating Umbraco Package zip file"

Compress-Archive -Path "${umbFolder}\*" -DestinationPath "${DistDir}\Dawoe.OEmbedPickerPropertyEditor_$version.zip" -Force;


# Tidy up folders
Write-Host "Cleaning up"
Remove-Item -Recurse -Force $buildFolder;
dotnet pack $SolutionFile -c Release -o $DistDir
}
37 changes: 0 additions & 37 deletions Packaging/manifest-umbraco.xml

This file was deleted.

27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,25 @@ The package comes with a property value convertor for easy use in your views. Th
For a single embed :

```
@using Dawoe.OEmbedPickerPropertyEditor.Models;
@using Dawoe.OEmbedPickerPropertyEditor.Core.Models;
@Model.Value<OEmbedItem>("propalias").EmbedCode
```

For multiple embeds :

```
@using Dawoe.OEmbedPickerPropertyEditor.Models;
@using Dawoe.OEmbedPickerPropertyEditor.Core.Models;
@foreach(var item in Model.Value<IEnumerable<OEmbedItem>>("propalias"))
{
<div>@item.EmbedCode</div>
}
```

When you only need the source url of the iframe in the embed code you can do the following from version 5.1.0
When you only need the source url of the iframe in the embed code you can do the following

```
@using Dawoe.OEmbedPickerPropertyEditor.Models
@using Dawoe.OEmbedPickerPropertyEditor.Extensions
@using Dawoe.OEmbedPickerPropertyEditor.Core.Models
@using Dawoe.OEmbedPickerPropertyEditor.Core.Extensions
@Model.Value<OEmbedItem>("propAlias").GetEmbedSrc()
```
Expand All @@ -75,6 +75,12 @@ When you only need the source url of the iframe in the embed code you can do the

## Changelog

### 10.0.0

- Support for Umbraco 10
- Converted UI project to razor class library
- Breaking change : Moved classes in Dawoe.OEmbedPropertyEditor namespace to Dawoe.OEmbedPropertyEditor.Core namespace.

### 5.1.0

- Fix for deserializing property value when editor was a different property editor previously. Thanks to @bjarnef for the PR (#23)
Expand Down Expand Up @@ -128,16 +134,17 @@ This is can be a potentially breaking changes because the models will be generat
### 1.0.0
- Initial release

## Setting up a test site

The repository only contains the package code and not test website. However a test site can be set up by running the script SetupTestSite.ps1 from the Utilities folder.

## Contact
For starting the test site you can run StartTestSite.ps1

Feel free to contact me on twitter : [@dawoe21](https://twitter.com/dawoe21)
To deploy new changes made in the source code you can run UpdateTestSite.ps1.

## Contact

## Support this package ##
Feel free to contact me on twitter : [@dawoe21](https://twitter.com/dawoe21)

If you like this package and use it in your website, consider becoming a patreon to support ongoing maintenance

[https://www.patreon.com/dawoe](https://t.co/TBsvTMnOLB)

29 changes: 0 additions & 29 deletions Utilities/Compile.ps1

This file was deleted.

15 changes: 15 additions & 0 deletions Utilities/CreateNugetPackages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Write-Host "Create nuget packages"

$directoryBuildProps = [xml](Get-Content -Path "$SourceDir\Directory.Build.props");
$version = $directoryBuildProps.Project.PropertyGroup.VersionPrefix;
Write-Host "Package version: $version";

$dateTime = get-date -Format "ddMMyyyyHHmmss"

Write-Host "Version suffix $dateTime"

dotnet pack $SourceDir\$PackageName.sln -c Debug -o $TestSitesFolder\nuget --version-suffix "$dateTime"

cd "$TestSitesFolder\$TestProjectName"

dotnet add package $PackageName -v "$($version)-$dateTime".trim()
32 changes: 0 additions & 32 deletions Utilities/Prepare.ps1

This file was deleted.

Loading

0 comments on commit ae6c5ed

Please sign in to comment.