Created
October 5, 2012 16:53
Revisions
-
raygunsix created this gist
Oct 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ --- ../raygun-forked-ckbks/partnerpedia-nginx-160001d/templates/default/plugins/nginx.rb.erb 2012-09-28 13:21:00.000000000 -0400 +++ cookbooks/partnerpedia-nginx-160001d/templates/default/plugins/nginx.rb.erb 2012-10-05 00:03:50.000000000 -0400 @@ -46,12 +46,19 @@ status, stdout, stderr = run_command(:no_status_check => true, :command => "<%= @nginx_bin %> -V") +newcommon = "^nginx: " +oldconfigargsig = "^configure arguments:(.+)" +oldversionsig = "^nginx version: nginx\/(.+)" + +newconfigargsig = newcommon + oldconfigargsig[1..-1] +newversionsig = newcommon + oldversionsig[1..-1] + if status == 0 stderr.split("\n").each do |line| case line - when /^configure arguments:(.+)/ - # This could be better: I'm splitting on configure arguments which removes them and also - # adds a blank string at index 0 of the array. This is why we drop index 0 and map to + when /#{oldconfigargsig}/, /#{newconfigargsig}/ + # This could be better: I'm splitting on configure arguments which removes them and also + # adds a blank string at index 0 of the array. This is why we drop index 0 and map to # add the '--' prefix back to the configure argument. nginx[:configure_arguments] = $1.split(/\s--/).drop(1).map { |ca| "--#{ca}" } @@ -59,7 +66,7 @@ nginx[:prefix] = prefix nginx[:conf_path] = conf_path - when /^nginx version: nginx\/(.+)/ + when /#{oldversionsig}/, /#{newversionsig}/ nginx[:version] = $1 end end