Skip to content

Commit c705c80

Browse files
author
epriestley
committed
Use PHP implementation of Cowsay for cowsay rule
Summary: Ref T7785. Convert the Cowsay Remarkup rule to use a PHP implementation so we don't have to execute an external `cowsay` binary. I removed some of the default ".cow" files that come with Cowsay because they: - include Perl code which we can not interpret; or - are primarily in-jokes or standalone visual puns or artwork rather than usable actors on the grand stage of cowsay; or - offended my delicate sensibilities. Users can add new cows to `resources/cows/custom/` if they want to make new cows available. I have included a majestic original artwork depicting the "Companion Cube" character from //Portal//. Test Plan: {F802535} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9408, T7785 Differential Revision: https://secure.phabricator.com/D14100
1 parent c02f750 commit c705c80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1107
-34
lines changed

externals/cowsay/ChangeLog

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
3.03 28 May 1999
2+
- Added cows/tux.cow, as suggested by xmanoel@i.am
3+
- Compatibility with 5.6.0, due to a change in qw().
4+
- Renamed devil.cow to daemon.cow, since I know better. :-)
5+
6+
3.02 04 November 1999
7+
- Fixed boneheaded code placement so that cowsay -l actually works.
8+
9+
3.01 01 November 1999
10+
- Fixed compatibility issues between the Text::Wrap module
11+
that changed between 5.005_02 and 5.005_03.
12+
- Fixed tab expansion issues with Text::Tabs.
13+
14+
3.0 13 April 1999, released 14 August 1999
15+
- Rewritten into Perl 5 and presented to the world.
16+
17+
-- Not present in CVS from here on down --
18+
19+
2.x Date?
20+
- Arbitrary messages.
21+
- Figlet support (-n).
22+
- Line wrap length (-w).
23+
- Multiple pre-set expressions.
24+
- Better arg parsing loop.
25+
- Message from stdin or command line.
26+
27+
1.0 Date?
28+
- SUBJECT is VERB OBJECT
29+
30+
$Id: ChangeLog,v 1.4 2000/05/29 17:55:24 tony Exp $
31+
This file is part of cowsay. (c) 1999-2000 Tony Monroe.

externals/cowsay/INSTALL

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
=================
2+
Installing cowsay
3+
=================
4+
5+
If you really want to get things installed a nice and pretty way,
6+
7+
sh install.sh
8+
9+
It will ask approximately one question. If you can't answer it,
10+
you need serious help.
11+
12+
If the install goes well, you can start cowing immediately! Just
13+
be sure to read the manual page first...
14+
15+
$Id: INSTALL,v 1.1 1999/08/14 08:03:17 tony Exp $

externals/cowsay/LICENSE

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
==============
2+
cowsay License
3+
==============
4+
5+
cowsay is distributed under the same licensing terms as Perl: the
6+
Artistic License or the GNU General Public License. If you don't
7+
want to track down these licenses and read them for yourself, use
8+
the parts that I'd prefer:
9+
10+
(0) I wrote it and you didn't.
11+
12+
(1) Give credit where credit is due if you borrow the code for some
13+
other purpose.
14+
15+
(2) If you have any bugfixes or suggestions, please notify me so
16+
that I may incorporate them.
17+
18+
(3) If you try to make money off of cowsay, you suck.
19+
20+
===============
21+
cowsay Legalese
22+
===============
23+
24+
(0) Copyright (c) 1999 Tony Monroe. All rights reserved. All
25+
lefts may or may not be reversed at my discretion.
26+
27+
(1) This software package can be freely redistributed or modified
28+
under the terms described above in the "cowsay License" section
29+
of this file.
30+
31+
(2) cowsay is provided "as is," with no warranties whatsoever,
32+
expressed or implied. If you want some implied warranty about
33+
merchantability and/or fitness for a particular purpose, you will
34+
not find it here, because there is no such thing here.
35+
36+
(3) I hate legalese.

