[mapguide-commits] r8523 - in trunk/Tools/MgInstantSetup: . InstantSetup InstantSetupCmd InstantSetupCmd/Properties
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Jan 28 03:49:12 PST 2015
Author: jng
Date: 2015-01-28 03:49:12 -0800 (Wed, 28 Jan 2015)
New Revision: 8523
Added:
trunk/Tools/MgInstantSetup/InstantSetupCmd/
trunk/Tools/MgInstantSetup/InstantSetupCmd/App.config
trunk/Tools/MgInstantSetup/InstantSetupCmd/InstantSetupCmd.csproj
trunk/Tools/MgInstantSetup/InstantSetupCmd/Options.cs
trunk/Tools/MgInstantSetup/InstantSetupCmd/Program.cs
trunk/Tools/MgInstantSetup/InstantSetupCmd/Properties/
trunk/Tools/MgInstantSetup/InstantSetupCmd/Properties/AssemblyInfo.cs
trunk/Tools/MgInstantSetup/InstantSetupCmd/app.manifest
trunk/Tools/MgInstantSetup/InstantSetupCmd/packages.config
Modified:
trunk/Tools/MgInstantSetup/
trunk/Tools/MgInstantSetup/InstantSetup/InstantSetup.csproj
trunk/Tools/MgInstantSetup/MgInstantSetup.sln
Log:
#2498: Initial implementation of command-line instant setup.
Property changes on: trunk/Tools/MgInstantSetup
___________________________________________________________________
Added: svn:ignore
+ *.suo
out
packages
Modified: trunk/Tools/MgInstantSetup/InstantSetup/InstantSetup.csproj
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup/InstantSetup.csproj 2015-01-27 16:31:34 UTC (rev 8522)
+++ trunk/Tools/MgInstantSetup/InstantSetup/InstantSetup.csproj 2015-01-28 11:49:12 UTC (rev 8523)
@@ -23,18 +23,20 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>..\out\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
+ <OutputPath>..\out\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Property changes on: trunk/Tools/MgInstantSetup/InstantSetupCmd
___________________________________________________________________
Added: svn:ignore
+ bin
obj
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/App.config
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/App.config (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/App.config 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
+ </startup>
+</configuration>
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/InstantSetupCmd.csproj
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/InstantSetupCmd.csproj (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/InstantSetupCmd.csproj 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{F0F1213D-B904-45E5-977B-E4772363DF74}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>InstantSetupCmd</RootNamespace>
+ <AssemblyName>InstantSetupCmd</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\out\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\out\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationManifest>app.manifest</ApplicationManifest>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="CommandLine">
+ <HintPath>..\packages\CommandLineParser.1.9.71\lib\net40\CommandLine.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Options.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="app.manifest" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\InstantSetup.Core\InstantSetup.Core.csproj">
+ <Project>{70f74850-dc74-431e-993d-8200e13b026a}</Project>
+ <Name>InstantSetup.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/Options.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/Options.cs (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/Options.cs 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,105 @@
+using CommandLine;
+using CommandLine.Text;
+using InstantSetup.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace InstantSetupCmd
+{
+ public enum MapGuideWebConfiguration
+ {
+ Apache,
+ IIS
+ }
+
+ public class Options
+ {
+ [Option('v', "viewer", DefaultValue = ApiType.Php, HelpText = "The default viewer type that the mapviewerajax virtual directory will bind to (Php, Java or DotNet)")]
+ public ApiType DefaultViewer { get; set; }
+
+ [Option("admin-port", DefaultValue = 2820, HelpText = "The port to listen on for admin connections")]
+ public int ServerAdminPort { get; set; }
+
+ [Option("client-port", DefaultValue = 2820, HelpText = "The port to listen on for client connections")]
+ public int ServerClientPort { get; set; }
+
+ [Option("site-port", DefaultValue = 2820, HelpText = "The port to listen on for site connections")]
+ public int ServerSitePort { get; set; }
+
+ [Option("write-mentor-dictionary-path", DefaultValue = false, HelpText = "Write code to set up MENTOR_DICTIONARY_PATH on batch scripts. Only applicable for MGOS 2.2 or older")]
+ public bool WriteMentorDictionaryPath { get; set; }
+
+ [Option("enable-php", DefaultValue = true, HelpText = "Enable PHP for this MapGuide installation")]
+ public bool EnablePhp { get; set; }
+
+ [Option("64bit", DefaultValue = false, HelpText = "This is a 64-bit MapGuide installation. Must be explicitly set for IIS-based install")]
+ public bool Is64BitMapGuideForIIS { get; set; }
+
+ [Option('o', "output", Required = true, HelpText = "The path where generated batch scripts will be saved to")]
+ public string BatchFileOutputDirectory { get; set; }
+
+ [Option("service-name", HelpText = "The name of the service to use if installing MapGuide as a windows service. Only applicable if --install-services is specified")]
+ public string MapGuideServiceName { get; set; }
+
+ [Option("install-services", DefaultValue = false, HelpText = "If true, will generate batch scripts to register MapGuide as a windows service")]
+ public bool InstallServices { get; set; }
+
+ [Option("backup-path", HelpText = "The directory where backups of configuration files will be copied to")]
+ public string BackupConfigPath { get; set; }
+
+ [Option("backup-files", DefaultValue = true, HelpText = "If true, will create backups of existing configuration files before overwriting")]
+ public bool BackupConfigFiles { get; set; }
+
+ [Option("source-dir", HelpText = "The root path of the MapGuide installation (where InstantSetupCmd will do its configuration)")]
+ public string SourceRootDir { get; set; }
+
+ [Option("virtual-dir", DefaultValue = "mapguide", HelpText = "The name of the mapguide virtual directory to create on IIS/Apache")]
+ public string VirtualDirectoryName { get; set; }
+
+ [Option("webtier-config", Required = true, DefaultValue = MapGuideWebConfiguration.Apache, HelpText = "The web tier configuration to use (IIS / Apache)")]
+ public MapGuideWebConfiguration WebTierConfig { get; set; }
+
+#region Apache-specific
+ [Option("enable-java", DefaultValue = false, HelpText = "Enables Java for this MapGuide installation")]
+ public bool EnableJava { get; set; }
+
+ [Option("tomcat-port", DefaultValue = 8019, HelpText = "The port number to use for the bundled copy of Tomcat. Only applicable if using Apache configuration and Java is enabled")]
+ public int TomcatPortNumber { get; set; }
+
+ [Option("httpd-port", DefaultValue = 8018, HelpText = "The port number to use for the bundled copy of Apache. Only applicable if using Apache configuration")]
+ public int ApachePortNumber { get; set; }
+
+ [Option("httpd-service-name", HelpText = "The service name to use for Apache if registering it as a service. Only applicable if using Apache confguration and --install-services is specified")]
+ public string HttpdServiceName { get; set; }
+
+ [Option("apache-dir-name", DefaultValue = "Apache24", HelpText = "The name of the directory in the install root that contains the bundled copy of Apache")]
+ public string ApacheDirName { get; set; }
+#endregion
+
+#region IIS-specific
+ [Option("enable-dotnet", DefaultValue = true, HelpText = "Enables .net for this MapGuide installation")]
+ public bool EnableDotNet { get; set; }
+
+ [Option("application-pool", DefaultValue = "MapGuideTrunkAppPool", HelpText = "The name of the IIS application pool to create")]
+ public string ApplicationPool { get; set; }
+
+ [Option("default-web-site", DefaultValue = "Default Web Site", HelpText = "The name of the default IIS web site to install the web extensions into")]
+ public string WebSiteName { get; set; }
+
+ [Option("appcmd-path", DefaultValue = "C:\\Windows\\System32\\inetsrv\\appcmd.exe", HelpText = "The path to appcmd.exe for automating IIS configuration")]
+ public string AppCmdPath { get; set; }
+#endregion
+
+ [ParserState]
+ public IParserState LastParserState { get; set; }
+
+ [HelpOption]
+ public string GetUsage()
+ {
+ return HelpText.AutoBuild(this,
+ (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
+ }
+ }
+}
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/Program.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/Program.cs (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/Program.cs 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,93 @@
+using InstantSetup.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InstantSetupCmd
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Options options = new Options();
+ if (CommandLine.Parser.Default.ParseArguments(args, options))
+ {
+ AbstractSetupConfigurationProcess proc = null;
+ switch (options.WebTierConfig)
+ {
+ case MapGuideWebConfiguration.Apache:
+ proc = CreateApacheConfig(options);
+ break;
+ case MapGuideWebConfiguration.IIS:
+ proc = CreateIISConfig(options);
+ break;
+ default:
+ Console.WriteLine("Unknown web tier configuration: {0}", options.WebTierConfig);
+ Environment.Exit(1);
+ break;
+ }
+ if (proc != null)
+ {
+ proc.Execute();
+ Console.WriteLine("Batch scripts saved to: {0}", options.BatchFileOutputDirectory);
+ Environment.Exit(0);
+ }
+ }
+ }
+
+ private static AbstractSetupConfigurationProcess CreateIISConfig(Options options)
+ {
+ IISSetupConfigurationProcess proc = new IISSetupConfigurationProcess();
+
+ proc.AppCmdPath = options.AppCmdPath;
+ proc.ApplicationPool = options.ApplicationPool;
+ proc.BackupConfigFiles = options.BackupConfigFiles;
+ proc.BackupConfigPath = options.BackupConfigPath;
+ proc.BatchFileOutputDirectory = options.BatchFileOutputDirectory;
+ proc.BuildOutputPath = options.SourceRootDir;
+ proc.DefaultViewer = options.DefaultViewer;
+ proc.EnableDotNet = options.EnableDotNet;
+ proc.EnablePhp = options.EnablePhp;
+ proc.InstallServices = options.InstallServices;
+ proc.Is64BitMapGuide = options.Is64BitMapGuideForIIS;
+ proc.MapGuideServiceName = options.MapGuideServiceName;
+ proc.ServerAdminPort = options.ServerAdminPort;
+ proc.ServerClientPort = options.ServerClientPort;
+ proc.ServerSitePort = options.ServerSitePort;
+ proc.UsingIIS7 = true;
+ proc.VirtualDirectoryName = options.VirtualDirectoryName;
+ proc.WebSiteName = options.WebSiteName;
+ proc.WriteMentorDictionaryPath = options.WriteMentorDictionaryPath;
+
+ return proc;
+ }
+
+ private static AbstractSetupConfigurationProcess CreateApacheConfig(Options options)
+ {
+ ApacheSetupConfigurationProcess proc = new ApacheSetupConfigurationProcess();
+
+ proc.ApacheDirName = options.ApacheDirName;
+ proc.ApachePortNumber = options.ApachePortNumber;
+ proc.BackupConfigFiles = options.BackupConfigFiles;
+ proc.BackupConfigPath = options.BackupConfigPath;
+ proc.BatchFileOutputDirectory = options.BatchFileOutputDirectory;
+ proc.BuildOutputPath = options.SourceRootDir;
+ proc.DefaultViewer = options.DefaultViewer;
+ proc.EnableJava = options.EnableJava;
+ proc.EnablePhp = options.EnablePhp;
+ proc.HttpdServiceName = options.HttpdServiceName;
+ proc.InstallServices = options.InstallServices;
+ proc.MapGuideServiceName = options.MapGuideServiceName;
+ proc.ServerAdminPort = options.ServerAdminPort;
+ proc.ServerClientPort = options.ServerClientPort;
+ proc.ServerSitePort = options.ServerSitePort;
+ proc.TomcatPortNumber = options.TomcatPortNumber;
+ proc.VirtualDirectoryName = options.VirtualDirectoryName;
+ proc.WriteMentorDictionaryPath = options.WriteMentorDictionaryPath;
+
+ return proc;
+ }
+ }
+}
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/Properties/AssemblyInfo.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/Properties/AssemblyInfo.cs 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("InstantSetupCmd")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("InstantSetupCmd")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3feb1d01-4a0b-423c-ab79-0f7cb9af7ad7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/app.manifest
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/app.manifest (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/app.manifest 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <!-- UAC Manifest Options
+ If you want to change the Windows User Account Control level replace the
+ requestedExecutionLevel node with one of the following.
+
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
+ <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
+
+ If you want to utilize File and Registry Virtualization for backward
+ compatibility then delete the requestedExecutionLevel node.
+ -->
+ <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</asmv1:assembly>
Added: trunk/Tools/MgInstantSetup/InstantSetupCmd/packages.config
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetupCmd/packages.config (rev 0)
+++ trunk/Tools/MgInstantSetup/InstantSetupCmd/packages.config 2015-01-28 11:49:12 UTC (rev 8523)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="CommandLineParser" version="1.9.71" targetFramework="net40-Client" />
+</packages>
\ No newline at end of file
Modified: trunk/Tools/MgInstantSetup/MgInstantSetup.sln
===================================================================
--- trunk/Tools/MgInstantSetup/MgInstantSetup.sln 2015-01-27 16:31:34 UTC (rev 8522)
+++ trunk/Tools/MgInstantSetup/MgInstantSetup.sln 2015-01-28 11:49:12 UTC (rev 8523)
@@ -5,6 +5,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstantSetup", "InstantSetup\InstantSetup.csproj", "{72CDEB87-1ED2-4177-8C00-962E79F36CA6}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstantSetupCmd", "InstantSetupCmd\InstantSetupCmd.csproj", "{F0F1213D-B904-45E5-977B-E4772363DF74}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -19,6 +21,10 @@
{72CDEB87-1ED2-4177-8C00-962E79F36CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72CDEB87-1ED2-4177-8C00-962E79F36CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72CDEB87-1ED2-4177-8C00-962E79F36CA6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F0F1213D-B904-45E5-977B-E4772363DF74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F0F1213D-B904-45E5-977B-E4772363DF74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F0F1213D-B904-45E5-977B-E4772363DF74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F0F1213D-B904-45E5-977B-E4772363DF74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
More information about the mapguide-commits
mailing list