/// <summary>
        /// Add a deploy destination.
        /// </summary>
        public void Add(FilterSettings item)
        {
            if (Contains(item.VirtualPath))
                throw new InvalidOperationException(string.Format("Filter settings for path '{0}' already exists.", item.VirtualPath));

            _list.Add(item);
        }
Example #2
0
        /// <summary>
        /// Checks if the project file needs to be migrated.
        /// This is performed automatically while loading a project.
        /// </summary>
        private void MigrateProject()
        {
            if (_fileFormatVersion >= CurrentFileFormatVersion)
                return;

            bool migrated = false;

            // Verify and migrate plugins
            if(_pluginsettings != null && _pluginsettings.Count > 0) {
                // Ensure there is a default config
                if (_deployconfigs.Count == 0) {
                    _deployconfigs.Add(new DeployConfig(DefaultConfigName));
                }

                // Update and move plugins to the correct destination
                DeployConfig config = _deployconfigs[0];
                foreach(PluginSettings pluginsettings in _pluginsettings) {
                    PluginDescriptor descriptor = PluginManager.GetPluginDescriptorForIdentifier(pluginsettings.Identifier);
                    pluginsettings.Type = descriptor.PluginTypeFullName;

                    DeployDestination destination = new DeployDestination(pluginsettings.Identifier, pluginsettings.Identifier);
                    pluginsettings.Identifier = null;

                    destination.PluginSettings = pluginsettings;
                    config.Destinations.Add(destination);
                }
                _pluginsettings = null;
                migrated = true;
            }

            // Migrate plugin types automatically
            if (_fileFormatVersion < 2) {
                foreach (DeployConfig deployconfig in _deployconfigs) {
                    foreach (DeployDestination destination in deployconfig.Destinations) {
                        // Ensure that the plugin type is ok
                        PluginSettings settings = destination.PluginSettings;
                        switch (settings.Type) {
                            case "DeployerPlugins.Wcm.WcmDeployer":
                                settings.Type = "Stendahls.DeployerPlugins.Wcm.WcmDeployer";
                                migrated = true;
                                break;
                            case "DeployerPlugins.GwsDeployer":
                                settings.Type = "Stendahls.DeployerPlugins.Gws.GwsDeployer";
                                migrated = true;
                                break;
                        }
                    }
                }
                migrated = true;
            }

            // Move database settings
            if (_databasesettings != null) {
                // Ensure there is a default config
                if (_deployconfigs.Count == 0) {
                    _deployconfigs.Add(new DeployConfig(DefaultConfigName));
                }

                DeployConfig config = _deployconfigs[0];
                config.DatabaseSettings = _databasesettings;
                _databasesettings = null;

                migrated = true;
            }

            // Verify and migrate filters
            if (_filters != null) {
                // Ensure there is a default config
                if (_deployconfigs.Count == 0) {
                    _deployconfigs.Add(new DeployConfig(DefaultConfigName));
                }

                // Upgrade filters and move them to default target
                DeployConfig config = _deployconfigs[0];
                //_filters.ExcludeDirectories.Migrate(config);
                //_filters.ExcludeFiles.Migrate(config);
                //_filters.ExcludeProcedures.Migrate(config);
                //_filters.IncludeFiles.Migrate(config);
                config.FilterSettings.Add(_filters);

                // Move database filter
                if (_filters.ExcludeProcedures != null) {
                    config.DatabaseSettings.ExcludeProcedures = _filters.ExcludeProcedures;
                    _filters.ExcludeProcedures = null;
                }

                // Move use project flag, and clear it from the old place
                if(!string.IsNullOrEmpty(_filters.UseProjectFilter)) {
                    bool useProjectFilter;
                    if (bool.TryParse(_filters.UseProjectFilter, out useProjectFilter))
                        config.UseProjectFilter = useProjectFilter;
                    _filters.UseProjectFilter = null;
                }

                _filters = null;
                migrated = true;
            }

            if (migrated) {
                _fileFormatVersion = CurrentFileFormatVersion;

                // Project has been upgraded
                EventManager.OnNotificationMessage("Project has been successfully migrated to the new file format.");
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new project with default settings.
        /// </summary>
        public void InitNewProject()
        {
            _fileFormatVersion = 1;

            DeployConfig config = new DeployConfig(DefaultConfigName);
            _deployconfigs.Add(config);

            _localPath = ".";

            FilterSettings fs = new FilterSettings();
            ActiveDeployConfig.FilterSettings.Add(fs);

            // Add some default file types
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.asax"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.ascx"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.asp"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.aspx"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.html"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.cshtml"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.dll"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.pdb"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.png"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.gif"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.jpg"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.css"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.xslt"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.js"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"*.swf"));
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.Wildcard, @"web.config"));

            PluginManager.UnloadPlugins();
        }
Example #4
0
        private void _menuIncludeSingle_Click(object sender, EventArgs e)
        {
            if(_filelist.SelectedItems.Count == 0)
                return;

            GLItem item = (GLItem) _filelist.SelectedItems[0];

            string folderpath = GetFullPathForNode(_folderTree.SelectedNode);
            string virtualpath = PathHelper.GetVirtualPath(folderpath, _currentProject.LocalPathAbsolute);

            // Lookup or create filter settings for the virtual path
            FilterSettings fs = _currentProject.ActiveDeployConfig.FilterSettings.Get(virtualpath);
            if(fs == null) {
                fs = new FilterSettings(virtualpath);
                _currentProject.ActiveDeployConfig.FilterSettings.Add(fs);
            }
            fs.IncludeFiles.Add(new Filter(FilterExpressionType.ExactFileName, item.Text));
        }