externals/cowsay/MANIFEST

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ChangeLog Changes to recent versions.
2+
INSTALL Instructions for installing cowsay.
3+
LICENSE The license for use and redistribution of cowsay.
4+
MANIFEST This file.
5+
README Read this first. Really.
6+
Wrap.pm.diff Diff for Text/Wrap.pm.
7+
cows/* Support files used by cowsay.
8+
cowsay Main cowsay executable.
9+
cowsay.1 Main cowsay manual page.
10+
install.sh cowsay installation script.
11+
pgp_public_key.txt Verify the signature file with this key.

externals/cowsay/README

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
===========
2+
cowsay 3.03
3+
===========
4+
5+
cowsay is a configurable talking cow, written in Perl. It operates
6+
much as the figlet program does, and it written in the same spirit
7+
of silliness.
8+
9+
cowsay is actually a pretty old program. It has not really been
10+
released before, and I am releasing it in the hope that someone
11+
other than myself will be amused by it.
12+
13+
The first major version of cowsay had one cow and one message
14+
template: $foo is $verb $bar. Not very flexible, but people managed
15+
to do pretty interesting things with it. The second major version
16+
scrapped many of the limitations of the first, by allowing arbitrary
17+
messages, multiple cowfiles, and even support for cows talking in
18+
figlet. The third version was a rewrite of the second into Perl
19+
5, whereupon the code got a lot smaller and more manageable. :-)
20+
21+
If you are using Perl 5.004, you may have problems with Text::Wrap.
22+
(Yeesh, this module changes more than it should...) I've included
23+
a diff for the Text::Wrap (version 97.011701) that is shipped with
24+
5.004_04; the concept is simple enough that even older Perls can
25+
take advantage of this silly little patch; if there is a "sub fill"
26+
in the documentation for the module, copy it to a more useful
27+
section of that file. If not, just take "sub fill" wholesale from
28+
the patch. Oh, and consider upgrading to 5.005_03 or later.
29+
Please. You'll like it, I promise.
30+
31+
To install cowsay, consult the INSTALL file in this directory.
32+
33+
For the terms and conditions of use, consult the LICENSE file in
34+
this directory.
35+
36+
-- Tony Monroe (tony@nog.net)
37+
38+
$Id: README,v 1.3 2000/05/28 06:24:46 tony Exp $

externals/cowsay/Wrap.pm.diff

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
*** Wrap.pm.in Thu May 22 00:21:42 1997
2+
--- Wrap.pm Fri Nov 12 10:00:15 1999
3+
***************
4+
*** 3,9 ****
5+
require Exporter;
6+
7+
@ISA = (Exporter);
8+
! @EXPORT = qw(wrap);
9+
@EXPORT_OK = qw($columns);
10+
11+
$VERSION = 97.011701;
12+
--- 3,9 ----
13+
require Exporter;
14+
15+
@ISA = (Exporter);
16+
! @EXPORT = qw(wrap fill);
17+
@EXPORT_OK = qw($columns);
18+
19+
$VERSION = 97.011701;
20+
***************
21+
*** 66,71 ****
22+
--- 66,90 ----
23+
24+
print "-----------$r---------\n" if $debug;;
25+
return $r;
26+
+ }
27+
+
28+
+ ## Copied up from below.
29+
+ sub fill
30+
+ {
31+
+ my ($ip, $xp, @raw) = @_;
32+
+ my @para;
33+
+ my $pp;
34+
+
35+
+ for $pp (split(/\n\s+/, join("\n",@raw))) {
36+
+ $pp =~ s/\s+/ /g;
37+
+ my $x = wrap($ip, $xp, $pp);
38+
+ push(@para, $x);
39+
+ }
40+
+
41+
+ # if paragraph_indent is the same as line_indent,
42+
+ # separate paragraphs with blank lines
43+
+
44+
+ return join ($ip eq $xp ? "\n\n" : "\n", @para);
45+
}
46+
47+
1;

externals/cowsay/cows/bunny.cow

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
##
2+
## A cute little wabbit
3+
##
4+
$the_cow = <<EOC;
5+
$thoughts
6+
$thoughts \\
7+
\\ /\\
8+
( )
9+
.( o ).
10+
EOC

externals/cowsay/cows/cower.cow

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##
2+
## A cowering cow
3+
##
4+
$the_cow = <<EOC;
5+
$thoughts
6+
$thoughts
7+
,__, | |
8+
(oo)\\| |___
9+
(__)\\| | )\\_
10+
| |_w | \\
11+
| | || *
12+
13+
Cower....
14+
EOC

externals/cowsay/cows/daemon.cow

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
##
2+
## 4.4 >> 5.4
3+
##
4+
$the_cow = <<EOC;
5+
$thoughts , ,
6+
$thoughts /( )`
7+
$thoughts \\ \\___ / |
8+
/- _ `-/ '
9+
(/\\/ \\ \\ /\\
10+
/ / | ` \\
11+
O O ) / |
12+
`-^--'`< '
13+
(_.) _ ) /
14+
`.___/` /
15+
`-----' /
16+
<----. __ / __ \\
17+
<----|====O)))==) \\) /====
18+
<----' `--' `.__,' \\
19+
| |
20+
\\ /
21+
______( (_ / \\______
22+
,' ,-----' | \\
23+
`--{__________) \\/
24+
EOC

externals/cowsay/cows/default.cow

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$the_cow = <<"EOC";
2+
$thoughts ^__^
3+
$thoughts ($eyes)\\_______
4+
(__)\\ )\\/\\
5+
$tongue ||----w |
6+
|| ||
7+
EOC

0 commit comments

Comments
 (0)