Skip to content

Commit

Permalink
(chucknorrisGH-240) Fix for bug: When reading the Version file the co…
Browse files Browse the repository at this point in the history
…ntent is not trimmed.

Added trim to the TextVersionResolver class where it reads the version
from a text file. Created supporting unit test.
  • Loading branch information
macfarmw committed May 24, 2016
1 parent c16c0f9 commit 15fef66
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 94 deletions.
2 changes: 1 addition & 1 deletion product/roundhouse.console/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<packages>
<package id="FluentNHibernate" version="1.3.0.733" targetFramework="net35" />
<package id="Iesi.Collections" version="3.3.2.4000" targetFramework="net35" />
<package id="log4net" version="2.0.0" targetFramework="net35" />
<package id="log4net" version="2.0.3" targetFramework="net35" />
<package id="NHibernate" version="3.3.2.4000" targetFramework="net35" />
<package id="PublishedApplications" version="2.1.0.0" targetFramework="net35" />
<package id="structuremap" version="2.6.3" />
Expand Down
6 changes: 3 additions & 3 deletions product/roundhouse.console/roundhouse.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\packages\Iesi.Collections.3.3.2.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\log4net.2.0.0\lib\net35-full\log4net.dll</HintPath>
<Reference Include="log4net">
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion product/roundhouse.tasks/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<packages>
<package id="FluentNHibernate" version="1.3.0.733" targetFramework="net35" />
<package id="Iesi.Collections" version="3.3.2.4000" targetFramework="net35" />
<package id="log4net" version="2.0.0" targetFramework="net35" />
<package id="log4net" version="2.0.3" targetFramework="net35" />
<package id="NHibernate" version="3.3.2.4000" targetFramework="net35" />
<package id="PublishedApplications" version="2.1.0.0" targetFramework="net35" />
<package id="structuremap" version="2.6.3" />
Expand Down
4 changes: 2 additions & 2 deletions product/roundhouse.tasks/roundhouse.tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\packages\Iesi.Collections.3.3.2.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\log4net.2.0.0\lib\net35-full\log4net.dll</HintPath>
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Framework">
<Private>True</Private>
Expand Down
2 changes: 1 addition & 1 deletion product/roundhouse.tests.integration/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<packages>
<package id="FluentNHibernate" version="1.3.0.733" targetFramework="net35" />
<package id="Iesi.Collections" version="3.3.2.4000" targetFramework="net35" />
<package id="log4net" version="2.0.0" targetFramework="net35" />
<package id="log4net" version="2.0.3" targetFramework="net35" />
<package id="NHibernate" version="3.3.2.4000" targetFramework="net35" />
<package id="RhinoMocks" version="3.6.1" targetFramework="net35" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\packages\Iesi.Collections.3.3.2.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\log4net.2.0.0\lib\net35-full\log4net.dll</HintPath>
<Reference Include="log4net">
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="MbUnit.Framework, Version=2.4.2.355, Culture=neutral, PublicKeyToken=5e72ecd30bc408d5">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ namespace roundhouse.tests.infrastructure.filesystem
using developwithpassion.bdd.mbunit.standard;
using developwithpassion.bdd.mbunit.standard.observations;

