コード例 #1
0
ファイル: Conf.cs プロジェクト: wurdum/deployer
        public Conf(string sessionKey, DeployContext context, IConfFactory factory)
        {
            if (sessionKey == null || sessionKey.Length >= 50)
                throw new ArgumentException("Session key should be no more than 50 characters", "sessionKey");

            var confSection = DeployerConfigurationSection.Instance;

            SessionKey = sessionKey;
            _context = context;
            _updateRules = new UpdateRulesBuilder(confSection);

            InitializeSettings(confSection);

            PackageManager = factory.CreatePackageManager();
            IISManager = factory.CreateIISManager(IIS, _context.UriName);
        }
コード例 #2
0
        public Conf(string sessionKey, DeployContext context, IConfFactory factory)
        {
            if (sessionKey == null || sessionKey.Length >= 50)
            {
                throw new ArgumentException("Session key should be no more than 50 characters", "sessionKey");
            }

            var confSection = DeployerConfigurationSection.Instance;

            SessionKey   = sessionKey;
            _context     = context;
            _updateRules = new UpdateRulesBuilder(confSection);

            InitializeSettings(confSection);

            PackageManager = factory.CreatePackageManager();
            IISManager     = factory.CreateIISManager(IIS, _context.UriName);
        }
コード例 #3
0
ファイル: UpdateRules.cs プロジェクト: wurdum/deployer
 public static IEnumerable <UpdateRule> ToUpdateRules(this UpdateRulesCollection coll)
 {
     return(coll.Cast <UpdateRuleElement>().Select(rule => new UpdateRule(UpdateRulesBuilder.ToFunc(rule.Func), rule.Value, rule.Inverted)));
 }
コード例 #4
0
ファイル: UpdateRulesTests.cs プロジェクト: wurdum/deployer
 private IEnumerable<IUpdateRule> GetUpdateRulesFor(DeployMode deployMode)
 {
     var confSection = DeployerConfigurationSection.Instance;
     var updateRulesBuilder = new UpdateRulesBuilder(confSection);
     return updateRulesBuilder[deployMode];
 }
コード例 #5
0
        public void UnpackZipByRulesTest(DeployMode deployMode)
        {
            var pathToSurvey = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir);
            var updateRulesBuilder = new UpdateRulesBuilder(_confSection);

            _packageManager.UnpackZipIfOverwriteThrow(_pathToZipForInstall, pathToSurvey);
            _packageManager.UnpackZipByRules(_pathToZipForUpdate, pathToSurvey, updateRulesBuilder[deployMode]);

            Assert.True(File.Exists(Path.Combine(pathToSurvey, "web.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, "connectionstrings.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"bin\spssio32.dll")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"bin\win64\spssio64.dll")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"app_data\white.csv")));
            Assert.False(Directory.Exists(Path.Combine(pathToSurvey, "common")));
            Assert.False(Directory.Exists(Path.Combine(pathToSurvey, "data")));

            var webConfText = File.ReadAllText(Path.Combine(pathToSurvey, "web.config"));

            if (deployMode == DeployMode.UpdateAll)
                Assert.That(webConfText, Is.EqualTo("Test"));
            else if (deployMode == DeployMode.UpdateAllExceptConf)
                Assert.That(webConfText, Is.Not.EqualTo("Test"));
        }
コード例 #6
0
        public void UnpackZipByRulesOnlyBinTest()
        {
            var pathToSurvey = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir);
            var updateRulesBuilder = new UpdateRulesBuilder(_confSection);

            _packageManager.UnpackZipIfOverwriteThrow(_pathToZipForInstall, pathToSurvey);
            _packageManager.UnpackZipByRules(_pathToZipForUpdateOnlyBin, pathToSurvey, updateRulesBuilder[DeployMode.UpdateBin]);

            Assert.True(File.Exists(Path.Combine(pathToSurvey, "web.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, "connectionstrings.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"views\web.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"customviews\web.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"bin\spssio32.dll")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"bin\surveyEngine.configuration.dll")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"bin\system.web.mvc.dll")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"bin\win64\spssio64.dll")));
            Assert.False(File.Exists(Path.Combine(pathToSurvey, @"bin\codehelper.common.dll")));
        }
コード例 #7
0
        public void UnpackZipByRulesOnlyAppDataTest()
        {
            var pathToSurvey = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir);
            var updateRulesBuilder = new UpdateRulesBuilder(_confSection);

            _packageManager.UnpackZipIfOverwriteThrow(_pathToZipForInstall, pathToSurvey);
            _packageManager.UnpackZipByRules(_pathToZipForUpdateOnlyAppData, pathToSurvey, updateRulesBuilder[DeployMode.UpdateAppData]);

            Assert.True(File.Exists(Path.Combine(pathToSurvey, "web.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, "connectionstrings.config")));
            Assert.True(Directory.Exists(Path.Combine(pathToSurvey, @"app_data\questionsdata")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, @"app_data\questionsdata\q4variants.txt")));
            Assert.False(File.Exists(Path.Combine(pathToSurvey, @"app_data\questionsdata\q1variants.txt")));
            Assert.False(File.Exists(Path.Combine(pathToSurvey, @"app_data\questionsdata\q2variants.txt")));
        }
コード例 #8
0
        public void FolderCleanWithAllExceptConfDeployModeTest()
        {
            var pathToSurvey = Path.Combine(_confSection.Settings.Paths.Surveys, _surveyDir);
            var updateRulesBuilder = new UpdateRulesBuilder(_confSection);

            _packageManager.UnpackZipIfOverwriteThrow(_pathToZipForInstall, pathToSurvey);
            _packageManager.CleanFolder(pathToSurvey, updateRulesBuilder[DeployMode.UpdateAllExceptConf]);

            Assert.True(File.Exists(Path.Combine(pathToSurvey, "web.config")));
            Assert.True(File.Exists(Path.Combine(pathToSurvey, "connectionstrings.config")));
            Assert.True(Directory.Exists(Path.Combine(pathToSurvey, "bin")));
            Assert.False(File.Exists(Path.Combine(pathToSurvey, @"views\web.config")));
            Assert.False(File.Exists(Path.Combine(pathToSurvey, @"customviews\web.config")));
            Assert.False(File.Exists(Path.Combine(pathToSurvey, @"common\parameters.cs")));
        }