-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for release as a Raku Community Module
- Loading branch information
Showing
16 changed files
with
246 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Linux | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags-ignore: | ||
- '*' | ||
pull_request: | ||
|
||
jobs: | ||
raku: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
raku-version: | ||
- 'latest' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: Raku/setup-raku@v1 | ||
with: | ||
raku-version: ${{ matrix.raku-version }} | ||
- name: Run Special Tests | ||
run: raku run-tests -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: MacOS | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags-ignore: | ||
- '*' | ||
pull_request: | ||
|
||
jobs: | ||
raku: | ||
strategy: | ||
matrix: | ||
os: | ||
- macos-latest | ||
raku-version: | ||
- 'latest' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: Raku/setup-raku@v1 | ||
with: | ||
raku-version: ${{ matrix.raku-version }} | ||
- name: Run Special Tests | ||
run: raku run-tests -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Windows | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags-ignore: | ||
- '*' | ||
pull_request: | ||
|
||
jobs: | ||
raku: | ||
strategy: | ||
matrix: | ||
os: | ||
- windows-latest | ||
raku-version: | ||
- 'latest' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: Raku/setup-raku@v1 | ||
with: | ||
raku-version: ${{ matrix.raku-version }} | ||
- name: Run Special Tests | ||
run: raku run-tests -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Revision history for URL::Find | ||
|
||
{{$NEXT}} | ||
- Initial version as a Raku Community Module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
{ | ||
"auth": "github:samcv", | ||
"authors": [ | ||
"Samantha McVey" | ||
], | ||
"auth": "github:samcv", | ||
"build-depends": [ | ||
|
||
], | ||
"depends": [ | ||
|
||
], | ||
"description": "Find all the URL's in text", | ||
"description": "find all the URLs in a set of text", | ||
"license": "Artistic-2.0", | ||
"name": "URL::Find", | ||
"perl": "6", | ||
"provides": { | ||
"URL::Find": "lib/URL/Find.pm6" | ||
"URL::Find": "lib/URL/Find.rakumod" | ||
}, | ||
"license": "Artistic-2.0", | ||
"resources": [ | ||
], | ||
"source-url": "https://github.com/raku-community-modules/URL-Find.git", | ||
"support": { | ||
"license": "http://www.perlfoundation.org/artistic_license_2_0", | ||
"bugtracker": "https://github.com/samcv/URL-Find/issues" | ||
"bugtracker": "https://github.com/samcv/URL-Find/issues", | ||
"license": "http://www.perlfoundation.org/artistic_license_2_0" | ||
}, | ||
"source-url": "https://github.com/samcv/URL-Find.git", | ||
"tags": [ | ||
], | ||
"test-depends": [ | ||
|
||
], | ||
"version": "0.2.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
[](https://travis-ci.org/samcv/URL-Find) | ||
[](https://github.com/raku-community-modules/URL-Find/actions) [](https://github.com/raku-community-modules/URL-Find/actions) [](https://github.com/raku-community-modules/URL-Find/actions) | ||
|
||
TITLE | ||
===== | ||
NAME | ||
==== | ||
|
||
URL::Find | ||
|
||
SUBTITLE | ||
======== | ||
|
||
A Perl 6 module to find all the URL's in a set of text. | ||
URL::Find - find all the URLs in a set of text | ||
|
||
DESCRIPTION | ||
=========== | ||
|
||
By default it will match domain names that use unicode characters such as http://правительство.рф. To only match ASCII domains use the :ascii option. It will also find URL's that end in one of the restricted characters, so `https://www.google.com, ` will pull out `https://www.google.com`. It will find all the URL's in a text by default, or you can specify a maximum number with the :limit option. By default it will only find http, https, ftp, git and ssh schemes, but you can specify `:any<1>` to match any schemes with legal characters.. | ||
By default it will match domain names that use unicode characters such as http://правительство.рф. To only match ASCII domains use the :ascii option. It will also find URL's that end in one of the restricted characters, so `https://www.google.com, ` will pull out `https://www.google.com`. It will find all the URL's in a text by default, or you can specify a maximum number with the :limit option. By default it will only find http, https, ftp, git and ssh schemes, but you can specify `:any<1>` to match any schemes with legal characters. | ||
|
||
### sub find-urls | ||
|
||
```perl6 | ||
```raku | ||
sub find-urls( | ||
Str $string, | ||
Num :$limit is copy, | ||
:$ascii, | ||
Str $string, | ||
Num :$limit is copy, | ||
:$ascii, | ||
:$any | ||
) returns List | ||
``` | ||
|
@@ -31,9 +26,16 @@ Accepts a string and returns a list of URL's. Optionally you can specify a limit | |
AUTHOR | ||
====== | ||
|
||
Samantha McVey (samcv) [email protected] | ||
Samantha McVey | ||
|
||
Source can be located at: https://github.com/raku-community-modules/URL-Find . Comments and Pull Requests are welcome. | ||
|
||
COPYRIGHT AND LICENSE | ||
===================== | ||
|
||
Copyright 2016 - 2018 Samantha McVey | ||
|
||
Copyright 2024 The Raku Community | ||
|
||
LICENSE | ||
======= | ||
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. | ||
|
||
This is free software; you can redistribute it and/or modify it under the Artistic License 2.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name = URL::Find | ||
|
||
[ReadmeFromPod] | ||
filename = lib/URL/Find.rakumod | ||
|
||
[UploadToZef] | ||
|
||
[Badges] | ||
provider = github-actions/linux.yml | ||
provider = github-actions/macos.yml | ||
provider = github-actions/windows.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
use lib 'lib'; | ||
use URL::Find; | ||
|
||
sub MAIN ( Str $string ) { | ||
say $string; | ||
say find-urls($string); | ||
} | ||
|
||
# vim: expandtab shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
use v6; | ||
=TITLE URL::Find | ||
=SUBTITLE A Perl 6 module to find all the URL's in a set of text. | ||
=begin pod | ||
=head1 NAME | ||
URL::Find - find all the URLs in a set of text | ||
=head1 DESCRIPTION | ||
=para | ||
By default it will match domain names | ||
that use unicode characters such as http://правительство.рф. To only match ASCII domains use the | ||
:ascii option. It will also find URL's that end in one of the restricted characters, so | ||
`https://www.google.com, ` will pull out `https://www.google.com`. It will find all the URL's in a | ||
text by default, or you can specify a maximum number with the :limit option. By default it will | ||
only find http, https, ftp, git and ssh schemes, but you can specify `:any<1>` to match any schemes | ||
with legal characters.. | ||
with legal characters. | ||
=end pod | ||
|
||
my token anyprotocol { <[ a..z A..Z ]> <[ a..z A..Z 0..9 . + - ]>+ } | ||
my token protocol {:i [http|https|ftp|git|ssh] } | ||
|
@@ -32,7 +37,23 @@ sub find-urls ( Str $string, Num :$limit? is copy, :$ascii?, :$any? ) is export | |
$string.comb($url-regex, $limit).List; | ||
} | ||
|
||
=AUTHOR Samantha McVey (samcv) [email protected] | ||
=LICENSE | ||
This is free software; you can redistribute it and/or modify it under | ||
the Artistic License 2.0. | ||
=begin pod | ||
=head1 AUTHOR | ||
Samantha McVey | ||
Source can be located at: https://github.com/raku-community-modules/URL-Find . | ||
Comments and Pull Requests are welcome. | ||
=head1 COPYRIGHT AND LICENSE | ||
Copyright 2016 - 2018 Samantha McVey | ||
Copyright 2024 The Raku Community | ||
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. | ||
=end pod | ||
|
||
# vim: expandtab shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
unit sub MAIN(:a($author), :i($install)); | ||
|
||
say run(<raku --version>, :out).out.slurp.chomp; | ||
say "Running on $*DISTRO.gist().\n"; | ||
|
||
say "Testing { | ||
"dist.ini".IO.lines.head.substr(7) | ||
}{ | ||
" including author tests" if $author | ||
}"; | ||
|
||
my @failed; | ||
my $done = 0; | ||
|
||
sub process($proc, $filename) { | ||
if $proc { | ||
$proc.out.slurp; | ||
} | ||
else { | ||
@failed.push($filename); | ||
if $proc.out.slurp -> $stdout { | ||
my @lines = $stdout.lines; | ||
with @lines.first( | ||
*.starts-with(" from gen/moar/stage2"),:k) | ||
-> $index { | ||
say @lines[^$index].join("\n"); | ||
} | ||
else { | ||
say $stdout; | ||
} | ||
} | ||
else { | ||
say "No output received, exit-code $proc.exitcode() ($proc.signal()):\n$proc.os-error()"; | ||
} | ||
} | ||
} | ||
|
||
sub install() { | ||
my $zef := $*DISTRO.is-win ?? 'zef.bat' !! 'zef'; | ||
my $proc := run $zef, "install", ".", "--verbose", "--/test", :out,:err,:merge; | ||
process($proc, "*installation*"); | ||
} | ||
|
||
sub test-dir($dir) { | ||
for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort { | ||
say "=== $_"; | ||
my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge; | ||
process($proc, $_); | ||
$done++; | ||
} | ||
} | ||
|
||
test-dir("t"); | ||
test-dir($_) for dir("t", :test({ !.starts-with(".") && "t/$_".IO.d})).map(*.Str).sort; | ||
test-dir("xt") if $author && "xt".IO.e; | ||
install if $install; | ||
|
||
if @failed { | ||
say "\nFAILED: {+@failed} of $done:"; | ||
say " $_" for @failed; | ||
exit +@failed; | ||
} | ||
|
||
say "\nALL {"$done " if $done > 1}OK"; | ||
|
||
# vim: expandtab shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!perl6 | ||
use Test; | ||
|
||
plan 1; | ||
|
||
use lib 'lib'; | ||
use-ok 'URL::Find'; | ||
done-testing; | ||
|
||
# vim: expandtab shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.