When reading the Version file the content is not trimmed. #240

Closed
drusellers opened this Issue Dec 14, 2015 · 8 comments

Projects

None yet

3 participants

@drusellers
Member

We are writing our version.txt file and it was written with a trailing new line. When RH reads it it takes everything and makes for odd input data.

Please trim the content.

Either here: https://github.com/chucknorris/roundhouse/blob/master/product/roundhouse/resolvers/TextVersionResolver.cs#L34 (My vote if for here)

or here

https://github.com/chucknorris/roundhouse/blob/master/product/roundhouse/infrastructure/filesystem/WindowsFileSystemAccess.cs#L57

@ferventcoder
Member

Definitely the first location. It should be very specific to version

@drusellers
Member

My thoughts as well. :)

@macfarmw
Contributor
macfarmw commented May 19, 2016 edited

I've added the trim to fix up version when it's read from the file. No problem there. I am stuck on the test. Can anyone can offer a clue on what I have done wrong? I am not very familiar with the bdd framework or Rhino so I may need to do more homework before trying this.

I've setup the mock FileSystemAccess and I'm attempting to supply the FileSystemAccess and version file path here:
TextVersionResolverSpecs.cs

When resolve_version is invoked these mock values are blank.

@ferventcoder
Member

@macfarmw mock means it doesn't actually access a real file - you must supply what the return would have been.

@ferventcoder
Member

I looked at the spec and it looks okay. Are you able to run with debugging?

@macfarmw
Contributor
macfarmw commented May 19, 2016 edited

No. I just installed TestDriven.Net but can't step through code yet. Thanks for checking. I'll fiddle with this a little longer till I find the mistake.
Which debugger works best for the mbunit framework. I don't have any experience with this one.

@ferventcoder
Member

TD.net works well - or at least it used to.

@macfarmw
Contributor
macfarmw commented May 21, 2016 edited

OK. Got it now. I just forgot to supply a return value for the call to get_full_path in the constructor.

the_filesystem.Stub(x => x.get_full_path(the_versionfile)).Return(the_versionfile);

It's working fine now. I'll get this tidied up and ready to pull tomorrow.

BTW: I got nowhere with TD.net but fortunately I still remember how to use Console.WriteLine ha!

@macfarmw macfarmw added a commit to macfarmw/roundhouse that referenced this issue May 24, 2016
@macfarmw Matthew MacFarland + macfarmw # This is a combination of 4 commits.
# The first commit's message is:
(GH-240) Fix for bug: When reading the Version file the content is not trimmed.

Added trim to the TextVersionResolver class where it reads the version
from a text file. Created supporting unit test.

# This is the 2nd commit message:

Added Trim to TextVersionResolver and a supporting test.

# This is the 3rd commit message:

Added a .DotSettings file with options to match current code base style. Started with Chocolatey file as based and tweaked it from there to match the RoundhousE code.

# This is the 4th commit message:

Changed edits from tab to spaces indentation to match prevailing code style.
c16c0f9
@macfarmw macfarmw added a commit to macfarmw/roundhouse that referenced this issue May 24, 2016
@macfarmw macfarmw (GH-240) Fix for bug: When reading the Version file the content is no…
…t trimmed.

Added trim to the TextVersionResolver class where it reads the version
from a text file. Created supporting unit test.
15fef66
@macfarmw macfarmw added a commit to macfarmw/roundhouse that referenced this issue May 25, 2016
@macfarmw macfarmw (GH-240) Trim version file contents
Added Trim to TextVerisonResolver class where it reads the version to remove any leading or trailing whitespace that may been added to the file.
c5ad14a
@ferventcoder ferventcoder added 3 - Done and removed 0 - Backlog labels May 25, 2016
@ferventcoder ferventcoder added this to the 0.8.8 milestone May 25, 2016
@macfarmw macfarmw added a commit to macfarmw/roundhouse that referenced this issue Jul 13, 2016
@macfarmw macfarmw (GH-240) Trim version file contents
Added Trim to TextVerisonResolver class where it reads the version to remove any leading or trailing whitespace that may been added to the file.
f37b2ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment