# Phusion Passenger - http://www.modrails.com/ # Copyright (c) 2010 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. desc "Run 'sloccount' to see how much code Passenger has" task :sloccount do ENV['LC_ALL'] = 'C' begin # sloccount doesn't recognize the scripts in # bin/ as Ruby, so we make symlinks with proper # extensions. tmpdir = ".sloccount" system "rm -rf #{tmpdir}" mkdir tmpdir Dir['bin/*'].each do |file| safe_ln file, "#{tmpdir}/#{File.basename(file)}.rb" end sh "sloccount", *Dir[ "#{tmpdir}/*", "lib/phusion_passenger", "ext/apache2", "ext/nginx", "ext/common", "ext/oxt", "ext/phusion_passenger/*.c", "test/**/*.{cpp,rb,h}" ] ensure system "rm -rf #{tmpdir}" end end desc "Convert the NEWS items for the latest release to HTML" task :news_as_html do # The text is in the following format: # # Release x.x.x # ------------- # # * Text. # * More text. # * A header. # With yet more text. # # Release y.y.y # ------------- # ..... require 'cgi' contents = File.read("NEWS") # We're only interested in the latest release, so extract the text for that. contents =~ /\A(Release.*?)^(Release|Older releases)/m # Now split the text into individual items. items = $1.split(/^ \*/) items.shift # Delete the 'Release x.x.x' header. puts "
#{CGI.escapeHTML(paragraph)}
"
else
puts "#{format_paragraph(paragraph)}
" end end STDOUT.write("