Skip to content

Commit c7b4a70

Browse files
committed
Merge pull request #47 from lahma/allow_output_disable
Allow disabling of script output (backups, scripts), log files are retained
2 parents c162fb4 + 12b29f5 commit c7b4a70

6 files changed

Lines changed: 19 additions & 5 deletions

File tree

product/roundhouse.console/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ private static void parse_arguments_and_set_up_configuration(ConfigurationProper
245245
"OutputPath - This is where everything related to the migration is stored. This includes any backups, all items that ran, permission dumps, logs, etc. Defaults to \"{0}\".",
246246
ApplicationParameters.default_output_path),
247247
option => configuration.OutputPath = option)
248+
//output
249+
.Add("disableoutput",
250+
string.Format(
251+
"DisableoOutput - Disable output of backups, items ran, permissions dumps, etc. Log files are kept. Useful for example in CI environment. Defaults to \"{0}\".",
252+
ApplicationParameters.default_disable_output),
253+
option => configuration.DisableOutput = option != null)
248254
//warn on changes
249255
.Add("w|warnononetimescriptchanges",
250256
"WarnOnOneTimeScriptChanges - If you do not want RH to error when you change scripts that should not change, you must set this flag. One time scripts are DDL/DML (anything in the upFolder). Defaults to false.",

product/roundhouse.tasks/Roundhouse.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ bool ITask.Execute()
130130

131131
public bool SearchAllSubdirectoriesInsteadOfTraverse { get; set; }
132132

133+
public bool DisableOutput { get; set; }
134+
133135
#endregion
134136

135137
public void run_the_task()

product/roundhouse/consoles/DefaultConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ public sealed class DefaultConfiguration : ConfigurationPropertyHolder
5555
public bool RunAllAnyTimeScripts { get; set; }
5656
public bool DisableTokenReplacement { get; set; }
5757
public bool SearchAllSubdirectoriesInsteadOfTraverse { get; set; }
58+
public bool DisableOutput { get; set; }
5859
}
5960
}

product/roundhouse/infrastructure.app/ConfigurationPropertyHolder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ public interface ConfigurationPropertyHolder
5555
bool RunAllAnyTimeScripts { get; set; }
5656
bool DisableTokenReplacement { get; set; }
5757
bool SearchAllSubdirectoriesInsteadOfTraverse { get; set; }
58+
bool DisableOutput { get; set; }
5859
}
5960
}

product/roundhouse/infrastructure/ApplicationParameters.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static class ApplicationParameters
4040
public static readonly int default_command_timeout = 60;
4141
public static readonly int default_admin_command_timeout = 300;
4242
public static readonly int default_restore_timeout = 900;
43+
public static readonly bool default_disable_output = false;
4344

4445
public static string get_merged_assembly_name()
4546
{

product/roundhouse/runners/RoundhouseMigrationRunner.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,14 @@ private string replace_tokens(string sql_text)
305305

306306
private void copy_to_change_drop_folder(string sql_file_ran, Folder migration_folder)
307307
{
308-
string destination_file = file_system.combine_paths(known_folders.change_drop.folder_full_path, "itemsRan",
309-
sql_file_ran.Replace(migration_folder.folder_path + "\\", string.Empty));
310-
file_system.verify_or_create_directory(file_system.get_directory_name_from(destination_file));
311-
Log.bound_to(this).log_a_debug_event_containing("Copying file {0} to {1}.", file_system.get_file_name_from(sql_file_ran), destination_file);
312-
file_system.file_copy_unsafe(sql_file_ran, destination_file, true);
308+
if (!configuration.DisableOutput)
309+
{
310+
string destination_file = file_system.combine_paths(known_folders.change_drop.folder_full_path, "itemsRan",
311+
sql_file_ran.Replace(migration_folder.folder_path + "\\", string.Empty));
312+
file_system.verify_or_create_directory(file_system.get_directory_name_from(destination_file));
313+
Log.bound_to(this).log_a_debug_event_containing("Copying file {0} to {1}.", file_system.get_file_name_from(sql_file_ran), destination_file);
314+
file_system.file_copy_unsafe(sql_file_ran, destination_file, true);
315+
}
313316
}
314317
}
315318
}

0 commit comments

Comments
 (0)