Inheritance: MachineWidePackage
Beispiel #1
0
 void InstallDefaultSource(MachineWideInstallation mwInstl)
 {
     var msvsdirPath = new DirectoryInfo(@"C:\Program Files (x86)").EnumerateDirectories("Microsoft Visual Studio *").
                       Where(_ => Regex.IsMatch(_.Name, @"Microsoft Visual Studio \d+\.\d+")).
                       OrderByDescending(_ => _.Name).
                       Select(_ => _.FullName).
                       First();
     {
         var pkgName = "TestWindow";
         var src     = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow");
         mwInstl.OnPrigSourceInstalling(pkgName, src);
         var stdout = PrigExecutor.StartInstalling(pkgName, src);
         mwInstl.OnPrigSourceInstalled(stdout);
     }
     {
         var pkgName = "TestWindow1";
         var src     = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow\x64");
         if (EnvironmentRepository.ExistsDirectory(src))
         {
             mwInstl.OnPrigSourceInstalling(pkgName, src);
             var stdout = PrigExecutor.StartInstalling(pkgName, src);
             mwInstl.OnPrigSourceInstalled(stdout);
         }
     }
 }
        void InstallDefaultSource(MachineWideInstallation mwInstl)
        {
            var query = from envVar in EnvironmentRepository.GetEnvironmentVariables()
                        where Regex.IsMatch(envVar.Key, @"VS\d{3}COMNTOOLS", RegexOptions.IgnoreCase)
                        select envVar;

            foreach (var envVar in query)
            {
                var vsComnToolsPathName = envVar.Key;
                var vsComnToolsPath     = envVar.Value;

                var msvsdirPath = Path.Combine(vsComnToolsPath, @"..\..");
                {
                    var pkgName = "TestWindow_" + vsComnToolsPathName;
                    var src     = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow");
                    if (EnvironmentRepository.ExistsDirectory(src))
                    {
                        mwInstl.OnPrigSourceInstalling(pkgName, src);
                        var stdout = PrigExecutor.StartInstalling(pkgName, src);
                        mwInstl.OnPrigSourceInstalled(stdout);
                    }
                }
                {
                    var pkgName = "TestWindow64_" + vsComnToolsPathName;
                    var src     = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow\x64");
                    if (EnvironmentRepository.ExistsDirectory(src))
                    {
                        mwInstl.OnPrigSourceInstalling(pkgName, src);
                        var stdout = PrigExecutor.StartInstalling(pkgName, src);
                        mwInstl.OnPrigSourceInstalled(stdout);
                    }
                }
            }
        }
Beispiel #3
0
        public void Install(MachineWideInstallation mwInstl)
        {
            if (mwInstl == null)
            {
                throw new ArgumentNullException("mwInstl");
            }

            mwInstl.OnPreparing();

            if (HasBeenInstalled(mwInstl.Prerequisite))
            {
                mwInstl.OnCompleted(MachineWideProcessResults.Skipped);
                return;
            }

            EnvironmentRepository.RegisterPackageFolder();
            EnvironmentRepository.RegisterToolsPath();
            CreateNupkg(mwInstl);
            RegisterNuGetSource(mwInstl);
            RegisterEnvironmentVariables(mwInstl);
            RegisterProfiler(mwInstl);
            if (!mwInstl.IsPrigSourceInstallationDisabled)
            {
                InstallDefaultSource(mwInstl);
            }

            mwInstl.OnCompleted(MachineWideProcessResults.Completed);
        }
Beispiel #4
0
        void RegisterNuGetSource(MachineWideInstallation mwInstl)
        {
            var toolsPath = EnvironmentRepository.GetToolsPath();
            var name      = "Prig Source";

            mwInstl.OnNuGetSourceRegistering(name, toolsPath);
            var stdout = NuGetExecutor.StartSourcing(name, toolsPath);

            mwInstl.OnNuGetSourceRegistered(stdout);
        }
Beispiel #5
0
        void CreateNupkg(MachineWideInstallation mwInstl)
        {
            var toolsPath = EnvironmentRepository.GetToolsPath();
            var pkgName   = "Prig";

            mwInstl.OnNuGetPackageCreating(pkgName);
            var nugetPackageFolder = Path.Combine(toolsPath, "NuGet");
            var stdout             = NuGetExecutor.StartPacking(Path.Combine(nugetPackageFolder, "Prig.nuspec"), toolsPath);

            mwInstl.OnNuGetPackageCreated(stdout);
        }
Beispiel #6
0
        void RegisterProfiler(MachineWideInstallation mwInstl)
        {
            var profLocs = EnvironmentRepository.GetProfilerLocations();

            if (profLocs == null || profLocs.Length == 0)
            {
                return;
            }

            foreach (var profLoc in EnvironmentRepository.GetProfilerLocations())
            {
                mwInstl.OnProfilerRegistering(profLoc);
                var stdout = Regsvr32Executor.StartInstalling(profLoc.PathOfInstalling);
                mwInstl.OnProfilerRegistered(stdout);
            }
        }
