public void Should_auto_create_folders() { var path = GetNewEmptyPathThatExists(); const string reportsName = "Reports"; const string datasourcesName = "Datasources"; const string actionsName = "Actions"; var bs = new ProjectBootStrapper(path, reportsName, datasourcesName, actionsName); bs.CreateFoldersIfNeeded(); Directory.Exists(Path.Combine(path, reportsName)).Should().BeTrue(); Directory.Exists(Path.Combine(path, datasourcesName)).Should().BeTrue(); Directory.Exists(Path.Combine(path, actionsName)).Should().BeTrue(); }
private static bool InitUsingBootstrappers(out ProjectBootStrapper projectBootstrapper) { projectBootstrapper = null; IRootPathAcquirer acquirer = new RegistryHelper(RegistryPath); var defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), DefaultRootFolderName); var bs = new AppBootStrapper(acquirer, defaultPath); var mode = bs.DetectProjectMode(); switch (mode) { case AppProjectsStructureMode.None: new NoProjectsExistWarning(bs).ShowDialog(); return false; case AppProjectsStructureMode.MultipleUnchosen: var form = new ChooseProject(bs.GetProjects()); form.ShowDialog(); if (!String.IsNullOrWhiteSpace(form.SelectedPath)) bs.SetProjectName(form.SelectedPath); if (bs.DetectProjectMode() == AppProjectsStructureMode.MultipleUnchosen) return false; break; case AppProjectsStructureMode.Single: bs.SetProjectNameToSingle(); break; } var debug = new TraceOutput(DefaultEventAggregator); debug.Show(); projectBootstrapper = bs.GetProjectBootstrapper(ReportsDirectoryName, DataSourceDirectoryName, ActionsDirectoryName); projectBootstrapper.ExecuteProjectBootStrapperFile(BootStrapperBatchFileName); projectBootstrapper.CopyProjectFiles(); projectBootstrapper.LoadProjectAssemblies(); ProjectPath = projectBootstrapper.ProjectPath; ProjectReportPath = Path.Combine(ProjectPath, ReportsDirectoryName); return true; }
public void Should_run_bat_file_if_exists() { var path = GetNewEmptyPathThatExists(); const string reportsName = "Reports"; const string datasourcesName = "Datasources"; const string actionsName = "Actions"; var bs = new ProjectBootStrapper(path, reportsName, datasourcesName, actionsName); File.WriteAllLines(Path.Combine(path, "bootstrapper.bat"), new [] { "md findit" }); File.Exists(Path.Combine(path, "bootstrapper.bat")).Should().BeTrue("batch file needs to exist"); bs.ExecuteBootStrapperBatchFileIfExists("bootstrapper.bat"); Directory.Exists(Path.Combine(path, "findit")).Should().BeTrue("Folder was created by batch file"); }
public void Should_run_bat_file_if_exists() { var path = GetNewEmptyPathThatExists(); const string reportsName = "Reports"; const string datasourcesName = "Datasources"; const string actionsName = "Actions"; var bs = new ProjectBootStrapper(path, reportsName, datasourcesName, actionsName, new Cloner(), new DllLoader()); File.WriteAllLines(Path.Combine(path,"bootstrapper.bat"), new []{"md findit"}); File.Exists(Path.Combine(path, "bootstrapper.bat")).Should().BeTrue("batch file needs to exist"); bs.ExecuteProjectBootStrapperFile("bootstrapper.bat"); Directory.Exists(Path.Combine(path, "findit")).Should().BeTrue("Folder was created by batch file"); }