Commits

Shlomi Fish committed 83ff8fc

Hopefully get rid of trailing space in the output.

Comments (0)

Files changed (4)

Perl/modules/HTML-Latemp-GenMakeHelpers/Changes

 Revision history for HTML-Latemp-GenMakeHelpers
 
+    - Get rid of trailing space in the output.
+
 0.2.0    Thu Dec 18 08:26:19 IST 2008
     - Changed the GNU make rules from "::" to ":".
     - Now filtering out the 'common' host directories from the directories

Perl/modules/HTML-Latemp-GenMakeHelpers/MANIFEST

 t/sample-data/sample-site-1/subversion/index.html.wml
 t/sample-data/sample-site-1/subversion/Subversion-Win32-Installation-Guide.txt
 t/sample-data/sample-site-1/subversion/Svn-Win32-Inst-Guide.html.wml
+META.json

Perl/modules/HTML-Latemp-GenMakeHelpers/lib/HTML/Latemp/GenMakeHelpers.pm

 
     use HTML::Latemp::GenMakeHelpers;
 
-    my $generator = 
+    my $generator =
         HTML::Latemp::GenMakeHelpers->new(
             'hosts' =>
-            [ map { 
-                +{ 'id' => $_, 'source_dir' => $_, 
-                    'dest_dir' => "\$(ALL_DEST_BASE)/$_-homepage" 
-                } 
+            [ map {
+                +{ 'id' => $_, 'source_dir' => $_,
+                    'dest_dir' => "\$(ALL_DEST_BASE)/$_-homepage"
+                }
             } (qw(common t2 vipe)) ],
         );
-        
+
     $generator->process_all();
 
 =head1 API METHODS
 
     $self->base_dir("src");
     $self->hosts(
-        [ 
-        map { 
+        [
+        map {
             HTML::Latemp::GenMakeHelpers::HostEntry->new(
                 %$_
             ),
         {
             'name' => "IMAGES",
             'filter' =>
-            sub 
-            { 
+            sub
+            {
                 my $file = shift;
-                return ($file !~ /\.(?:tt|w)ml$/) && (-f $self->_make_path($host, $file)) 
+                return ($file !~ /\.(?:tt|w)ml$/) && (-f $self->_make_path($host, $file))
             },
         },
         {
             'name' => "DIRS",
-            'filter' => 
-            sub 
+            'filter' =>
+            sub
             {
-                my $file = shift; 
-                return (-d $self->_make_path($host, $file)) 
+                my $file = shift;
+                return (-d $self->_make_path($host, $file))
             },
             filter_out_common => 1,
         },
         {
             'name' => "DOCS",
-            'filter' => 
-            sub 
-            { 
+            'filter' =>
+            sub
+            {
                 my $file = shift;
-                return $file =~ /\.x?html\.wml$/; 
+                return $file =~ /\.x?html\.wml$/;
             },
             'map' => sub { my $a = shift; $a =~ s{\.wml$}{}; return $a;},
         },
         {
             'name' => "TTMLS",
             'filter' =>
-            sub 
-            { 
+            sub
+            {
                 my $file = shift;
                 return $file =~ /\.ttml$/;
             },
 sub _process_bucket
 {
     my ($self, $bucket) = @_;
-    return 
-        { 
-            %$bucket, 
+    return
+        {
+            %$bucket,
             'results' => [],
             (
                 (!exists($bucket->{'map'})) ?
 {
     my ($self, $host) = @_;
 
-    return 
-        [ 
-            map 
-            { $self->_process_bucket($_) } 
-            @{$self->get_initial_buckets($host)} 
+    return
+        [
+            map
+            { $self->_process_bucket($_) }
+            @{$self->get_initial_buckets($host)}
         ];
 }
 
 
     @files = (grep { ! m{(^|/)\.svn(/|$)} } @files);
     @files = (grep { ! /~$/ } @files);
-    @files = 
-        (grep 
+    @files =
+        (grep
         {
-            my $b = basename($_); 
+            my $b = basename($_);
             !(($b =~ /^\./) && ($b =~ /\.swp$/))
-        } 
+        }
         @files
         );
 
                 {
                     $self->_common_buckets->{$b->{name}}->{$f} = 1;
                 }
-                
+
                 if (   ($host->{'id'} eq "common")
-                    || 
+                    ||
                     (!(
                         $b->{'filter_out_common'}
                             &&
 
 X8X_COMMON_DOCS_DEST = \$(patsubst %,\$(X8X_DEST)/%,\$(COMMON_DOCS))
 
-\$(X8X_DOCS_DEST) : $h_dest_star : \$(X8X_SRC_DIR)/%.wml \$(DOCS_COMMON_DEPS) 
+\$(X8X_DOCS_DEST) : $h_dest_star : \$(X8X_SRC_DIR)/%.wml \$(DOCS_COMMON_DEPS)
 	 $wml_path ; ( cd \$(X8X_SRC_DIR) && wml -o "\$\${WML_LATEMP_PATH}" \$(X8X_WML_FLAGS) -DLATEMP_FILENAME=\$(patsubst $h_dest_star,%,\$(patsubst %.wml,%,\$@)) \$(patsubst \$(X8X_SRC_DIR)/%,%,\$<) )
 
 \$(X8X_TTMLS_DEST) : $h_dest_star : \$(X8X_SRC_DIR)/%.ttml \$(TTMLS_COMMON_DEPS)
     my $host_uc = uc($host->id());
     foreach my $b (@$buckets)
     {
-        $file_lists_text .= $host_uc . "_" . $b->{'name'} . " = " . join(" ", @{$b->{'results'}}) . "\n";
+        $file_lists_text .= $host_uc . "_" . $b->{'name'} . " =" . join("", map { " $_" } @{$b->{'results'}}) . "\n";
     }
-    
+
     if ($host->id() ne "common")
     {
         my $rules = $self->get_rules_template($host);

Perl/modules/HTML-Latemp-GenMakeHelpers/t/01-output-basic.t

 SRC_IMAGES = images/arrow-left-disabled.png images/arrow-left.png images/arrow-right-disabled.png images/arrow-right.png images/arrow-up-disabled.png images/arrow-up.png images/berlios-logo.png images/better-scm-logo.png images/get-firefox.png images/logo-wml.png images/somerights20.png images/valid-css.png images/valid-xhtml10.png images/valid-xhtml11.png print.css style.css subversion/Subversion-Win32-Installation-Guide.txt
 SRC_DIRS = alternatives arch docs images irc site-map source subversion
 SRC_DOCS = alternatives/index.html arch/index.html docs/index.html docs/nice_trys.html docs/shlomif-evolution.html index.html irc/index.html links.html mailing-list.html site-map/index.html source/index.html subversion/Svn-Win32-Inst-Guide.html subversion/compelling_alternative.html subversion/index.html
-SRC_TTMLS = 
+SRC_TTMLS =
 EOF
 
 my $rules_expected = <<'EOFGALOG';
 
 SRC_COMMON_DOCS_DEST = $(patsubst %,$(SRC_DEST)/%,$(COMMON_DOCS))
 
-$(SRC_DOCS_DEST) : $(SRC_DEST)/% : $(SRC_SRC_DIR)/%.wml $(DOCS_COMMON_DEPS) 
+$(SRC_DOCS_DEST) : $(SRC_DEST)/% : $(SRC_SRC_DIR)/%.wml $(DOCS_COMMON_DEPS)
 	 WML_LATEMP_PATH="$$(perl -MFile::Spec -e 'print File::Spec->rel2abs(shift)' '$@')" ; ( cd $(SRC_SRC_DIR) && wml -o "$${WML_LATEMP_PATH}" $(SRC_WML_FLAGS) -DLATEMP_FILENAME=$(patsubst $(SRC_DEST)/%,%,$(patsubst %.wml,%,$@)) $(patsubst $(SRC_SRC_DIR)/%,%,$<) )
 
 $(SRC_TTMLS_DEST) : $(SRC_DEST)/% : $(SRC_SRC_DIR)/%.ttml $(TTMLS_COMMON_DEPS)
 is ($host_outputs->{'file_lists'}, $file_lists_expected, "File Lists");
 
 # TEST
-is_deeply ([split(/\n/, $host_outputs->{'rules'}, -1)], 
+is_deeply ([split(/\n/, $host_outputs->{'rules'}, -1)],
     [split(/\n/, $rules_expected, -1)], "Rules");