source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/lib/puppet/parser/functions/dos2unix.rb@ 30960

Last change on this file since 30960 was 30960, checked in by davidb, 7 years ago

Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster

File size: 441 bytes
Line 
1# Custom Puppet function to convert dos to unix format
2module Puppet::Parser::Functions
3 newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-EOS
4 Returns the Unix version of the given string.
5 Takes a single string argument.
6 EOS
7 ) do |arguments|
8
9 unless arguments[0].is_a?(String)
10 raise(Puppet::ParseError, 'dos2unix(): Requires string as argument')
11 end
12
13 arguments[0].gsub(/\r\n/, "\n")
14 end
15end
Note: See TracBrowser for help on using the repository browser.