Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixing issue 40: customizations fail when the folder path has build i…
…n it more than once
  • Loading branch information
ferventcoder committed Aug 18, 2011
1 parent ed6740b commit b6fef83
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.markdown
Expand Up @@ -59,6 +59,7 @@ It helps keep to the product updated, pays for site hosting, etc. https://www.pa
* Adding in support for StorEvil.

==1.4.1.0==
* FIX: Issue 40 - customizations fail when the folder path has build in it more than once - see http://code.google.com/p/uppercut/issues/detail?id=40 for details. (418)
* FIX: Issue 39 - The detailed build.log is not being written to sometimes - see http://code.google.com/p/uppercut/issues/detail?id=39 for details. (415)

==1.4.0.0==
Expand Down
Binary file modified assemblies/build/uc.exe
Binary file not shown.
Binary file modified assemblies/build/uppercut.dll
Binary file not shown.
Binary file modified assemblies/build/uppercut.tasks.dll
Binary file not shown.
Binary file modified build/uc.exe
Binary file not shown.
Binary file modified build/uppercut.dll
Binary file not shown.
Binary file modified build/uppercut.tasks.dll
Binary file not shown.
25 changes: 13 additions & 12 deletions docs/legal/CREDITS
@@ -1,13 +1,14 @@
UppercuT has been the thoughts and work of the following people:

Committers
----------
Rob Reynolds, Committer - lead developer and manager of the framework
Dru Sellers, Committer - thought leader on direction

Other Credits
-------------
Dru Sellers - coined the name for the framework
Gary King and Matt Mergen - original ideas and code behind what has ultimately become template builder.
NAnt - what a great product! Since UppercuT is based wholly on NAnt, it just makes sense that it deserves quite a bit of credit. Now release NAnt already!!
UppercuT has been the thoughts and work of the following people:

Committers
----------
Rob Reynolds, Committer - lead developer and manager of the framework
Dru Sellers, Committer - thought leader on direction
David Keaveny, Committer

Other Credits
-------------
Dru Sellers - coined the name for the framework
Gary King and Matt Mergen - original ideas and code behind what has ultimately become template builder.
NAnt - what a great product! Since UppercuT is based wholly on NAnt, it just makes sense that it deserves quite a bit of credit. Now release NAnt already!!
Anyone who has used UppercuT and provided feedback to improve the product!
2 changes: 1 addition & 1 deletion product/uppercut.tasks/CustomExtensionTask.cs
Expand Up @@ -182,7 +182,7 @@ private void log_file_found(string file_name, IFileSystemAccess file_system)

