source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/lib/puppet/parser/functions/shell_split.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: 592 bytes
Line 
1#
2# shell_split.rb
3#
4
5require 'shellwords'
6
7module Puppet::Parser::Functions
8 newfunction(:shell_split, :type => :rvalue, :doc => <<-EOS
9Splits a string into an array of tokens in the same way the Bourne shell does.
10
11This function behaves the same as ruby's Shellwords.shellsplit() function
12 EOS
13 ) do |arguments|
14
15 raise(Puppet::ParseError, "shell_split(): Wrong number of arguments " +
16 "given (#{arguments.size} for 1)") if arguments.size != 1
17
18 string = arguments[0].to_s
19
20 result = Shellwords.shellsplit(string)
21
22 return result
23 end
24end
25
26# vim: set ts=2 sw=2 et :
Note: See TracBrowser for help on using the repository browser.