You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/07/19 01:04:07 UTC

[1/2] git commit: Cloak POD for the CPAN dist of Clownfish.

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master e68aa863e -> fc58f3571


Cloak POD for the CPAN dist of Clownfish.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/fc58f357
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/fc58f357
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/fc58f357

Branch: refs/heads/master
Commit: fc58f35714556471476fe0c474bc5b80dda06a96
Parents: 7e96df7
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Jul 15 19:49:53 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Jul 18 16:03:17 2014 -0700

----------------------------------------------------------------------
 runtime/perl/buildlib/Clownfish/Build.pm | 52 +++++++++++++++++++++++++++
 runtime/perl/lib/Clownfish.pm            | 25 +++++++++++++
 2 files changed, 77 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/fc58f357/runtime/perl/buildlib/Clownfish/Build.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build.pm b/runtime/perl/buildlib/Clownfish/Build.pm
index 5865fd9..85de0b2 100644
--- a/runtime/perl/buildlib/Clownfish/Build.pm
+++ b/runtime/perl/buildlib/Clownfish/Build.pm
@@ -37,6 +37,7 @@ $VERSION = eval $VERSION;
 use File::Spec::Functions qw( catdir catfile updir rel2abs );
 use File::Path qw( rmtree );
 use File::Copy qw( move );
+use File::Find qw( find );
 use Config;
 use Carp;
 use Cwd qw( getcwd );
@@ -329,8 +330,10 @@ sub ACTION_dist {
         system("cp -R $from $to") and confess("cp failed");
     }
     move( "MANIFEST", "MANIFEST.bak" ) or die "move() failed: $!";
+    my $saved = _hide_pod( $self, { 'lib/Clownfish.pm' => 1 } );
     $self->depends_on("manifest");
     $self->SUPER::ACTION_dist;
+    _restore_pod( $self, $saved );
 
     # Now that the tarball is packaged up, delete the copied assets.
     rmtree($_) for values %to_copy;
@@ -339,5 +342,54 @@ sub ACTION_dist {
     move( "MANIFEST.bak", "MANIFEST" ) or die "move() failed: $!";
 }
 
+
+# Strip POD from files in the `lib` directory.  This is a temporary measure to
+# allow us to release Clownfish as a separate dist but with a cloaked API.
+sub _hide_pod {
+    my ( $self, $excluded ) = @_;
+    my %saved;
+    find(
+        {
+            no_chdir => 1,
+            wanted   => sub {
+                my $path = $File::Find::name;
+                return if $excluded->{$path};
+                return unless $path =~ /\.(pm|pod)$/;
+                open( my $fh, '<:encoding(UTF-8)', $path )
+                  or confess("Can't open '$path' for reading: $!");
+                my $content = do { local $/; <$fh> };
+                close $fh;
+                if ( $path =~ /\.pod$/ ) {
+                    $saved{$path} = $content;
+                    print "Hiding POD for $path\n";
+                    unlink($path) or confess("Can't unlink '$path': $!");
+                }
+                else {
+                    my $copy = $content;
+                    $copy =~ s/^=\w+.*?^=cut\s*$//gsm;
+                    return if $copy eq $content;
+                    print "Hiding POD for $path\n";
+                    $saved{$path} = $content;
+                    open( $fh, '>:encoding(UTF-8)', $path )
+                      or confess("Can't open '$path' for writing: $!");
+                    print $fh $copy;
+                }
+            },
+        },
+        'lib',
+    );
+    return \%saved;
+}
+
+# Undo POD hiding.
+sub _restore_pod {
+    my ( $self, $saved ) = @_;
+    while ( my ( $path, $content ) = each %$saved ) {
+        open( my $fh, '>:encoding(UTF-8)', $path )
+          or confess("Can't open '$path' for writing: $!");
+        print $fh $saved->{$path};
+    }
+}
+
 1;
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/fc58f357/runtime/perl/lib/Clownfish.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/lib/Clownfish.pm b/runtime/perl/lib/Clownfish.pm
index e0ede72..7dff615 100644
--- a/runtime/perl/lib/Clownfish.pm
+++ b/runtime/perl/lib/Clownfish.pm
@@ -230,4 +230,29 @@ sub error {$Clownfish::Err::error}
 
 __END__
 
+=head1 NAME
+
+Clownfish - Apache Clownfish symbiotic object system.
+
+=head1 VERSION
+
+0.3.0
+
+=head1 DESCRIPTION
+
+The Apache Clownfish "symbiotic" object system for C is designed to pair with
+a "host" dynamic language environment, facilitating the development of high
+performance host language extensions.  Clownfish classes are declared in
+header files with a C<.cfh> extension.  The Clownfish headers are used by the
+Clownfish compiler to generate C header files and host language bindings.
+Methods, functions and variables are defined in normal C source files.
+
+The API for this alpha release of Clownfish has been cloaked.
+
+=head1 COPYRIGHT
+
+Clownfish is distributed under the Apache License, Version 2.0, as
+described in the file C<LICENSE> included with the distribution.
+
+=cut
 


