public static void Deploy(string commandLine) { try { var newArgs = DeploymentCommandLineParser.Parse(commandLine); _log.DebugFormat("Deployment: '{0}'", newArgs.Deployment); //what is the better way to state this? DeploymentFinder finder = newArgs.Deployment == "SEARCH" ? new SearchesForAnAssemblyEndingInDeployment() : newArgs.Deployment.EndsWith(".dll") || newArgs.Deployment.EndsWith(".exe") ? new AssemblyWasSpecifiedAssumingOnlyOneDeploymentClass() : (DeploymentFinder) new TypeWasSpecifiedAssumingItHasADefaultConstructor(); var deployment = finder.Find(newArgs.Deployment); DeploymentPlanDispatcher.KickItOutThereAlready(deployment, newArgs); } catch (Exception ex) { _log.Debug(commandLine); _log.Error(ex); } }
public FindResult Find(string deployment) { DeploymentFinder finder = deployment == "SEARCH" ? new SearchesForAnAssemblyNameContainingDeployment() : deployment.EndsWith(".dll") || deployment.EndsWith(".exe") ? new AssemblyWasSpecifiedAssumingOnlyOneDeploymentClass() : (DeploymentFinder) new TypeWasSpecifiedAssumingItHasADefaultConstructor(); var dep = finder.Find(deployment); var result = new FindResult { Deployment = dep, MethodOfFinding = finder.Name }; return(result); }