[Bps-public-commit] RT-Extension-Nginx branch, master, updated. 0.02-3-g34f0811

Ruslan Zakirov ruz at bestpractical.com
Mon Jul 2 17:09:51 EDT 2012


The branch, master has been updated
       via  34f0811a8475f3dc14356f6875f91b3da777b8ea (commit)
       via  9d91d3d205d0a246b0fe3a84b311a82e286d902c (commit)
       via  ff85cddca508f40c65797c2fa93aa23ccc9f889b (commit)
      from  9569fcd0267b3f656ace0995b0425bd8d73a241b (commit)

Summary of changes:
 .gitignore                          |    2 +-
 META.yml                            |    6 +-
 README                              |   11 +---
 inc/Module/Install.pm               |    4 +-
 inc/Module/Install/Base.pm          |    2 +-
 inc/Module/Install/Can.pm           |   85 ++++++++++++++++++++++++--
 inc/Module/Install/Fetch.pm         |    2 +-
 inc/Module/Install/Makefile.pm      |   22 ++++---
 inc/Module/Install/Metadata.pm      |    2 +-
 inc/Module/Install/ReadmeFromPod.pm |  112 +++++++++++++++++++++++++++++++----
 inc/Module/Install/Win32.pm         |    2 +-
 inc/Module/Install/WriteAll.pm      |    2 +-
 lib/RT/Extension/Nginx.pm           |    7 ++-
 sbin/rt-nginx-control               |   39 +++++++++++-
 14 files changed, 249 insertions(+), 49 deletions(-)

- Log -----------------------------------------------------------------
commit ff85cddca508f40c65797c2fa93aa23ccc9f889b
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Jul 3 00:02:27 2012 +0300

    update M::I

diff --git a/META.yml b/META.yml
index d0d379e..ec4154e 100644
--- a/META.yml
+++ b/META.yml
@@ -3,12 +3,12 @@ abstract: 'optimized request tracker within minutes'
 author:
   - 'Ruslan Zakirov <ruz at bestpractical.com>'
 build_requires:
-  ExtUtils::MakeMaker: 6.57
+  ExtUtils::MakeMaker: 6.59
 configure_requires:
-  ExtUtils::MakeMaker: 6.57
+  ExtUtils::MakeMaker: 6.59
 distribution_type: module
 dynamic_config: 1
