Skip to content

Commit

Permalink
Update gpt.yml only when changes have been made (#52)
Browse files Browse the repository at this point in the history
* Update gpt.yml only when changes have been made
  • Loading branch information
Derroylo authored Oct 29, 2023
1 parent e29333a commit 754bec0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void Main(string[] args)

app.Run(args);

if (ConfigHelper.ConfigFileExists && ConfigHelper.IsConfigFileValid) {
if (ConfigHelper.ConfigFileExists && ConfigHelper.IsConfigFileValid && ConfigHelper.ConfigUpdated) {
try {
// Save config file
ConfigHelper.SaveConfigFile();
Expand Down
4 changes: 4 additions & 0 deletions helper/internal/config/ConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class ConfigHelper

public static bool ConfigFileExists { get { return configFileExists; } }

private static bool configUpdated = false;

public static bool ConfigUpdated { get { return configUpdated; } set { configUpdated = value; }}

private static bool configFileValid = false;

public static bool IsConfigFileValid { get { return configFileValid; } }
Expand Down
4 changes: 4 additions & 0 deletions helper/internal/config/sections/NodeJsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public static string NodeJsVersion
}

set {
if (appConfig.Nodejs.Version != value) {
ConfigUpdated = true;
}

appConfig.Nodejs.Version = value;
}
}
Expand Down
4 changes: 4 additions & 0 deletions helper/internal/config/sections/PhpConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public static string PhpVersion
}

set {
if (appConfig.Php.Version != value) {
ConfigUpdated = true;
}

appConfig.Php.Version = value;
}
}
Expand Down
2 changes: 2 additions & 0 deletions helper/internal/config/sections/ServicesConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public static List<string> ActiveServices
}

set {
ConfigUpdated = true;

appConfig.Services.Active = value;
}
}
Expand Down
4 changes: 4 additions & 0 deletions helper/php/PhpIniHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Gitpod.Tool.Helper.Internal.Config;
using Gitpod.Tool.Helper.Internal.Config.Sections;
using Spectre.Console;

Expand Down Expand Up @@ -99,6 +100,9 @@ public static void AddSettingToPhpIni(string name, string value, bool setForWeb
}
}

// Manually set that the config has been updated
ConfigHelper.ConfigUpdated = true;

// Update the ini files that are being used by apache and cli
UpdatePhpIniFiles(isDebug);

Expand Down

0 comments on commit 754bec0

Please sign in to comment.