Permalink
Browse files

Checking in changes prior to tagging of version 0.01.

Changelog diff is:

diff --git a/Changes b/Changes
new file mode 100644
index 0000000..e7ad385
--- /dev/null
+++ b/Changes
@@ -0,0 +1,4 @@
+Revision history for Perl extension Project::Libs.
+
+0.01  Wed Nov 24 2010
+      - initial release
  • Loading branch information...
1 parent 5dd6a7b commit 2ff143d32cb4ceb5d6648f9cb443209e03913d88 @kentaro committed Nov 24, 2010
Showing with 354 additions and 76 deletions.
  1. +6 −0 .gitignore
  2. +3 −0 .shipit
  3. +4 −0 Changes
  4. +27 −0 MANIFEST
  5. +24 −0 MANIFEST.SKIP
  6. +18 −0 Makefile.PL
  7. +93 −0 README.mkdn
  8. +0 −71 lib/Module/Libs.pm
  9. +174 −0 lib/Project/Libs.pm
  10. +1 −1 t/basic.t
  11. +1 −1 t/compile.t
  12. +3 −3 t/find_inc.t
View
@@ -0,0 +1,6 @@
+META.yml
+Makefile
+blib/
+inc/
+pm_to_blib
+covered
View
@@ -0,0 +1,3 @@
+steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, MakeDist, UploadCPAN
+git.tagpattern = v%v
+CheckChangeLog.files = Changes
View
@@ -0,0 +1,4 @@
+Revision history for Perl extension Project::Libs.
+
+0.01 Wed Nov 24 2010
+ - initial release
View
@@ -0,0 +1,27 @@
+Changes
+inc/Module/Install.pm
+inc/Module/Install/AuthorTests.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/ReadmeMarkdownFromPod.pm
+inc/Module/Install/Repository.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+inc/Pod/Markdown.pm
+inc/Test/Builder/Module.pm
+inc/Test/More.pm
+lib/Project/Libs.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README.mkdn
+t/.gitmodules
+t/basic.t
+t/compile.t
+t/extlib/.gitkeeep
+t/find_inc.t
+t/lib/.gitkeeep
View
@@ -0,0 +1,24 @@
+\bRCS\b
+\bCVS\b
+\.svn/
+\.git/
+^tags$
+^TAGS$
+^MANIFEST\.
+^Makefile$
+~$
+^#
+\.old$
+^blib/
+^pm_to_blib
+^MakeMaker-\d
+\.gz$
+\.cvsignore
+\.gitignore
+^t/9\d_.*\.t
+^t/perlcritic
+^tools/
+^[^/]+\.yaml$
+^[^/]+\.pl$
+^\.shipit$
+^\.PerlySenseProject/
View
@@ -0,0 +1,18 @@
+use inc::Module::Install;
+
+name 'Project-Libs';
+author 'Kentaro Kuribayashi, <kentarok@cpan.org>';
+license 'MIT';
+all_from 'lib/Project/Libs.pm';
+
+requires 'FindBin::libs';
+test_requires 'Test::More' => 0.96;
+
+tests 't/*.t';
+author_tests 'xt';
+
+readme_markdown_from_pod;
+auto_set_repository;
+auto_include_deps;
+
+WriteAll;
View
@@ -0,0 +1,93 @@
+# NAME
+
+Project::Libs - Add module directories of a project into @INC
+automatically
+
+# SYNOPSIS
+
+ # the simplest way
+ use Project::Libs;
+
+ # add more other dirs into @INC
+ use Project::Libs lib_dirs => [qw(extlib vendor)];
+
+ # add more other marks locate on a project root
+ use Project::Libs project_root_files => [qw(README Changes)];
+
+# DESCRIPTION
+
+Project::Libs automatically adds directories that may contain modules
+which a project depends on.
+
+Imagin there's such a project as below: CPAN-standard file arrangement
+and using git as a SCM (`modules' directory contains git submodules
+and that's written in `.gitmodules').
+
+ |_ PROJECT_ROOT
+ |_ .git
+ |_ .gitmodules
+ |_ Makefile.PL
+ |_ lib/
+ |_ t/
+ |_ lib/
+ |_ compile.t
+ |_ basic.t
+ |_ script/
+ |_ server.pl
+ |_ create.pl
+ |_ extlib/
+ |_ modules/
+ |_ Foo
+ |_ lib/
+ |_ Bar
+ |_ lib/
+ |_ ...
+
+You may bother writing such code as below in all the script located in
+t/*, script/*, or other to add module path into @INC.
+
+ use FindBin;
+ use lib "$FindBin::Bin/../lib";
+ use lib glob "$FindBin::Bin/../modules/*/lib";
+
+To `use Project::Libs' helps you doing that.
+
+In this case, after loading this module, the directories below are
+added into @INC:
+
+- * lib
+
+- * extlib
+
+- * t/lib
+
+- * modules/Foo/lib
+
+- * modules/Bar/lib
+
+# AUTHOR
+
+Kentaro Kuribayashi <kentaro@cpan.org>
+
+# COPYRIGHT AND LICENSE (The MIT License)
+
+Copyright (c) Kentaro Kuribayashi <kentaro@cpan.org>
+
+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.
View
@@ -1,71 +0,0 @@
-package Module::Libs;
-use strict;
-use warnings;
-use Cwd;
-use FindBin;
-use FindBin::libs;
-use UNIVERSAL::require;
-
-our $VERSION = '0.01';
-
-my @PROJECT_ROOT_FILES = qw(
- .git
- .gitmodules
- Makefile.PL
-);
-
-sub import {
- my ($class, %args) = @_;
- my $current_dir = getcwd;
-
- my $lib_dirs = delete $args{lib_dirs} || [];
- my $project_root_files = delete $args{project_root_files} || [];
-
- push @PROJECT_ROOT_FILES, @$project_root_files;
- my @inc = find_inc($FindBin::Bin, $lib_dirs, ());
-
- if (scalar @inc) {
- my $inc = join ' ', @inc;
- eval "use lib qw($inc)";
- }
-
- chdir $current_dir;
-}
-
-sub find_inc {
- my ($current_dir, $lib_dirs, @inc) = @_;
- return @inc if $current_dir eq '/';
- chdir $current_dir;
-
- my @found = grep { -e File::Spec->catfile($current_dir, $_)} @$lib_dirs;
- push @inc, map { File::Spec->catfile($current_dir, $_)} @found;
-
- my @root_files = grep { -e $_ } @PROJECT_ROOT_FILES;
- if (!@root_files) {
- chdir '..';
- $current_dir = getcwd;
- return find_inc($current_dir, $lib_dirs, @inc);
- }
-
- for my $file (@root_files) {
- if ($file eq '.gitmodules') {
- push @inc, find_git_submodules(
- $current_dir,
- File::Spec->catfile($current_dir, '.gitmodules'),
- )
- }
- }
-
- @inc;
-}
-
-sub find_git_submodules {
- my ($current_dir, $gitsubmodule) = @_;
- open my $fh, "< $gitsubmodule" or die $!;
- my $content = do { local $/ = undef; <$fh> };
- close $fh;
- my @submodules = ($content =~ /\[submodule "([^"]+)"\]/g);
- map { File::Spec->catfile($current_dir, "$_/lib") } @submodules;
-}
-
-!!1;
Oops, something went wrong.

0 comments on commit 2ff143d

Please sign in to comment.