-generated_by: 'Module::Install version 1.04'
+generated_by: 'Module::Install version 1.06'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index c685ca4..4ecf46b 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -467,4 +467,4 @@ sub _CLASS ($) {
 
 1;
 
-# Copyright 2008 - 2011 Adam Kennedy.
+# Copyright 2008 - 2012 Adam Kennedy.
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b520616..802844a 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index a162ad4..22167b8 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -3,13 +3,12 @@ package Module::Install::Can;
 
 use strict;
 use Config                ();
-use File::Spec            ();
 use ExtUtils::MakeMaker   ();
 use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -29,7 +28,7 @@ sub can_use {
 	eval { require $mod; $pkg->VERSION($ver || 0); 1 };
 }
 
-# check if we can run some command
+# Check if we can run some command
 sub can_run {
 	my ($self, $cmd) = @_;
 
@@ -38,14 +37,88 @@ sub can_run {
 
 	for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
 		next if $dir eq '';
-		my $abs = File::Spec->catfile($dir, $_[1]);
+		require File::Spec;
+		my $abs = File::Spec->catfile($dir, $cmd);
 		return $abs if (-x $abs or $abs = MM->maybe_command($abs));
 	}
 
 	return;
 }
 
-# can we locate a (the) C compiler
+# Can our C compiler environment build XS files
+sub can_xs {
+	my $self = shift;
+
+	# Ensure we have the CBuilder module
+	$self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
+
+	# Do we have the configure_requires checker?
+	local $@;
+	eval "require ExtUtils::CBuilder;";
+	if ( $@ ) {
+		# They don't obey configure_requires, so it is
+		# someone old and delicate. Try to avoid hurting
+		# them by falling back to an older simpler test.
+		return $self->can_cc();
+	}
+
+	# Do we have a working C compiler
+	my $builder = ExtUtils::CBuilder->new(
+		quiet => 1,
+	);
+	unless ( $builder->have_compiler ) {
+		# No working C compiler
+		return 0;
+	}
+
+	# Write a C file representative of what XS becomes
+	require File::Temp;
+	my ( $FH, $tmpfile ) = File::Temp::tempfile(
+		"compilexs-XXXXX",
+		SUFFIX => '.c',
+	);
+	binmode $FH;
+	print $FH <<'END_C';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int main(int argc, char **argv) {
+    return 0;
+}
+
+int boot_sanexs() {
+    return 1;
+}
+
+END_C
+	close $FH;
+
+	# Can the C compiler access the same headers XS does
+	my @libs   = ();
+	my $object = undef;
+	eval {
+		local $^W = 0;
+		$object = $builder->compile(
+			source => $tmpfile,
+		);
+		@libs = $builder->link(
+			objects     => $object,
+			module_name => 'sanexs',
+		);
+	};
+	my $result = $@ ? 0 : 1;
+
+	# Clean up all the build files
+	foreach ( $tmpfile, $object, @libs ) {
+		next unless defined $_;
+		1 while unlink;
+	}
+
+	return $result;
+}
+
+# Can we locate a (the) C compiler
 sub can_cc {
 	my $self   = shift;
 	my @chunks = split(/ /, $Config::Config{cc}) or return;
@@ -78,4 +151,4 @@ if ( $^O eq 'cygwin' ) {
 
 __END__
 
-#line 156
+#line 236
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index a412576..bee0c4f 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 035cef2..7052f36 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -215,13 +215,17 @@ sub write {
 	require ExtUtils::MakeMaker;
 
 	if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
-		# MakeMaker can complain about module versions that include
-		# an underscore, even though its own version may contain one!
-		# Hence the funny regexp to get rid of it.  See RT #35800
-		# for details.
-		my ($v) = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
-		$self->build_requires(     'ExtUtils::MakeMaker' => $v );
-		$self->configure_requires( 'ExtUtils::MakeMaker' => $v );
+		# This previous attempted to inherit the version of
+		# ExtUtils::MakeMaker in use by the module author, but this
+		# was found to be untenable as some authors build releases
+		# using future dev versions of EU:MM that nobody else has.
+		# Instead, #toolchain suggests we use 6.59 which is the most
+		# stable version on CPAN at time of writing and is, to quote
+		# ribasushi, "not terminally fucked, > and tested enough".
+		# TODO: We will now need to maintain this over time to push
+		# the version up as new versions are released.
+		$self->build_requires(     'ExtUtils::MakeMaker' => 6.59 );
+		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
 	} else {
 		# Allow legacy-compatibility with 5.005 by depending on the
 		# most recent EU:MM that supported 5.005.
@@ -411,4 +415,4 @@ sub postamble {
 
 __END__
 
-#line 540
+#line 544
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 31c953e..58430f3 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index 348531e..fb7075f 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,29 +7,119 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.12';
+$VERSION = '0.18';
 
 sub readme_from {
   my $self = shift;
   return unless $self->is_admin;
 
-  my $file = shift || $self->_all_from
+  # Input file
+  my $in_file  = shift || $self->_all_from
     or die "Can't determine file to make readme_from";
-  my $clean = shift;
 
-  print "Writing README from $file\n";
+  # Get optional arguments
+  my ($clean, $format, $out_file, $options);
+  my $args = shift;
+  if ( ref $args ) {
+    # Arguments are in a hashref
+    if ( ref($args) ne 'HASH' ) {
+      die "Expected a hashref but got a ".ref($args)."\n";
+    } else {
+      $clean    = $args->{'clean'};
+      $format   = $args->{'format'};
+      $out_file = $args->{'output_file'};
+      $options  = $args->{'options'};
+    }
+  } else {
+    # Arguments are in a list
+    $clean    = $args;
+    $format   = shift;
+    $out_file = shift;
+    $options  = \@_;
+  }
+
+  # Default values;
+  $clean  ||= 0;
+  $format ||= 'txt';
+
+  # Generate README
+  print "readme_from $in_file to $format\n";
+  if ($format =~ m/te?xt/) {
+    $out_file = $self->_readme_txt($in_file, $out_file, $options);
+  } elsif ($format =~ m/html?/) {
+    $out_file = $self->_readme_htm($in_file, $out_file, $options);
+  } elsif ($format eq 'man') {
+    $out_file = $self->_readme_man($in_file, $out_file, $options);
+  } elsif ($format eq 'pdf') {
+    $out_file = $self->_readme_pdf($in_file, $out_file, $options);
+  }
 
-  require Pod::Text;
-  my $parser = Pod::Text->new();
-  open README, '> README' or die "$!\n";
-  $parser->output_fh( *README );
-  $parser->parse_file( $file );
   if ($clean) {
-    $self->clean_files('README');
+    $self->clean_files($out_file);
   }
+
   return 1;
 }
 
+
+sub _readme_txt {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README';
+  require Pod::Text;
+  my $parser = Pod::Text->new( @$options );
+  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
+  close $out_fh;
+  return $out_file;
+}
+
+
+sub _readme_htm {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.htm';
+  require Pod::Html;
+  Pod::Html::pod2html(
+    "--infile=$in_file",
+    "--outfile=$out_file",
+    @$options,
+  );
+  # Remove temporary files if needed
+  for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
+    if (-e $file) {
+      unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
+    }
+  }
+  return $out_file;
+}
+
+
+sub _readme_man {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.1';
+  require Pod::Man;
+  my $parser = Pod::Man->new( @$options );
+  $parser->parse_from_file($in_file, $out_file);
+  return $out_file;
+}
+
+
+sub _readme_pdf {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.pdf';
+  eval { require App::pod2pdf; }
+    or die "Could not generate $out_file because pod2pdf could not be found\n";
+  my $parser = App::pod2pdf->new( @$options );
+  $parser->parse_from_file($in_file);
+  open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+  select $out_fh;
+  $parser->output;
+  select STDOUT;
+  close $out_fh;
+  return $out_file;
+}
+
+
 sub _all_from {
   my $self = shift;
   return unless $self->admin->{extensions};
@@ -44,5 +134,5 @@ sub _all_from {
 
 __END__
 
-#line 112
+#line 254
 
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index 99d9631..eeaa3fe 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 86bb25e..85d8018 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.04';
+	$VERSION = '1.06';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

commit 9d91d3d205d0a246b0fe3a84b311a82e286d902c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Jul 3 00:09:26 2012 +0300

    update .gitignore

diff --git a/.gitignore b/.gitignore
index 8df7384..f2f8440 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@ Makefile
 Makefile.bak
 Makefile.old
 Makefile.new
-MYMETA.yml
+MYMETA.*
 pm_to_blib
 blib/
 MANIFEST.bak

commit 34f0811a8475f3dc14356f6875f91b3da777b8ea
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Jul 3 00:10:45 2012 +0300

    update documentation

diff --git a/README b/README
index c507907..26ed17e 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ SYNOPSIS
         ./sbin/rt-generate-nginx-conf
         ./sbin/rt-nginx-control start
 
-DESCRIPION
+DESCRIPTION
     This is beta software. Lacks some documentation.
 
     Extension comes with two scripts:
@@ -21,7 +21,7 @@ DESCRIPION
 
     rt-nginx-control
         Simple script that can start, stop and restart nginx and fcgi
-        processes.
+        processes. Run without arguments to see help.
 
 FEATURES
   Fast web server in front
@@ -60,10 +60,3 @@ AUTHOR
 LICENSE
     Under the same terms as perl itself.
 
-POD ERRORS
-    Hey! The above document had some coding errors, which are explained
-    below:
-
-    Around line 44:
-        You forgot a '=back' before '=head1'
-
diff --git a/lib/RT/Extension/Nginx.pm b/lib/RT/Extension/Nginx.pm
index 462303b..540e548 100644
--- a/lib/RT/Extension/Nginx.pm
+++ b/lib/RT/Extension/Nginx.pm
@@ -24,7 +24,7 @@ RT::Extension::Nginx - optimized request tracker within minutes
     ./sbin/rt-generate-nginx-conf
     ./sbin/rt-nginx-control start
 
-=head1 DESCRIPION
+=head1 DESCRIPTION
 
 B<This is beta> software. Lacks some documentation.
 
@@ -39,7 +39,10 @@ required directories and files.
 
 =item rt-nginx-control
 
-Simple script that can start, stop and restart nginx and fcgi processes.
+Simple script that can start, stop and restart nginx and fcgi processes. Run
+without arguments to see help.
+
+=back
 
 =head1 FEATURES
 
diff --git a/sbin/rt-nginx-control b/sbin/rt-nginx-control
index 8f06714..879f775 100755
--- a/sbin/rt-nginx-control
+++ b/sbin/rt-nginx-control
@@ -6,6 +6,41 @@ use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
 use strict;
 use warnings;
 
+=head1 NAME
+
+rt-nginx-control - script to start, stop or restart nginx and/or fcgi running RT
+
+=head1 USAGE
+
+    rt-nginx-control start
+    rt-nginx-control stop
+    rt-nginx-control restart
+
+    rt-nginx-control start fcgi
+    rt-nginx-control stop fcgi
+    rt-nginx-control restart fcgi
+
+    rt-nginx-control start nginx
+    rt-nginx-control stop nginx
+    rt-nginx-control restart nginx
+
+=head1 DESCRIPTION
+
+This script allows you to control nginx and/or fcgi processes that run RT.
+You can control both if you run nothing but RT on the server or control
+only one part of the setup. For example if you run something else on
+nginx server then use the scrip to contol fcgi part only.
+
+The script expects that nginx and plackup commands are in your PATH.
+
+You can take a look at the source code of the script to get idea which
+commands are executed, where files are located. The script is very simple.
+
+B<NOTE>: one important thing this script does is that it runs servers under
+web user, not user you start it under (root).
+
+=cut
+
 use File::Spec;
 use autodie;
 
@@ -18,7 +53,9 @@ my %commands = map {$_ => 1} qw(start stop restart);
 my $command = pop @ARGV;
 my $target = pop @ARGV;
 if ( !$command || !$commands{ $command } || ($target && !$target) ) {
-    exit usage();
+    require Pod::Usage;
+    print Pod::Usage::pod2usage( { verbose => 2  }  );
+    exit 1;
 }
 
 my @plugins = RT->Config->Get('Plugins');

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list