Skip to content

Commit

Permalink
Merge pull request redhat-openstack#205 from GeoffWilliams/windows_ca…
Browse files Browse the repository at this point in the history
…se_fix

added missing line endings (-l) support for windows and solaris
  • Loading branch information
Morgan Haskel committed Sep 11, 2014
2 parents c5f2f47 + 4fa5222 commit 84551cc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions files/concatfragments.rb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
:test => false,
:force => false,
:warn => "",
:sortarg => ""
:sortarg => "",
:newline => false
}

OptionParser.new do |opts|
Expand Down Expand Up @@ -77,6 +78,10 @@
opts.on("-n", "--sort", "Sort the output numerically rather than the default alpha sort") do
settings[:sortarg] = "-n"
end

opts.on("-l", "--line", "Append a newline") do
settings[:newline] = true
end
end.parse!

# do we have -o?
Expand Down Expand Up @@ -119,8 +124,15 @@
# find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir
open('fragments.concat', 'a') do |f|
Dir.entries("fragments").sort.each{ |entry|

if File.file?(File.join("fragments", entry))
f << File.read(File.join("fragments", entry))
f << File.read(File.join("fragments", entry))

# append a newline if we were asked to (invoked with -l)
if settings[:newline]
f << "\n"
end

end
}
end
Expand Down

0 comments on commit 84551cc

Please sign in to comment.