Beispiel #7
0
 void RegisterEnvironmentVariables(MachineWideInstallation mwInstl)
 {
     {
         var pkgDir = EnvironmentRepository.GetPackageFolder();
         var name   = EnvironmentRepository.GetPackageFolderKey();
         var value  = pkgDir;
         mwInstl.OnEnvironmentVariableRegistering(name, value);
         EnvironmentRepository.StorePackageFolder(value);
         mwInstl.OnEnvironmentVariableRegistered(name, value);
     }
     {
         var logDir = EnvironmentRepository.GetLogFolder();
         var name   = EnvironmentRepository.GetLogFolderKey();
         var value  = logDir;
         mwInstl.OnEnvironmentVariableRegistering(name, value);
         EnvironmentRepository.StoreLogFolder(value);
         mwInstl.OnEnvironmentVariableRegistered(name, value);
     }
 }
 void RegisterEnvironmentVariables(MachineWideInstallation mwInstl)
 {
     {
         var pkgDir = EnvironmentRepository.GetPackageFolder();
         var name   = EnvironmentRepository.GetPackageFolderKey();
         var value  = pkgDir;
         mwInstl.OnEnvironmentVariableRegistering(name, value);
         EnvironmentRepository.StorePackageFolder(value);
         mwInstl.OnEnvironmentVariableRegistered(name, value);
     }
     {
         var logDir = EnvironmentRepository.GetLogFolder();
         var name   = EnvironmentRepository.GetLogFolderKey();
         var value  = logDir;
         mwInstl.OnEnvironmentVariableRegistering(name, value);
         EnvironmentRepository.StoreLogFolder(value);
         EnvironmentRepository.CreateDirectory(value);
         EnvironmentRepository.SetFullControlPermissionsToEveryone(value);
         mwInstl.OnEnvironmentVariableRegistered(name, value);
     }
 }
        public void Install(MachineWideInstallation mwInstl)
        {
            if (mwInstl == null)
                throw new ArgumentNullException("mwInstl");

            mwInstl.OnPreparing();

            if (HasBeenInstalled(mwInstl.Prerequisite))
            {
                mwInstl.OnCompleted(MachineWideProcessResults.Skipped);
                return;
            }

            EnvironmentRepository.RegisterPackageFolder();
            EnvironmentRepository.RegisterToolsPath();
            CreateNupkg(mwInstl);
            RegisterNuGetSource(mwInstl);
            RegisterEnvironmentVariables(mwInstl);
            RegisterProfiler(mwInstl);
            if (!mwInstl.IsPrigSourceInstallationDisabled)
                InstallDefaultSource(mwInstl);

            mwInstl.OnCompleted(MachineWideProcessResults.Completed);
        }
Beispiel #10
0
        void RegisterProfiler(MachineWideInstallation mwInstl)
        {
            var profLocs = EnvironmentRepository.GetProfilerLocations();
            if (profLocs == null || profLocs.Length == 0)
                return;

            foreach (var profLoc in EnvironmentRepository.GetProfilerLocations())
            {
                mwInstl.OnProfilerRegistering(profLoc);
                var stdout = Regsvr32Executor.StartInstalling(profLoc.PathOfInstalling);
                mwInstl.OnProfilerRegistered(stdout);
            }
        }
Beispiel #11
0
 void RegisterNuGetSource(MachineWideInstallation mwInstl)
 {
     var toolsPath = EnvironmentRepository.GetToolsPath();
     var name = "Prig Source";
     mwInstl.OnNuGetSourceRegistering(name, toolsPath);
     var stdout = NuGetExecutor.StartSourcing(name, toolsPath);
     mwInstl.OnNuGetSourceRegistered(stdout);
 }
Beispiel #12
0
 void RegisterEnvironmentVariables(MachineWideInstallation mwInstl)
 {
     {
         var pkgDir = EnvironmentRepository.GetPackageFolder();
         var name = EnvironmentRepository.GetPackageFolderKey();
         var value = pkgDir;
         mwInstl.OnEnvironmentVariableRegistering(name, value);
         EnvironmentRepository.StorePackageFolder(value);
         mwInstl.OnEnvironmentVariableRegistered(name, value);
     }
     {
         var logDir = EnvironmentRepository.GetLogFolder();
         var name = EnvironmentRepository.GetLogFolderKey();
         var value = logDir;
         mwInstl.OnEnvironmentVariableRegistering(name, value);
         EnvironmentRepository.StoreLogFolder(value);
         mwInstl.OnEnvironmentVariableRegistered(name, value);
     }
 }
Beispiel #13
0
 void InstallDefaultSource(MachineWideInstallation mwInstl)
 {
     var query = from envVar in EnvironmentRepository.GetEnvironmentVariables()
                 where Regex.IsMatch(envVar.Key, @"VS\d{3}COMNTOOLS", RegexOptions.IgnoreCase)
                 orderby envVar.Key descending
                 select envVar.Value;
     var vsComnToolsPath = query.First();
     var msvsdirPath = Path.Combine(vsComnToolsPath, @"..\..");
     {
         var pkgName = "TestWindow";
         var src = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow");
         mwInstl.OnPrigSourceInstalling(pkgName, src);
         var stdout = PrigExecutor.StartInstalling(pkgName, src);
         mwInstl.OnPrigSourceInstalled(stdout);
     }
     {
         var pkgName = "TestWindow1";
         var src = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow\x64");
         if (EnvironmentRepository.ExistsDirectory(src))
         {
             mwInstl.OnPrigSourceInstalling(pkgName, src);
             var stdout = PrigExecutor.StartInstalling(pkgName, src);
             mwInstl.OnPrigSourceInstalled(stdout);
         }
     }
 }
Beispiel #14
0
 void CreateNupkg(MachineWideInstallation mwInstl)
 {
     var toolsPath = EnvironmentRepository.GetToolsPath();
     var pkgName = "Prig";
     mwInstl.OnNuGetPackageCreating(pkgName);
     var nugetPackageFolder = Path.Combine(toolsPath, "NuGet");
     var stdout = NuGetExecutor.StartPacking(Path.Combine(nugetPackageFolder, "Prig.nuspec"), toolsPath);
     mwInstl.OnNuGetPackageCreated(stdout);
 }