コード例 #1
0
        internal override void Execute(string[] args, Dictionary <string, string> flags)
        {
            var logger   = new Common.Logging.Simple.ConsoleOutLogger("install", LogLevel.Debug, false, false, false, "");
            var console  = new ScriptCs.Hosting.ScriptConsole();
            var services = new PvcScriptServicesBuilder(console, logger);

            var initServices = new ScriptCs.Hosting.InitializationServices(logger);

            var installationProvider = services.InitializationServices.GetInstallationProvider();

            installationProvider.Initialize();

            var packageInstaller        = services.InitializationServices.GetPackageInstaller();
            var packageAssemblyResolver = services.InitializationServices.GetPackageAssemblyResolver();

            if (args.Length > 1)
            {
                var packageName    = args[1];
                var packageVersion = "";
                if (flags.ContainsKey("version"))
                {
                    packageVersion = flags["version"];
                }

                var packageRef = new ScriptCs.PackageReference(packageName, VersionUtility.ParseFrameworkName("net45"), packageVersion);
                packageInstaller.InstallPackages(new[] { packageRef }, true);
            }
            else
            {
                var packages = packageAssemblyResolver.GetPackages(Directory.GetCurrentDirectory());
                packageInstaller.InstallPackages(packages);
            }

            packageAssemblyResolver.SavePackages();
        }
コード例 #2
0
ファイル: InstallCommand.cs プロジェクト: joshgerdes/pvc
        internal override void Execute(string[] args, Dictionary<string, string> flags)
        {
            var logger = new Common.Logging.Simple.ConsoleOutLogger("install", LogLevel.Debug, false, false, false, "");
            var console = new ScriptCs.Hosting.ScriptConsole();
            var services = new PvcScriptServicesBuilder(console, logger);

            var initServices = new ScriptCs.Hosting.InitializationServices(logger);

            var installationProvider = services.InitializationServices.GetInstallationProvider();
            installationProvider.Initialize();

            var packageInstaller = services.InitializationServices.GetPackageInstaller();
            var packageAssemblyResolver = services.InitializationServices.GetPackageAssemblyResolver();

            if (args.Length > 1)
            {
                var packageName = args[1];
                var packageVersion = "";
                if (flags.ContainsKey("version"))
                    packageVersion = flags["version"];

                var packageRef = new ScriptCs.PackageReference(packageName, VersionUtility.ParseFrameworkName("net45"), packageVersion);
                packageInstaller.InstallPackages(new[] { packageRef }, true);
            }
            else
            {
                var packages = packageAssemblyResolver.GetPackages(Directory.GetCurrentDirectory());
                packageInstaller.InstallPackages(packages);
            }

            packageAssemblyResolver.SavePackages();
        }