public class WindowsFileSystemAccessSpecs
public class DotNetFileSystemAccessSpecs
{
public abstract class concern_for_file_system : observations_for_a_sut_with_a_contract<FileSystemAccess, WindowsFileSystemAccess>
public abstract class concern_for_file_system : observations_for_a_sut_with_a_contract<FileSystemAccess, DotNetFileSystemAccess>
{
protected static object result;

context c = () => { };
}

[Concern(typeof(WindowsFileSystemAccess))]
[Concern(typeof(DotNetFileSystemAccess))]
public class when_reading_files_with_different_formats : concern_for_file_system
{
protected static string utf8_file;
Expand Down
2 changes: 1 addition & 1 deletion product/roundhouse.tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.0" targetFramework="net35" />
<package id="log4net" version="2.0.3" targetFramework="net35" />
<package id="RhinoMocks" version="3.6.1" targetFramework="net35" />
<package id="structuremap" version="2.6.3" />
</packages>
4 changes: 2 additions & 2 deletions product/roundhouse.tests/roundhouse.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<HintPath>..\..\lib\developwithpassion.bdd\developwithpassion.bdd.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\packages\log4net.2.0.0\lib\net35-full\log4net.dll</HintPath>
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="MbUnit.Framework, Version=2.4.2.355, Culture=neutral, PublicKeyToken=5e72ecd30bc408d5">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -122,7 +122,7 @@
<Compile Include="infrastructure\logging\LogSpecs.cs" />
<Compile Include="migrators\DefaultDatabaseMigratorSpecs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="infrastructure\filesystem\WindowsFileSystemAccessSpecs.cs" />
<Compile Include="infrastructure\filesystem\DotNetFileSystemAccessSpecs.cs" />
<Compile Include="resolvers\TextVersionResolverSpecs.cs" />
<Compile Include="sqlsplitters\SplitterContext.cs" />
<Compile Include="sqlsplitters\StatementSplitterSpecs.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private static InversionContainer build_items_for_container(ConfigurationPropert
ObjectFactory.Configure(cfg =>
{
cfg.For<ConfigurationPropertyHolder>().Singleton().Use(configuration_property_holder);
cfg.For<FileSystemAccess>().Singleton().Use<WindowsFileSystemAccess>();
cfg.For<FileSystemAccess>().Singleton().Use<DotNetFileSystemAccess>();
cfg.For<Database>().Singleton().Use(context => DatabaseBuilder.build(context.GetInstance<FileSystemAccess>(), configuration_property_holder));
cfg.For<KnownFolders>().Singleton().Use(context => KnownFoldersBuilder.build(context.GetInstance<FileSystemAccess>(), configuration_property_holder));
cfg.For<LogFactory>().Singleton().Use<MultipleLoggerLogFactory>();
Expand Down
10 changes: 5 additions & 5 deletions product/roundhouse/infrastructure.app/logging/log4net.config.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0"?>
<log4net>
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
<appender name="ColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
<mapping>
<level value="ERROR" />
<foreColor value="White, HighIntensity" />
<foreColor value="White" />
<backColor value="Red" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="Red" />
<backColor value="Yellow, HighIntensity" />
<backColor value="Yellow" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="Green, HighIntensity" />
<foreColor value="Green" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="Blue, HighIntensity" />
<foreColor value="Blue" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message%newline" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ namespace roundhouse.infrastructure.filesystem
/// <summary>
/// All file system access code comes through here
/// </summary>
public sealed class WindowsFileSystemAccess : FileSystemAccess
public sealed class DotNetFileSystemAccess : FileSystemAccess
{
private static readonly bool is_running_on_mono = Type.GetType("Mono.Runtime") != null;

#region File

/// <summary>
Expand Down Expand Up @@ -108,9 +110,13 @@ public void file_copy_unsafe(string source_file_name, string destination_file_na
{
Log.bound_to(this).log_a_debug_event_containing("Attempting to copy from \"{0}\" to \"{1}\".", source_file_name, destination_file_name);
//Private Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
int success = CopyFileA(source_file_name, destination_file_name, overwrite_the_existing_file ? 0 : 1);

//File.Copy(source_file_name, destination_file_name, overwrite_the_existing_file);
if (is_running_on_mono)
{
File.Copy(source_file_name, destination_file_name, overwrite_the_existing_file);
}
else {
int success = CopyFileA(source_file_name, destination_file_name, overwrite_the_existing_file ? 0 : 1);
}
}

[DllImport("kernel32")]
Expand Down Expand Up @@ -357,20 +363,20 @@ public string[] get_all_file_name_strings_in(string directory)
public string[] get_all_file_name_strings_in(string directory, string pattern)
{
string[] returnList = Directory.GetFiles(directory, pattern);
return returnList.OrderBy(get_file_name_from).ToArray();
return returnList.OrderBy(get_file_name_from).ToArray();
}

/// <summary>
/// Gets a list of all files inside of an existing directory, includes files in subdirectories also
/// </summary>
/// <param name="directory">Path to the directory</param>
/// <param name="pattern">Pattern or extension</param>
/// <returns>A list of files inside of an existing directory</returns>
public string[] get_all_file_name_strings_recurevly_in(string directory, string pattern)
{
string[] returnList = Directory.GetFiles(directory, pattern, SearchOption.AllDirectories);
return returnList.OrderBy(get_file_name_from).ToArray();
}
/// <summary>
/// Gets a list of all files inside of an existing directory, includes files in subdirectories also
/// </summary>
/// <param name="directory">Path to the directory</param>
/// <param name="pattern">Pattern or extension</param>
/// <returns>A list of files inside of an existing directory</returns>
public string[] get_all_file_name_strings_recurevly_in(string directory, string pattern)
{
string[] returnList = Directory.GetFiles(directory, pattern, SearchOption.AllDirectories);
return returnList.OrderBy(get_file_name_from).ToArray();
}

#endregion

Expand Down Expand Up @@ -399,6 +405,5 @@ public string combine_paths(params string[] paths)

return combined_path;
}

}
}
2 changes: 1 addition & 1 deletion product/roundhouse/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<packages>
<package id="FluentNHibernate" version="1.3.0.733" targetFramework="net35" />
<package id="Iesi.Collections" version="3.3.2.4000" targetFramework="net35" />
<package id="log4net" version="2.0.0" targetFramework="net35" />
<package id="log4net" version="2.0.3" targetFramework="net35" />
<package id="NHibernate" version="3.3.2.4000" targetFramework="net35" />
<package id="PublishedApplications" version="2.1.0.0" targetFramework="net35" />
<package id="structuremap" version="2.6.3" />
Expand Down
6 changes: 3 additions & 3 deletions product/roundhouse/roundhouse.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\packages\Iesi.Collections.3.3.2.4000\lib\Net35\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\log4net.2.0.0\lib\net35-full\log4net.dll</HintPath>
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Framework">
<Private>True</Private>
Expand Down Expand Up @@ -171,7 +171,7 @@
<Compile Include="infrastructure\extensions\TypeCasting.cs" />
<Compile Include="infrastructure\extensions\TypeExtensions.cs" />
<Compile Include="infrastructure\filesystem\FileSystemAccess.cs" />
<Compile Include="infrastructure\filesystem\WindowsFileSystemAccess.cs" />
<Compile Include="infrastructure\filesystem\DotNetFileSystemAccess.cs" />
<Compile Include="infrastructure.app\builders\KnownFoldersBuilder.cs" />
<Compile Include="infrastructure\loaders\DefaultAssemblyLoader.cs" />
<Compile Include="infrastructure\loaders\DefaultInstanceCreator.cs" />
Expand Down
Loading

0 comments on commit 15fef66

Please sign in to comment.