Skip to content
Merged
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
21 changes: 12 additions & 9 deletions Scalar.Common/Maintenance/ConfigStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ public bool TrySetConfig(out string error)
return false;
}

this.ConfigureWatchmanIntegration();

error = null;
return true;
return this.ConfigureWatchmanIntegration(out error);
}

protected override void PerformMaintenance()
Expand Down Expand Up @@ -224,13 +221,14 @@ private bool TrySetConfig(Dictionary<string, string> configSettings, bool isRequ
return true;
}

private void ConfigureWatchmanIntegration()
private bool ConfigureWatchmanIntegration(out string error)
{
string watchmanLocation = ProcessHelper.GetProgramLocation(ScalarPlatform.Instance.Constants.ProgramLocaterCommand, "watchman");
if (string.IsNullOrEmpty(watchmanLocation))
{
this.Context.Tracer.RelatedWarning("Watchman is not installed - skipping Watchman configuration.");
return;
error = null;
return true;
}

try
Expand All @@ -239,8 +237,9 @@ private void ConfigureWatchmanIntegration()

if (string.IsNullOrEmpty(hooksDir))
{
this.Context.Tracer.RelatedError("Could not find hook templates directory. Skipping watchman integration.");
return;
error = "Could not find hook templates directory. Skipping watchman integration.";
this.Context.Tracer.RelatedError(error);
return false;
}

// Install query-watchman hook from latest Git path
Expand All @@ -266,11 +265,15 @@ private void ConfigureWatchmanIntegration()
"config");

this.Context.Tracer.RelatedInfo("Watchman configured!");
error = null;
return true;
}
catch (IOException ex)
{
EventMetadata metadata = this.CreateEventMetadata(ex);
this.Context.Tracer.RelatedError(metadata, $"Failed to configure Watchman integration: {ex.Message}");
error = $"Failed to configure Watchman integration: {ex.Message}";
this.Context.Tracer.RelatedError(metadata, error);
return false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Scalar.Common/Platforms/Mac/MacPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public override void IsServiceInstalledAndRunning(string name, out bool installe

public override string GetTemplateHooksDirectory()
{
return Path.Combine("usr", "local", ScalarConstants.InstalledGit.HookTemplateDir);
return Path.Combine("/usr", "local", "git", ScalarConstants.InstalledGit.HookTemplateDir);
}

public class MacPlatformConstants : POSIXPlatformConstants
Expand Down
1 change: 1 addition & 0 deletions Scalar.Installer.Mac/InstallScalar.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ if [ $INSTALL_WATCHMAN -eq 1 ]; then
echo "=============================="
echo "Installing watchman as: $CURRENT_USER"

sudo chown -R $CURRENT_USER /usr/local/Cellar
sudo -u $CURRENT_USER brew update
sudo -u $CURRENT_USER brew unlink python@2 || echo "Python 2 was not installed"
sudo -u $CURRENT_USER brew install watchman
Expand Down