Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issue #365, enhanced the finding web resource from the local file #381

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ UpgradeLog*.XML
*.ide-shm
*.ide-wal
/.vs
/spkl/.vs/spkl/config/applicationhost.config
5 changes: 4 additions & 1 deletion spkl/SparkleXrm.Tasks/DirectoryInfoEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public List<string> Search(string path, string search)
}
else
{
matcher.AddInclude("**\\" + search);
foreach (var item in search.Split('|'))
{
matcher.AddInclude("**/" + item);
}
}

var globbMatch = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(path)));
Expand Down
14 changes: 9 additions & 5 deletions spkl/SparkleXrm.Tasks/Tasks/DownloadWebresourceConfigTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void ExecuteInternal(string filePath, OrganizationServiceCont
var configs = ServiceLocator.ConfigFileFactory.FindConfig(filePath);
config = configs[0];
}
catch
catch (Exception ex)
{
config = new ConfigFile()
{
Expand Down Expand Up @@ -76,8 +76,10 @@ protected override void ExecuteInternal(string filePath, OrganizationServiceCont
{
throw new SparkleTaskException(SparkleTaskException.ExceptionTypes.MISSING_PREFIX, "Please supply the prefix for your webresources e.g. /p:new");
}

// Get a list of all webresources!
var matchList = ServiceLocator.Queries.GetWebresources(ctx).ToDictionary(w => w.Name.ToLower().Replace(Prefix + (Prefix.EndsWith("_") ? "" : "_"), ""));
//.ToLower().Replace(Prefix + (Prefix.EndsWith("_") ? "" : "_"), "")
var matchList = ServiceLocator.Queries.GetWebresources(ctx).ToDictionary(w => w.Name);

var webresourceConfig = config.GetWebresourceConfig(this.Profile).FirstOrDefault();
if (webresourceConfig == null)
Expand All @@ -90,7 +92,8 @@ protected override void ExecuteInternal(string filePath, OrganizationServiceCont
var file = filename.Replace("\\", "/").ToLower();

// Find if there are any matches
var match = matchList.Keys.Where(w => file.Contains(w)).FirstOrDefault();
//The file was name was not matching the capital case
var match = matchList.Keys.Where(w => file.Contains(w.ToLower())).FirstOrDefault();

if (match != null)
{
Expand All @@ -99,14 +102,15 @@ protected override void ExecuteInternal(string filePath, OrganizationServiceCont
var webresourcePath = filename.Replace(rootPath, "").TrimStart('\\').TrimStart('/');

// is it already in the config file
var existingMatch = existingWebResources.Keys.Where(w => webresource.Name.Contains(w)).FirstOrDefault();
//The file was name was not matching the capital case
var existingMatch = existingWebResources.Keys.Where(w => webresource.Name.ToLower().Contains(w)).FirstOrDefault();
if (existingMatch != null)
continue;

var webresourceFile = new WebResourceFile
{
uniquename = webresource.Name,
file = webresourcePath,
file = webresourcePath.Replace(rootPath,""),
displayname = "" + webresource.DisplayName,
description = "" + webresource.Description
};
Expand Down