Skip to content

Conversation

gibbsoft
Copy link

Add dos2unix and unix2dos functions to stdlib so that when using File resources with cross platform templates, the correct line endings can be enforced.

To show usage, here's an extract from README.md:

dos2unix

Returns the Unix version of the given string. Very useful when using a File resource with a cross-platform template.

file{$config_file:
  ensure  => file,
  content => dos2unix(template('my_module/settings.conf.erb')),
}

unix2dos

Returns the DOS version of the given string. Very useful when using a File resource with a cross-platform template.

file{$config_file:
  ensure  => file,
  content => unix2dos(template('my_module/settings.conf.erb')),
}

@gibbsoft gibbsoft force-pushed the dos2unix branch 2 times, most recently from fa28e34 to e2556b9 Compare August 14, 2015 10:06
@DavidS
Copy link
Contributor

DavidS commented Aug 14, 2015

There are two .rej files wanting to be deleted ;-) Looks very good now, otherwise!

@gibbsoft
Copy link
Author

Oops, sorry. Didn't notice them, I guess they were created by the diff. :-o

DavidS added a commit that referenced this pull request Aug 14, 2015
(MODULES-2410) Add new functions dos2unix and unix2dos
@DavidS DavidS merged commit 1d89df9 into puppetlabs:master Aug 14, 2015
@DavidS
Copy link
Contributor

DavidS commented Aug 14, 2015

Thank you for your contribution! Excellent work.

@gibbsoft
Copy link
Author

You're welcome, thanks for your help. Could you tag the version please David, 4.8.1 ?

@gibbsoft gibbsoft deleted the dos2unix branch August 17, 2015 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants