public CommandResult Execute()
{
_logger.Info("Installing packages...");
var packagesFolder = Path.Combine(_fileSystem.CurrentDirectory, _fileSystem.PackagesFolder);
if (!string.IsNullOrWhiteSpace(_composer.ScriptLibrariesFile))
{
var scriptLibrariesFile = Path.Combine(packagesFolder, _composer.ScriptLibrariesFile);
if (_fileSystem.FileExists(scriptLibrariesFile))
{
_logger.DebugFormat("Deleting: {0}", scriptLibrariesFile);
_fileSystem.FileDelete(scriptLibrariesFile);
}
}
var packages = GetPackages(_fileSystem.CurrentDirectory);
try
{
_packageInstaller.InstallPackages(packages, _allowPre);
_logger.Info("Package installation succeeded.");
return CommandResult.Success;
}
catch (Exception ex)
{
_logger.ErrorException("Package installation failed.", ex);
return CommandResult.Error;
}
}