Skip to content

Commit 18f32af

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 737c4a0 + 2e8bfea commit 18f32af

File tree

197 files changed

+12347
-3965
lines changed

Some content is hidden

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

197 files changed

+12347
-3965
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ xt/aspell.pws
2424
highlights/node_modules
2525
**/npm-debug.log
2626
highlights/atom-language-perl6/
27-
examples/

.travis.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
os:
22
- linux
3-
- osx
3+
# - osx
4+
cache:
5+
directories:
6+
- precompiled
7+
- html
8+
- highlights/node_modules
9+
- $HOME/.rakudobrew
410
addons:
511
apt:
612
sources:
@@ -10,6 +16,8 @@ addons:
1016
- g++-4.8
1117
- ruby-sass
1218

19+
fast_finish: true
20+
1321
branches:
1422
except:
1523
- gh-pages
@@ -35,13 +43,13 @@ install:
3543
- export PATH="$PATH:/$HOME/.rakudobrew/moar-nom/install/share/perl6/site/bin"
3644
- travis_retry zef --/tap-harness --force --/test install LWP::Simple
3745
- travis_retry zef --/tap-harness --depsonly install .
38-
- travis_retry zef --/tap-harness install Pod::To::HTML
3946

4047
script:
4148
- make test
4249
- export CXX=$(command -v g++-4.8 >/dev/null 2>&1; if [ $? -eq 1 ]; then printf "g++"; else printf "g++-4.8"; fi)
4350
- $CXX --version
44-
- make html
51+
- make html-nohighlight
52+
# - make html
4553
matrix:
4654
allow_failures:
4755
- os: osx

