From: Norbert Buchmuller Date: Wed, 4 Nov 2009 19:50:27 +0000 (+0000) Subject: Converted to Module::Install. X-Git-Tag: v0.07~7^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-RequireSSL.git;a=commitdiff_plain;h=6406f7c23fc5aa8ed1c111491bcc10d8dc756c82 Converted to Module::Install. --- diff --git a/Build.PL b/Build.PL deleted file mode 100644 index 58148c9..0000000 --- a/Build.PL +++ /dev/null @@ -1,14 +0,0 @@ -use strict; -use Module::Build; - -my $build = Module::Build->new( - create_makefile_pl => 'passthrough', - license => 'perl', - module_name => 'Catalyst::Plugin::RequireSSL', - requires => { 'Catalyst' => '5.23' }, - create_makefile_pl => 'passthrough', - test_files => [ - glob('t/*.t') - ] -); -$build->create_build_script; diff --git a/Changes b/Changes index 69d2187..eb2bdf6 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for Perl extension Catalyst::Plugin::RequireSSL 0.07 + - Converted to use Module::Install instead of Module::Build. - Removed unused 'default' method from the app (triggered a deprecation warning). - Fix Perl Critic test for hard tabs (t0m) - Fix POD coverage (t0m) diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index f485352..0000000 --- a/MANIFEST +++ /dev/null @@ -1,17 +0,0 @@ -Build.PL -Changes -lib/Catalyst/Plugin/RequireSSL.pm -Makefile.PL -MANIFEST This list of files -META.yml -README -t/01use.t -t/02pod.t -t/03podcoverage.t -t/04ssl.t -t/05ssl_host.t -t/06remain_in_ssl.t -t/07no_cache.t -t/08detach_on_redirect.t -t/lib/TestApp.pm -t/lib/TestApp/Controller/SSL.pm diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 2ffcc10..ce56670 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -3,6 +3,7 @@ \bCVS\b ,v$ \B\.svn\b +\B\.git\b # Avoid Makemaker generated and utility files. \bMakefile$ @@ -23,3 +24,19 @@ \.bak$ \#$ \b\.# +\.DS_Store$ + +# Avoid Apache::Test files +t/conf/apache_test_config.pm +t/conf/extra.conf$ +t/conf/httpd.conf +t/conf/mime.types +t/htdocs +t/logs +t/var + +# No tarballs! +\.gz$ + +# Skip the roadmap +lib/Catalyst/ROADMAP.pod diff --git a/META.yml b/META.yml deleted file mode 100644 index ba394ab..0000000 --- a/META.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Catalyst-Plugin-RequireSSL -version: 0.06 -author: - - 'Andy Grundman, ' -abstract: Force SSL mode on select pages -license: perl -resources: - license: http://dev.perl.org/licenses/ -requires: - Catalyst: 5.23 -provides: - Catalyst::Plugin::RequireSSL: - file: lib/Catalyst/Plugin/RequireSSL.pm - version: 0.06 -generated_by: Module::Build version 0.2806 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.2.html - version: 1.2 diff --git a/Makefile.PL b/Makefile.PL index 192903a..36e888f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,31 +1,38 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.03 - - unless (eval "use Module::Build::Compat 0.02; 1" ) { - print "This module requires Module::Build to install itself.\n"; - - require ExtUtils::MakeMaker; - my $yn = ExtUtils::MakeMaker::prompt - (' Install Module::Build now from CPAN?', 'y'); - - unless ($yn =~ /^y/i) { - die " *** Cannot install without Module::Build. Exiting ...\n"; - } - - require Cwd; - require File::Spec; - require CPAN; - - # Save this 'cause CPAN will chdir all over the place. - my $cwd = Cwd::cwd(); - - CPAN::Shell->install('Module::Build::Compat'); - CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate - or die "Couldn't install Module::Build, giving up.\n"; - - chdir $cwd or die "Cannot chdir() back to $cwd: $!"; - } - eval "use Module::Build::Compat 0.02; 1" or die $@; - - Module::Build::Compat->run_build_pl(args => \@ARGV); - require Module::Build; - Module::Build::Compat->write_makefile(build_class => 'Module::Build'); +#!/usr/bin/env perl + +use strict; +use warnings; + +use inc::Module::Install 0.91; + +use Module::Install::ReadmeFromPod 0.06; +use Module::Install::AuthorRequires 0.02; +use Module::Install::Repository 0.06; +use Module::Install::ExtraTests 0.006; + +name 'Catalyst-Plugin-RequireSSL'; +all_from 'lib/Catalyst/Plugin/RequireSSL.pm'; +readme_from 'lib/Catalyst/Plugin/RequireSSL.pm'; +auto_set_repository; + +requires 'Catalyst' => '5.23'; +requires 'NEXT'; +requires 'base'; + +test_requires 'Test::More'; +test_requires 'lib'; +test_requires 'Data::Dumper'; +test_requires 'FindBin'; +test_requires 'File::Spec'; +test_requires 'Catalyst::Test'; +test_requires 'HTTP::Request::Common'; + +author_requires 'Test::Pod' => '1.14'; +author_requires 'Test::Pod::Coverage' => '1.04'; +author_requires 'Test::Perl::Critic' => '1.01'; + +extra_tests; + +auto_install; + +WriteAll; diff --git a/README b/README index 72e8620..400bcf4 100644 --- a/README +++ b/README @@ -10,6 +10,8 @@ SYNOPSIS https => 'secure.mydomain.com', http => 'www.mydomain.com', remain_in_ssl => 0, + no_cache => 0, + detach_on_redirect => 1, }; # in any controller methods that should be secured @@ -37,22 +39,35 @@ CONFIGURATION values: https => $ssl_host - + If your SSL domain name is different from your non-SSL domain, set this value. http => $non_ssl_host - + If you have set the https value above, you must also set the hostname of your non-SSL server. remain_in_ssl - + If you'd like your users to remain in SSL mode after visiting an SSL-required page, you can set this option to 1. By default, this option is disabled and users will be redirected back to non-SSL mode as soon as possible. + no_cache + + If you have a wildcard certificate you will need to set this option if + you are using multiple domains on one instance of Catalyst. + + detach_on_redirect + + By default "$c->require_ssl" only calls "$c->response->redirect" but + does not stop request processing (so it returns and subsequent + statements are run). This is probably not what you want. If you set this + option to a true value "$c->require_ssl" will call "$c->detach" when it + redirects. + METHODS require_ssl Call require_ssl in any controller method you wish to be secured. @@ -62,6 +77,22 @@ METHODS The browser will be redirected to the same path on your SSL server. POST requests are never redirected. + allow_ssl + Call allow_ssl in any controller method you wish to access both in SSL + and non-SSL mode. + + $c->allow_ssl; + + The browser will not be redirected, independently of whether the request + was made to the SSL or non-SSL server. + + setup + Disables this plugin if running under an engine which does not support + SSL. + + finalize + Performs the redirect to SSL url if required. + KNOWN ISSUES When viewing an SSL-required page that uses static files served from the Static plugin, the static files are redirected to the non-SSL path. @@ -76,6 +107,9 @@ SEE ALSO AUTHOR Andy Grundman, +CONTRIBUTORS + Simon Elliott (support for wildcards) + COPYRIGHT This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/t/02pod.t b/t/02pod.t deleted file mode 100644 index 1647794..0000000 --- a/t/02pod.t +++ /dev/null @@ -1,7 +0,0 @@ -use Test::More; - -eval "use Test::Pod 1.14"; -plan skip_all => 'Test::Pod 1.14 required' if $@; -plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; - -all_pod_files_ok(); diff --git a/t/03podcoverage.t b/t/03podcoverage.t deleted file mode 100644 index d91be5e..0000000 --- a/t/03podcoverage.t +++ /dev/null @@ -1,7 +0,0 @@ -use Test::More; - -eval "use Test::Pod::Coverage 1.04"; -plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@; -plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; - -all_pod_coverage_ok(); diff --git a/t/04critic.t b/t/04critic.t deleted file mode 100644 index d94c165..0000000 --- a/t/04critic.t +++ /dev/null @@ -1,22 +0,0 @@ -use strict; -use warnings; - -use File::Spec; -use FindBin (); -use Test::More; - -if ( !-e "$FindBin::Bin/../MANIFEST.SKIP" ) { - plan skip_all => 'Critic test only for developers.'; -} -else { - eval { require Test::Perl::Critic }; - if ( $@ ) { - plan tests => 1; - fail( 'You must install Test::Perl::Critic to run 04critic.t' ); - exit; - } -} - -my $rcfile = File::Spec->catfile( 't', '04critic.rc' ); -Test::Perl::Critic->import( -profile => $rcfile ); -all_critic_ok(); \ No newline at end of file diff --git a/xt/author/02pod.t b/xt/author/02pod.t new file mode 100644 index 0000000..7846aad --- /dev/null +++ b/xt/author/02pod.t @@ -0,0 +1,11 @@ +use strict; +use warnings; + +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); diff --git a/xt/author/03podcoverage.t b/xt/author/03podcoverage.t new file mode 100644 index 0000000..2559baf --- /dev/null +++ b/xt/author/03podcoverage.t @@ -0,0 +1,19 @@ +use strict; +use warnings; + +use Test::More; + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" + if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.18; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" + if $@; + +all_pod_coverage_ok(); diff --git a/t/04critic.rc b/xt/author/04critic.rc similarity index 100% rename from t/04critic.rc rename to xt/author/04critic.rc diff --git a/xt/author/04critic.t b/xt/author/04critic.t new file mode 100644 index 0000000..a19b4d6 --- /dev/null +++ b/xt/author/04critic.t @@ -0,0 +1,17 @@ +use strict; +use warnings; + +use File::Spec; +use FindBin (); +use Test::More; + +eval { require Test::Perl::Critic }; +if ( $@ ) { + plan tests => 1; + fail( 'You must install Test::Perl::Critic to run 04critic.t' ); + exit; +} + +my $rcfile = File::Spec->catfile( $FindBin::Bin, '04critic.rc' ); +Test::Perl::Critic->import( -profile => $rcfile ); +all_critic_ok();