From 8342e21c69566aee858fae439c5fa90e635308a1 Mon Sep 17 00:00:00 2001 From: Alex Fort Date: Wed, 20 Jul 2011 11:51:21 -0400 Subject: [PATCH 1/2] Specify Mono.* dlls to live in the lib path if they're not in the GAC, so windows users don't have to modify the project file to build. --- src/Manos/Manos.csproj | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Manos/Manos.csproj b/src/Manos/Manos.csproj index 21fda8df..0a8dd648 100644 --- a/src/Manos/Manos.csproj +++ b/src/Manos/Manos.csproj @@ -38,9 +38,15 @@ - - - + + ..\..\libs\Mono.Posix.dll + + + ..\..\libs\Mono.CSharp.dll + + + ..\..\libs\Mono.C5.dll + False ..\..\libs\Nini.dll From bfc40ff2bd4a004be587660deb3946355886d48b Mon Sep 17 00:00:00 2001 From: Alex Fort Date: Wed, 20 Jul 2011 12:13:24 -0400 Subject: [PATCH 2/2] Add IsWindows property to Environment so we can switch things around based on that. Add error message when --init is run without any AppName Specify tool name (manostool) in a static field so we're not writing the tool name over and over. --- src/manostool/Driver.cs | 30 +++++++++++++++++++++--------- src/manostool/Environment.cs | 7 +++++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/manostool/Driver.cs b/src/manostool/Driver.cs index 383e827f..053dced3 100644 --- a/src/manostool/Driver.cs +++ b/src/manostool/Driver.cs @@ -39,6 +39,7 @@ class Driver public static readonly string COMPILED_TEMPLATES_ASSEMBLY = "CompiledTemplates.dll"; public static readonly string TEMPLATES_DIRECTORY = "Templates"; public static readonly string DEPLOYMENT_DIRECTORY = "Deployment"; + public static readonly string MANOS_TOOLNAME = "manostool"; private static Environment Environment = new Environment (); @@ -65,7 +66,7 @@ public static int Main (string[] args) try { extra = p.Parse(args); } catch (OptionException){ - Console.WriteLine ("Try `manos --help' for more information."); + Console.WriteLine (string.Format ("Try `{0} --help' for more information.", MANOS_TOOLNAME)); return 1; } @@ -115,7 +116,7 @@ private static string [] ParseGlobalOptions (string [] args) try { extra = p.Parse(args); } catch (OptionException){ - Console.WriteLine ("Try `manos --help' for more information."); + Console.WriteLine (string.Format ("Try `{0} --help' for more information.", MANOS_TOOLNAME)); return null; } @@ -128,11 +129,16 @@ private static string [] ParseGlobalOptions (string [] args) private static int Init (IList args) { if (args.Count < 1) { - Console.WriteLine ("manos --init "); + Console.WriteLine (string.Format ("{0} --init ", MANOS_TOOLNAME)); Console.WriteLine ("This will initialize a new application with the supplied name."); } Driver d = new Driver (); + + if (args.Count <= 0) { + Console.WriteLine ("Error: Unable to init without an AppName."); + return 1; + } try { Console.WriteLine ("initing: {0}", args [0]); @@ -276,18 +282,24 @@ public void RunBuild () private static int ShowEnvironment (IList args) { - Console.WriteLine ("libdir: '{0}'", Environment.LibDirectory); - Console.WriteLine ("manosdir: '{0}'", Environment.ManosDirectory); - Console.WriteLine ("workingdir: '{0}'", Environment.WorkingDirectory); - Console.WriteLine ("datadir: '{0}'", Environment.DataDirectory); - Console.WriteLine ("datadir: '{0}'", Environment.DocsDirectory); + if (Environment.IsWindows) { + Console.WriteLine ("manosdir: '{0}'", Environment.ManosDirectory); + Console.WriteLine ("datadir: '{0}'", Environment.DataDirectory); + Console.WriteLine ("docsdir: '{0}'", Environment.DocsDirectory); + } else { + Console.WriteLine ("libdir: '{0}'", Environment.LibDirectory); + Console.WriteLine ("manosdir: '{0}'", Environment.ManosDirectory); + Console.WriteLine ("workingdir: '{0}'", Environment.WorkingDirectory); + Console.WriteLine ("datadir: '{0}'", Environment.DataDirectory); + Console.WriteLine ("docsdir: '{0}'", Environment.DocsDirectory); + } return 1; } private static void ShowHelp (OptionSet os) { - Console.WriteLine ("manos usage is: manos [command] [options]"); + Console.WriteLine (string.Format ("{0} usage is: {0} [command] [options]", MANOS_TOOLNAME)); Console.WriteLine (); os.WriteOptionDescriptions (Console.Out); } diff --git a/src/manostool/Environment.cs b/src/manostool/Environment.cs index 69bc797b..b861cc78 100644 --- a/src/manostool/Environment.cs +++ b/src/manostool/Environment.cs @@ -39,6 +39,7 @@ public Environment () LibDirectory = "lib"; TemplatesDirectory = "Templates"; WorkingDirectory = Directory.GetCurrentDirectory (); + IsWindows = false; string exe_path = new Uri (typeof (Driver).Assembly.GetName ().CodeBase).LocalPath; @@ -46,6 +47,7 @@ public Environment () || System.Environment.OSVersion.Platform == PlatformID.Win32S || System.Environment.OSVersion.Platform == PlatformID.Win32Windows || System.Environment.OSVersion.Platform == PlatformID.WinCE) { + IsWindows = true; ManosDirectory = Path.GetDirectoryName(exe_path); DataDirectory = ManosDirectory; DocsDirectory = Path.Combine(ManosDirectory, "docs"); @@ -88,5 +90,10 @@ public string DocsDirectory { get; set; } + + public bool IsWindows { + get; + private set; + } } }