Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closes #28 - Adds pausing to Giles.

  • Loading branch information...
commit 75b1fc640e18bc47435ddc4de7ac8397be212d69 1 parent 471e986
Kelly Elton kellyelton authored
Showing with 12 additions and 3 deletions.
  1. +2 −1  src/Giles.Core/Watchers/SourceWatcher.cs
  2. +10 −2 src/Giles/Program.cs
3  src/Giles.Core/Watchers/SourceWatcher.cs
View
@@ -21,6 +21,7 @@ public class SourceWatcher : IDisposable
readonly GilesConfig config;
public List<FileSystemWatcher> FileWatchers { get; set; }
+ public bool Pause { get; set; }
public SourceWatcher(IBuildRunner buildRunner, IFileSystem fileSystem,
IFileWatcherFactory fileWatcherFactory, GilesConfig config)
@@ -84,7 +85,7 @@ void ResetBuildTimer()
public void RunNow()
{
- if (!buildRunner.Run())
+ if (Pause || !buildRunner.Run())
return;
var listener = GetListener.Invoke(config);
12 src/Giles/Program.cs
View
@@ -134,7 +134,7 @@ static void ConsoleSetup()
static InteractiveMenuOption[] GetInteractiveMenuOptions()
{
- return new[]
+ return new[]
{
new InteractiveMenuOption { HandlesKey = key => key == "?", Task = DisplayInteractiveMenuOptions },
new InteractiveMenuOption { HandlesKey = key => key == "i", Task = DisplayConfig },
@@ -146,6 +146,7 @@ static InteractiveMenuOption[] GetInteractiveMenuOptions()
new InteractiveMenuOption { HandlesKey = key => key == "e", Task = DisplayErrors },
new InteractiveMenuOption { HandlesKey = key => key == "f", Task = SetTestFilters },
new InteractiveMenuOption { HandlesKey = key => key == "h", Task = ClearTestFilters },
+ new InteractiveMenuOption {HandlesKey = key => key == "p", Task = TogglePause},
};
}
@@ -209,8 +210,14 @@ static void DisplayVerboseResults()
Console.WriteLine("Please run some tests first...");
}
+ static void TogglePause()
+ {
+ sourceWatcher.Pause = sourceWatcher.Pause != true;
+ Console.WriteLine(sourceWatcher.Pause ? "Pausing Giles" : "Resuming Giles");
+ }
+
- static T GetUserValue<T>(string description, T defaultValue)
+ static T GetUserValue<T>(string description, T defaultValue)
{
Console.Write("Enter new value for {0} ({1}): ", description, defaultValue);
var newValue = Console.ReadLine();
@@ -259,6 +266,7 @@ static void DisplayInteractiveMenuOptions()
Console.WriteLine(" F = Set Test Filters");
Console.WriteLine(" H = Clear Test Filters");
Console.WriteLine(" Q = Quit");
+ Console.WriteLine(" P = Toggle Pause Giles");
Console.WriteLine();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.