private string get_file_name(string custom_extensions_folder, string build_folder, IFileSystemAccess file_system)
{
string base_path = file_system.get_full_path(file_system.get_directory_name_from(extends)).to_lower().Replace(build_folder.to_lower(), custom_extensions_folder.to_lower());
string base_path = file_system.get_full_path(file_system.get_directory_name_from(extends)).to_lower().replace_last_instance_of(build_folder.to_lower(), custom_extensions_folder.to_lower());
base_path = base_path.Substring(base_path.IndexOf(custom_extensions_folder.to_lower()));

string file_name = string.Format("{0}.{1}{2}", file_system.get_file_name_without_extension_from(extends), extension_type,file_system.get_file_extension_from(extends));
Expand Down
@@ -1,4 +1,4 @@
namespace uppercut.tests.infrastructure.extensions
namespace uppercut.tests
{
using bdddoc.core;
using developwithpassion.bdd.mbunit;
Expand Down
@@ -1,4 +1,4 @@
namespace uppercut.tests.infrastructure.extensions
namespace uppercut.tests
{
using bdddoc.core;
using developwithpassion.bdd.contexts;
Expand Down Expand Up @@ -112,5 +112,52 @@ public void should_not_error_out()
}
}

[Concern(typeof(StringExtensions))]
public class when_the_string_extensions_attempts_to_replace_last_instance_on_a_regular_string : observations_for_a_static_sut
{
static string result;

private because b = () => result = @"C:\CodeBuild\DataManager-Debug\build".replace_last_instance_of("build", "build.custom");

[Observation]
public void should_not_replace_first_instance()
{
result.should_contain(@"C:\CodeBuild\DataManager-Debug");
}

[Observation]
public void should_replace_last_instance()
{
result.should_contain(@"DataManager-Debug\build.custom");
}
}

[Concern(typeof(StringExtensions))]
public class when_the_string_extensions_attempts_to_replace_last_instance_on_a_null_string : observations_for_a_static_sut
{
static string result;
private static string test = null;

private because b = () => result = test.replace_last_instance_of("build", "build.custom");

[Observation]
public void should_not_error_out()
{
result.should_be_equal_to(null);
}
}

[Concern(typeof(StringExtensions))]
public class when_the_string_extensions_attempts_to_replace_last_instance_when_no_matches_exist : observations_for_a_static_sut
{
static string result;

private because b = () => result = @"C:\CodeBuild\DataManager-Debug\build".replace_last_instance_of("builds", "build.custom");

[Observation]
public void the_original_string_should_be_returned()
{
result.should_be_equal_to(@"C:\CodeBuild\DataManager-Debug\build");
}
}
}
@@ -1,4 +1,4 @@
namespace uppercut.tests.infrastructure.extensions
namespace uppercut.tests
{
using System.Collections.Generic;
using System.Data;
Expand Down
@@ -1,4 +1,4 @@
namespace uppercut.tests.infrastructure.extensions
namespace uppercut.tests
{
using System.Data;
using System.Linq;
Expand Down
10 changes: 5 additions & 5 deletions product/uppercut.tests/uppercut.tests.csproj
Expand Up @@ -117,10 +117,10 @@
<Compile Include="template.builder\TokenReplacerSpecs.cs" />
<Compile Include="infrastructure\containers\ContainerSpecs.cs" />
<Compile Include="infrastructure\containers\custom\WindsorContainerSpecs.cs" />
<Compile Include="infrastructure\extensions\IterationSpecs.cs" />
<Compile Include="infrastructure\extensions\StringExtensionsSpecs.cs" />
<Compile Include="infrastructure\extensions\TypeCastingSpecs.cs" />
<Compile Include="infrastructure\extensions\TypeExtensionsSpecs.cs" />
<Compile Include="IterationSpecs.cs" />
<Compile Include="StringExtensionsSpecs.cs" />
<Compile Include="TypeCastingSpecs.cs" />
<Compile Include="TypeExtensionsSpecs.cs" />
<Compile Include="infrastructure\logging\custom\Log4NetLogFactorySpecs.cs" />
<Compile Include="infrastructure\logging\custom\Log4NetLoggerSpecs.cs" />
<Compile Include="infrastructure\logging\LogSpecs.cs" />
Expand Down Expand Up @@ -163,7 +163,7 @@
<!-- 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">
<Exec Command="&quot;$(SolutionDir)lib\NuGet\NuGet.exe&quot; install &quot;$(ProjectDir)packages.config&quot; -o &quot;$(SolutionDir)packages&quot;" />
<Exec Command="&quot;$(SolutionDir)lib\NuGet\NuGet.exe&quot; install &quot;$(ProjectDir)packages.config&quot; -o &quot;$(SolutionDir)packages&quot;" />
</Target>
<!-- <Target Name="AfterBuild">
</Target>
Expand Down
17 changes: 17 additions & 0 deletions product/uppercut/StringExtensions.cs
Expand Up @@ -21,5 +21,22 @@ public static string to_upper(this string input)
return input.ToUpper();
}

public static string replace_last_instance_of(this string input, string toReplace, string replaceWith)
{
if (input == null)
{
return null;
}

int indexOf = input.LastIndexOf(toReplace);
if (indexOf == -1)
{
return input;
}

string removedString = input.Remove(indexOf, toReplace.Length);
string replacedString = removedString.Insert(indexOf, replaceWith);
return replacedString;
}
}
}

0 comments on commit b6fef83

Please sign in to comment.