public void Execute(Context context) { if (!Action.IsApplicable()) { return; } var pathAndContent = Action.Execute(context); Require.NotNullOrEmpty(pathAndContent.ItemInfo.Item); //TODO should mapper return absolute path? string relativePath = context.PathMapper.MapPath(pathAndContent.ItemInfo, context); string path = context.GetAbsolutePath(relativePath); if (File.Exists(path) && File.ReadAllText(path) == pathAndContent.Content) {//same content context.Tracker.OnFileSkipped(relativePath); } else {//did not exist or has changed FileUtils.WriteAllText(path, pathAndContent.Content); context.Tracker.OnFileUpdated(relativePath); } }
private static IResult ActionImplStrategy(IOutputAction output, OutputResultData result) => output == null ? OutputResult.NullResult : output.Execute(result);