Skip to content

Commit

Permalink
rename "Snow.config" to "snow.config.json" optionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Pxtl committed Nov 28, 2023
1 parent 487bf93 commit 59a124c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion debug.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
& src\Snow\bin\Debug\Snow config=.\SnowSite\Snow\Snow.config debug=true server=true
& src\Snow\bin\Debug\Snow config=.\SnowSite\Snow\Snow.config.json debug=true server=true
2 changes: 1 addition & 1 deletion publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Push-Location $PSScriptRoot

# defaulting.
if (-not $configPath) {
$configPath = [IO.FileInfo](Resolve-Path ".\SnowSite\Snow\Snow.config").Path
$configPath = [IO.FileInfo](Resolve-Path ".\SnowSite\Snow\Snow.config.json").Path
}
$configDirPath = Split-Path $configPath -Parent
$outputPath = Resolve-Path (Join-Path $configDirPath $config.postsOutput)
Expand Down
9 changes: 6 additions & 3 deletions src/Sandra.Snow.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Snow", "Snow\Snow.csproj", "{1143B7F0-4D45-4681-ACF8-EC24E4F4DBCC}"
EndProject
Expand All @@ -19,7 +19,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionStuffs", "SolutionStuffs", "{400CA74D-3B1D-4D07-8170-5A5304710D9A}"
ProjectSection(SolutionItems) = preProject
..\README.md = ..\README.md
..\SnowSite\Snow\snow.config = ..\SnowSite\Snow\snow.config
..\SnowSite\Snow\snow.config.json = ..\SnowSite\Snow\snow.config.json
EndProjectSection
EndProject
Global
Expand Down Expand Up @@ -48,4 +48,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3D43A1FD-2E25-4078-AF52-D821E9FBC042}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion src/Snow/Extensions/IoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private static bool IsIn(this string name, IEnumerable<string> names)
return names.Contains(name.ToLower(), StringComparer.OrdinalIgnoreCase);
}

private static readonly string[] IgnoredFiles = { "cname", "compile.snow.bat", "compile.snow.ps1", "snow.config", ".nojekyll", ".gitignore", ".deployment" };
private static readonly string[] IgnoredFiles = { "cname", "compile.snow.bat", "compile.snow.ps1", "snow.config", "snow.config.json", ".nojekyll", ".gitignore", ".deployment" };
private static readonly string[] IgnoredDirectories = { ".git", "svn", ".svn", "snow", ".nojekyll", ".gitignore" };

public static void Empty(this DirectoryInfo directory)
Expand Down
12 changes: 10 additions & 2 deletions src/Snow/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static void Main(string[] args)
.Where(x => extensions.Contains(x.Extension))
.Select(x => PagesParser.GetFileData(x, settings))
.OrderByDescending(x => x.Date)
.Where(x => x.Published != Published.Private && !(x is Post.MissingPost))
.Where(x => x.Published != Published.Private) //unlike posts do not check for "MissingPage" functionality because it does not exist.
.ToList();
pages.SetPostUrl(settings);

Expand Down Expand Up @@ -248,10 +248,18 @@ private static SnowSettings CreateSettings(string currentDir)
{
var settings = SnowSettings.Default(currentDir);
var configFile = Path.Combine(currentDir, "snow.config");
var alternateConfigFile = Path.Combine(currentDir, "snow.config.json");

if (!File.Exists(configFile))
{
throw new FileNotFoundException("Snow config file not found at " + configFile);
if (File.Exists(alternateConfigFile))
{
configFile = alternateConfigFile;
}
else
{
throw new FileNotFoundException($"Snow config file not found at '{configFile}' or '{alternateConfigFile}'");
}
}

var fileData = File.ReadAllText(configFile);
Expand Down

0 comments on commit 59a124c

Please sign in to comment.