Build.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use File::Find;
77
class Build {
88
method build($workdir) {
99
my $doc-dir = $workdir.IO.child('doc');
10-
my $dest-pref = $*REPO.repo-chain.first(*.?can-install).prefix.child("doc");
10+
my $dest-pref = $*REPO.repo-chain.grep(/site/).first.prefix.child("doc");
1111
mkdir($dest-pref) unless $dest-pref.d;
1212

1313
my @files = find(dir => "$workdir/doc", type => 'file').list;

CONTRIBUTING.md

Lines changed: 13 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,20 @@ in the [#perl6 IRC channel](https://perl6.org/community/irc).
1515
# TABLE OF CONTENTS
1616
- [General principles](#general-principles)
1717
- [Documenting types](#documenting-types)
18-
- [Testing examples](#testing-examples)
19-
- [Skipping tests](#skipping-tests)
18+
- [Writing and Testing Examples](#writing-and-testing-examples)
2019
- [Debug mode](#debug-mode)
2120
- [Invisible index anchors](#invisible-index-anchors)
2221
- [Viewport size](#viewport-size)
2322
- [Broken links](#broken-links)
2423
- [Heading numbering](#heading-numbering)
2524
- [Reporting bugs](#reporting-bugs)
26-
- [Website Styles](#website-styles)
2725
- [Building the documentation](#building-the-documentation)
2826
- [Dependency installation](#dependency-installation)
2927
- [Rakudo](#rakudo)
3028
- [Zef](#zef)
3129
- [Pod::To::HTML](#podtohtml)
3230
- [Mojolicious / Web Server](#mojolicious--web-server)
3331
- [SASS compiler](#sass-compiler)
34-
- [pygmentize](#pygmentize)
35-
- [Inline::Python](#inlinepython)
3632
- [Build and view the documentation](#build-and-view-the-documentation)
3733

3834
## General principles
@@ -60,10 +56,10 @@ you want to improve, commit your changes, and create a pull request. Should
6056
questions come up in the process feel free to ask in
6157
[#perl6 IRC channel](https://perl6.org/community/irc).
6258

63-
If the documentation for a type does not exist create the skeleton of the doc
59+
If the documentation for a type does not exist, create the skeleton of the doc
6460
with the helper tool `util/new-type.p6`. Say you want to create `MyFunnyRole`:
6561

66-
$ perl6 util/new-type.p6 MyFunnyRole
62+
$ perl6 util/new-type.p6 --kind=role MyFunnyRole
6763

6864
Fill the documentation file `doc/Type/MyFunnyRole.pod6` like this:
6965

@@ -109,37 +105,16 @@ When providing a code example result or output, use this style:
109105

110106
Any contributions should pass the `make test` target. This insures basic
111107
integrity of the documentation, and is run automatically by a corresponding
112-
travis build. Even edits made via the github editor should pass this test.
108+
travis build. Even edits made via the GitHub editor should pass this test.
113109

114110
The repo should also pass `make xtest` most of the time - this includes
115111
tests about whitespace and spelling that might be difficult to get right
116112
on an initial commit, and shouldn't be considered to break the build. If
117113
you're contributing a patch or pull request, please make sure this passes.
118114

119-
## Testing examples
115+
## Writing and Testing Examples
120116

121-
To export examples from all .pod6-files use `make extract-examples`. To run
122-
individual tests pick the right .p6-file from `examples/` as a parameter to
123-
`perl6`.
124-
125-
### Skipping tests
126-
127-
Some examples fail with compile time exceptions and would interrupt the test
128-
for a file. Use the pod-config option `skip-test` to skip them.
129-
130-
=begin code :skip-test
131-
your-example-here();
132-
=end code
133-
134-
### Catching expected exception
135-
136-
Some tests will throw exceptions that would stop the execution of the extracted
137-
test file. Use the pod-option `catch-all` to have a default handler installed
138-
for a single example.
139-
140-
=begin code :catch-all
141-
exception-generator-here();
142-
=end code
117+
See [Writing and Testing Examples](EXAMPLES.md)
143118

144119
## Testing method completeness
145120

@@ -184,6 +159,8 @@ following labels when tagging tickets:
184159

185160
* site - presentation issue with the website (e.g. invalid HTML)
186161
* docs - missing or incorrect documentation (use 'NOTSPECCED' instead, if this is for a feature present in a compiler, but not in the Perl 6 test suite)
162+
* new - this is a new doc item that requires fresh text
163+
* update - this is an existing doc item that requires some analysis or editing
187164
* build - scripts or libraries that generate the site
188165
* search - the search component, either for items that are on the site but not searchable, or for search functionality)
189166

@@ -195,16 +172,6 @@ Contributors may also specify one of the following tags.
195172
If you would like to contribute documentation or other bug fixes, please use
196173
github's Pull request feature.
197174

198-
## Website Styles
199-
200-
The `html/css/style.css` file is built from `assets/sass/style.sass`. Please
201-
don't edit `html/css/style.css` directly, as your changes will be lost
202-
the next time the SASS file is processed.
203-
204-
[SASS](http://sass-lang.com/) is a superset of CSS, so if you don't know SASS,
205-
just write in regular CSS. Run `app.pl` to automatically process SASS and copy
206-
the result over to `html/css/style.css`
207-
208175
## Building the documentation
209176

210177
Assuming that you have already forked and cloned the
@@ -221,7 +188,11 @@ computer. To do this you will need:
221188
app locally to display the docs)
222189
- [SASS](http://sass-lang.com/) Compiler
223190
- [highlights](https://github.com/perl6/atom-language-perl6) (optional; requires
224-
only `nodejs` and at least GCC-4.8 on Linux to be installed. Running `make` will set everything up for you.)
191+
`nodejs`, `npm`, and at least GCC-4.8 on Linux to be installed. Running `make` will set everything up for you.)
192+
- Debian instructions:
193+
- Get more modern nodejs than in package manager: `curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -`
194+
- Run `make init-highlights` to initialize highlights
195+
- If that still isn't working try running `npm install node-gyp -g` and try running make command again
225196

226197
### Dependency installation
227198

@@ -275,55 +246,6 @@ or the [CSS::Sass Perl 5 module](https://modules.perl6.org/repo/CSS::Sass)
275246
The SASS files are compiled when you run `make html`, or `make sass`, or
276247
start the development webserver (`./app-start`).
277248

278-
#### pygmentize
279-
280-
This program adds syntax highlighting to the code examples. Highlighting of
281-
Perl 6 code was added in version 2.0, so you need at least this version if
282-
you wish to produced syntax highlighted documentation on your local
283-
computer.
284-
285-
If you use Debian/Jessie, you can install `pygmentize` via the
286-
`python-pygments` package:
287-
288-
$ aptitude install python-pygments
289-
290-
On Ubuntu install the package `python-pygments`:
291-
292-
$ sudo apt-get install python-pygments
293-
294-
On Fedora the package is also named `python-pygments`:
295-
296-
$ sudo yum install python-pygments
297-
298-
Otherwise, you probably need to use [`pip`](https://pip.pypa.io/en/latest/)
299-
(the Python package installer):
300-
301-
$ pip install pygmentize
302-
303-
#### Inline::Python
304-
305-
`Inline::Python` is optional, however will speed up documentation builds
306-
using syntax highlighting.
307-
308-
First, you'll need the Python Devel header files and libraries if they have not
309-
already been installed:
310-
311-
On Debian, install the `python-dev` package:
312-
313-
aptitude install python-dev
314-
315-
On Ubuntu, the package is also named `python-dev`:
316-
317-
sudo apt-get install python-dev
318-
319-
On Fedora, install the `python-devel` package:
320-
321-
sudo yum install python-devel
322-
323-
Use `zef` to install the `Inline::Python` module:
324-
325-
$ zef install Inline::Python
326-
327249
### Build and view the documentation
328250

329251
To actually build the documentation all you now need to do is run

CREDITS

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ E: justin@devuyst.com
149149
N: Kamil Kułaga
150150
E: teodozjan@gmail.com
151151

152+
N: Karl Yerkes
153+
E: karl.yerkes@gmail.com
154+
152155
N: Klaus Brüssel
153156
E: trixium@web.de
154157

@@ -301,8 +304,8 @@ E: email@froggs.de
301304
N: Tokuhiro Matsuno
302305
E: tokuhirom@gmail.com
303306

304-
N: u0097636@kuleuven.be
305-
E: claudio.ramirez@kuleuven.be
307+
N: Claudio Ramirez
308+
E: pub.claudio@gmail.com
306309

307310
N: ugexe
308311
E: nlogan@gmail.com

EXAMPLES.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## Writing Examples
2+
3+
Please use code blocks to highlight example code; any indented blocks
4+
are considered to be code, but you can use the `=for code` directive, or a
5+
combination of `=begin code` and `=end code` to better control which
6+
blocks are considered.
7+
8+
## Testing Examples
9+
10+
The file `xt/examples-compilation.t` will test the code from all the
11+
examples. This file is run as part of `make xtest`.
12+
13+
Note that method signatures are also compiled. They have an implied block
14+
added to insure valid compilation.
15+
16+
Care is taken to wrap the sample code in enough boilerplate so that no
17+
runtime code is executed, and that a class is available if needed.
18+
19+
## Skipping or finessing tests
20+
21+
While our goal is to test every example of Perl 6 in the repository, some
22+
blocks are not easy to test. Here are some ways you can skip the test or
23+
finesse it.
24+
25+
### Other languages
26+
27+
We're just testing Perl 6 here: to skip another language, use `:lang`
28+
29+
=begin code :lang<tcl>
30+
puts "this is not Perl"
31+
=end code
32+
33+
### Allow .WHAT
34+
35+
One of the checks is to dissuade using `.WHAT` in tests; However, in rare
36+
cases that is the explicit point of the test, so you can explicitly allow it:
37+
38+
=begin code :ok-test<WHAT>
39+
say 42.WHAT;
40+
=end
41+
42+
### Methods
43+
44+
If a code snippet looks like a method declaration, it's automatically
45+
wrapped in additional code so you don't have to specify a body in the docs.
46+
Multi-line method signatures are much harder to detect, so if you have a
47+
method body that spans likes, use the `:method` tag:
48+
49+
=begin code :method
50+
method arg (
51+
Bool $one,
52+
Bool $two
53+
)
54+
=end code
55+
56+
This helps keep the method detection logic in the test code simple.
57+
58+
Conversely, sometimes the method detection is overeager; you can disable it
59+
entirely with `:method<False>`
60+
61+
### Preambles
62+
63+
When writing examples, it's often helpful to refer to things that aren't
64+
defined in that snippet; you don't want to have to have a full working
65+
example in the code.
66+
67+
=begin code :preamble<no strict;>
68+
$x = pi;
69+
=end code
70+
71+
=begin code :preamble<my $x; sub frob {...};>
72+
$x = frob();
73+
=end code
74+
75+
### Failures
76+
77+
Some examples fail with compile time exceptions and would interrupt the test
78+
for a file. Use the pod-config option `skip-test` to skip them. When possible,
79+
specify a reason why you have to use this; it should be considered a last
80+
resort, and many examples might be amenable to using one of the previous annotations.
81+
82+
=begin code :skip-test<compile time error>
83+
if 1 "missing a block";
84+
=end code

META.info

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)