[2/2] git commit: Cloak POD for the CPAN dist of Clownfish::CFC.

Posted by ma...@apache.org.
Cloak POD for the CPAN dist of Clownfish::CFC.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/7e96df75
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/7e96df75
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/7e96df75

Branch: refs/heads/master
Commit: 7e96df7571001e4f4fbed422173a952f0bad1c3b
Parents: e68aa86
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Jul 15 19:29:28 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Jul 18 16:03:17 2014 -0700

----------------------------------------------------------------------
 compiler/perl/buildlib/Clownfish/CFC/Build.pm | 51 ++++++++++++++++++++++
 compiler/perl/lib/Clownfish/CFC.pod           | 30 +++++++++++++
 2 files changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/7e96df75/compiler/perl/buildlib/Clownfish/CFC/Build.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/buildlib/Clownfish/CFC/Build.pm b/compiler/perl/buildlib/Clownfish/CFC/Build.pm
index 0eeb1db..9f9d1f0 100644
--- a/compiler/perl/buildlib/Clownfish/CFC/Build.pm
+++ b/compiler/perl/buildlib/Clownfish/CFC/Build.pm
@@ -27,6 +27,7 @@ no lib 'lib';
 use File::Spec::Functions qw( catfile updir catdir curdir );
 use File::Copy qw( move );
 use File::Path qw( rmtree );
+use File::Find qw( find );
 use Config;
 use Cwd qw( getcwd );
 use Carp;
@@ -191,8 +192,10 @@ sub ACTION_dist {
         system("cp -R $from $to") and confess("cp failed");
     }
     move( "MANIFEST", "MANIFEST.bak" ) or die "move() failed: $!";
+    my $saved = _hide_pod( $self, { 'lib/Clownfish/CFC.pod' => 1 } );
     $self->depends_on("manifest");
     $self->SUPER::ACTION_dist;
+    _restore_pod( $self, $saved );
 
     # Now that the tarball is packaged up, delete the copied assets.
     rmtree($_) for values %to_copy;
@@ -201,5 +204,53 @@ sub ACTION_dist {
     move( "MANIFEST.bak", "MANIFEST" ) or die "move() failed: $!";
 }
 
+# Strip POD from files in the `lib` directory.  This is a temporary measure to
+# allow us to release Clownfish as a separate dist but with a cloaked API.
+sub _hide_pod {
+    my ( $self, $excluded ) = @_;
+    my %saved;
+    find(
+        {
+            no_chdir => 1,
+            wanted   => sub {
+                my $path = $File::Find::name;
+                return if $excluded->{$path};
+                return unless $path =~ /\.(pm|pod)$/;
+                open( my $fh, '<:encoding(UTF-8)', $path )
+                  or confess("Can't open '$path' for reading: $!");
+                my $content = do { local $/; <$fh> };
+                close $fh;
+                if ( $path =~ /\.pod$/ ) {
+                    $saved{$path} = $content;
+                    print "Hiding POD for $path\n";
+                    unlink($path) or confess("Can't unlink '$path': $!");
+                }
+                else {
+                    my $copy = $content;
+                    $copy =~ s/^=\w+.*?^=cut\s*$//gsm;
+                    return if $copy eq $content;
+                    print "Hiding POD for $path\n";
+                    $saved{$path} = $content;
+                    open( $fh, '>:encoding(UTF-8)', $path )
+                      or confess("Can't open '$path' for writing: $!");
+                    print $fh $copy;
+                }
+            },
+        },
+        'lib',
+    );
+    return \%saved;
+}
+
+# Undo POD hiding.
+sub _restore_pod {
+    my ( $self, $saved ) = @_;
+    while ( my ( $path, $content ) = each %$saved ) {
+        open( my $fh, '>:encoding(UTF-8)', $path )
+          or confess("Can't open '$path' for writing: $!");
+        print $fh $saved->{$path};
+    }
+}
+
 1;
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/7e96df75/compiler/perl/lib/Clownfish/CFC.pod
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.pod b/compiler/perl/lib/Clownfish/CFC.pod
new file mode 100644
index 0000000..b22c050
--- /dev/null
+++ b/compiler/perl/lib/Clownfish/CFC.pod
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+=head1 NAME
+
+Clownfish::CFC - Compiler for Apache Clownfish.
+
+=head1 DESCRIPTION
+
+The API for this alpha release of the CFC compiler has been cloaked.
+
+=head1 COPYRIGHT
+
+Clownfish is distributed under the Apache License, Version 2.0, as
+described in the file C<LICENSE> included with the distribution.
+
+=cut
+