Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor roles #564

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.mkdn
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ language](https://metacpan.org/pod/Mojo::Template#SYNTAX).
- SEO-friendly features such as [sitemaps (sitemap.xml)](http://www.sitemaps.org).
- [Automatic checking for broken links](https://metacpan.org/pod/Statocles::Plugin::LinkCheck).
- [Syntax highlighting](https://metacpan.org/pod/Statocles::Plugin::Highlight) for code and configuration blocks.
- Hooks to add [your own plugins](https://metacpan.org/pod/Statocles::Plugin) and [your own custom
applications](https://metacpan.org/pod/Statocles::App).
- Hooks to add [your own plugins](https://metacpan.org/pod/Statocles::Role::Plugin) and [your own custom
applications](https://metacpan.org/pod/Statocles::Role::App).

# ATTRIBUTES

Expand Down
4 changes: 2 additions & 2 deletions lib/Statocles.pm
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ L<Syntax highlighting|Statocles::Plugin::Highlight> for code and configuration b

=item *

Hooks to add L<your own plugins|Statocles::Plugin> and L<your own custom
applications|Statocles::App>.
Hooks to add L<your own plugins|Statocles::Role::Plugin> and L<your own custom
applications|Statocles::Role::App>.

=back

Expand Down
2 changes: 1 addition & 1 deletion lib/Statocles/App/Basic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ our $VERSION = '0.094';
use Statocles::Base 'Class';
use Statocles::Document;
use Statocles::Util qw( run_editor read_stdin );
with 'Statocles::App::Role::Store';
with 'Statocles::Role::App::Store';

=attr store

Expand Down
10 changes: 5 additions & 5 deletions lib/Statocles/App/Blog.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use Statocles::Page::Document;
use Statocles::Page::List;
use Statocles::Util qw( run_editor read_stdin );

with 'Statocles::App::Role::Store';
with 'Statocles::Role::App::Store';

=attr store

Expand Down Expand Up @@ -377,7 +377,7 @@ sub index {

my @pages = $app->tag_pages( \%tag_pages );

Get L<pages|Statocles::Page> for the tags in the given blog post documents
Get L<pages|Statocles::Role::Page> for the tags in the given blog post documents
(build from L<the post_pages method|/post_pages>, including relevant feed
pages.

Expand Down Expand Up @@ -448,7 +448,7 @@ sub tag_pages {

my @pages = $app->pages( %options );

Get all the L<pages|Statocles::Page> for this application. Available options
Get all the L<pages|Statocles::Role::Page> for this application. Available options
are:

=over 4
Expand Down Expand Up @@ -606,7 +606,7 @@ sub recent_posts {

my $url = $app->page_url( $page )

Return the absolute URL to this L<page object|Statocles::Page>, removing the
Return the absolute URL to this L<page object|Statocles::Role::Page>, removing the
"/index.html" if necessary.

=cut
Expand Down Expand Up @@ -760,7 +760,7 @@ The post author

=over 4

=item L<Statocles::App>
=item L<Statocles::Role::App>

=back

4 changes: 2 additions & 2 deletions lib/Statocles/App/Perldoc.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Statocles::Page::Plain;
use Scalar::Util qw( blessed );
use Pod::Simple::Search;
use Pod::Simple::XHTML;
with 'Statocles::App';
with 'Statocles::Role::App';

=attr inc

Expand Down Expand Up @@ -92,7 +92,7 @@ has '+template_dir' => (

my @pages = $app->pages;

Render the requested modules as HTML. Returns an array of L<Statocles::Page> objects.
Render the requested modules as HTML. Returns an array of L<Statocles::Role::Page> objects.

=cut

Expand Down
6 changes: 3 additions & 3 deletions lib/Statocles/App/Static.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ our $VERSION = '0.094';
use Statocles::Base 'Class';
use Statocles::Page::File;
use Statocles::Util qw( derp );
with 'Statocles::App';
with 'Statocles::Role::App';

=attr store

Expand All @@ -24,7 +24,7 @@ has store => (

my @pages = $app->pages;

Get the L<page objects|Statocles::Page> for this app.
Get the L<page objects|Statocles::Role::Page> for this app.

=cut

Expand Down Expand Up @@ -54,5 +54,5 @@ B<NOTE:> This application's functionality has been added to
L<Statocles::App::Basic>. You can use the Basic app to replace this app. This
class will be removed with v2.0. See L<Statocles::Help::Upgrading>.

This L<Statocles::App|Statocles::App> manages static content with no processing,
This L<Statocles::Role::App|Statocles::Role::App> manages static content with no processing,
perfect for images, stylesheets, scripts, or already-built HTML.
6 changes: 3 additions & 3 deletions lib/Statocles/Deploy/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ our $VERSION = '0.094';
# ABSTRACT: Deploy a site to a folder on the filesystem

use Statocles::Base 'Class';
with 'Statocles::Deploy';
with 'Statocles::Role::Deploy';
use Statocles::Util qw( dircopy );

=attr path
Expand Down Expand Up @@ -60,13 +60,13 @@ __END__

This class allows a site to be deployed to a folder on the filesystem.

This class consumes L<Statocles::Deploy|Statocles::Deploy>.
This class consumes L<Statocles::Role::Deploy|Statocles::Role::Deploy>.

=head1 SEE ALSO

=over 4

=item L<Statocles::Deploy>
=item L<Statocles::Role::Deploy>

=back

4 changes: 2 additions & 2 deletions lib/Statocles/Deploy/Git.pm
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ __END__

This class allows a site to be deployed to a Git repository.

This class consumes L<Statocles::Deploy|Statocles::Deploy>.
This class consumes L<Statocles::Role::Deploy|Statocles::Role::Deploy>.

=head1 SEE ALSO

=over 4

=item L<Statocles::Deploy>
=item L<Statocles::Role::Deploy>

=back

6 changes: 3 additions & 3 deletions lib/Statocles/Document.pm
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ This disables processing the content as a template. This can speed up processing
when the content is not using template directives.

This can be also set in the application
(L<Statocles::App/disable_content_template>), or for the entire site
(L<Statocles::Role::App/disable_content_template>), or for the entire site
(L<Statocles::Site/disable_content_template>).

=cut
Expand Down Expand Up @@ -461,8 +461,8 @@ __END__
=head1 DESCRIPTION

A Statocles::Document is the base unit of content in Statocles.
L<Applications|Statocles::App> take documents to build
L<pages|Statocles::Page>.
L<Applications|Statocles::Role::App> take documents to build
L<pages|Statocles::Role::Page>.

Documents are usually written as files, with the L<content|/content> in Markdown,
and the other attributes as frontmatter, a block of YAML at the top of the file.
Expand Down
4 changes: 2 additions & 2 deletions lib/Statocles/Event.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ extends 'Beam::Event';

=attr pages

An array of L<Statocles::Page> objects
An array of L<Statocles::Role::Page> objects

=cut

has pages => (
is => 'ro',
isa => ArrayRef[ConsumerOf['Statocles::Page']],
isa => ArrayRef[ConsumerOf['Statocles::Role::Page']],
required => 1,
);

Expand Down
8 changes: 4 additions & 4 deletions lib/Statocles/Help.pod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ L<Statocles>

=item *

L<Statocles::App> - Base app role
L<Statocles::Role::App> - Base app role

=over 4

Expand Down Expand Up @@ -76,7 +76,7 @@ L<Statocles::Command> - Command module

=item *

L<Statocles::Deploy> - Base deploy role
L<Statocles::Role::Deploy> - Base deploy role

=over 4

Expand Down Expand Up @@ -144,7 +144,7 @@ L<Statocles::Link> - A link to another place

=item *

L<Statocles::Page> - Base page role
L<Statocles::Role::Page> - Base page role

=over 4

Expand Down Expand Up @@ -172,7 +172,7 @@ L<Statocles::Page::Plain> - Page with pre-generated HTML

=item *

L<Statocles::Plugin> - Base class for Statocles plugins
L<Statocles::Role::Plugin> - Base role for Statocles plugins

=over 4

Expand Down
8 changes: 4 additions & 4 deletions lib/Statocles/Help/Config.pod
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ More on that later.

=head2 An App

A L<Statocles app|Statocles::App> is the driver that turns documents into
L<pages|Statocles::Page>. To build pages, we need a store full of documents. We
A L<Statocles app|Statocles::Role::App> is the driver that turns documents into
L<pages|Statocles::Role::Page>. To build pages, we need a store full of documents. We
define our store with the string C<blog>, which will get magically coerced into
a L<store object|Statocles::Store>.

Expand All @@ -61,7 +61,7 @@ C</>, later).
=head2 A Deploy

To deploy our site to Github, we need to build a L<deploy
object|Statocles::Deploy> for Git repositories using
object|Statocles::Role::Deploy> for Git repositories using
L<Statocles::Deploy::Git|Statocles::Deploy::Git>. Our deploy object will copy
our built pages into the Git repository and commit them. Our deploy will happen
in the root directory of our site on the C<gh-pages> branch.
Expand Down Expand Up @@ -405,7 +405,7 @@ Each plugin has a name (C<highlight>), and requires a C<$class> (the
class name of the plugin) and optional C<$args> (the plugin's
attributes).

See L<the list of bundled plugins|Statocles::Plugin/BUNDLED PLUGINS>.
See L<the list of bundled plugins|Statocles::Role::Plugin/BUNDLED PLUGINS>.

=head2 Custom Markdown

Expand Down
4 changes: 2 additions & 2 deletions lib/Statocles/Help/Content.pod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ file|Statocles::Help::Config>. We can use that name to access the app's
command-line commands.

Not all applications have or need commands. See L<the application
documentation|Statocles::App/"SEE ALSO"> for more information.
documentation|Statocles::Role::App/"SEE ALSO"> for more information.

=head3 Create a Blog Post

Expand Down Expand Up @@ -211,7 +211,7 @@ When the content is being generated, you have access to the following variables:

=item C<$site> - The current L<site object|Statocles::Site>

=item C<$app> - The current L<app object|Statocles::App>
=item C<$app> - The current L<app object|Statocles::Role::App>

=back

Expand Down
2 changes: 1 addition & 1 deletion lib/Statocles/Help/Deploy.pod
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ placed.
=head1 Custom Deploy Module

If none of these work for you, you can build your own deploy module. See
L<Statocles::Deploy> for details.
L<Statocles::Role::Deploy> for details.

12 changes: 6 additions & 6 deletions lib/Statocles/Help/Develop.pod
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ L<Stores|Statocles::Store> read and write documents.

=item *

L<Applications|Statocles::App> use Stores to read documents and create
L<Pages|Statocles::Page>.
L<Applications|Statocles::Role::App> use Stores to read documents and create
L<Pages|Statocles::Role::Page>.

=item *

Expand All @@ -36,7 +36,7 @@ L<Templates|Statocles::Template> that are given to Pages.

=item *

Finally, the Site writes the Page to a L<Deploy|Statocles::Deploy>.
Finally, the Site writes the Page to a L<Deploy|Statocles::Role::Deploy>.

=back

Expand Down Expand Up @@ -100,7 +100,7 @@ with no processing whatsoever.

=head1 PAGES

A L<Statocles::Page> is collected information ready to be rendered into HTML
A L<Statocles::Role::Page> is collected information ready to be rendered into HTML
(or whatever). Statocles Applications generate pages from the documents that
the user provides. One document may generate multiple pages, and pages may have
multiple formats like HTML or RSS.
Expand Down Expand Up @@ -171,7 +171,7 @@ L<Statocles::Plugin::LinkCheck> plugin can search all the pages for
broken links. For another example, the L<Statocles::Plugin::Highlight>
plugin adds the C<highlight> function to all the templates in the site.

Plugins consume the L<Statocles::Plugin role|Statocles::Plugin> and must
Plugins consume the L<Statocles::Plugin role|Statocles::Role::Plugin> and must
implement the C<register> method to add themselves where they need to be
added.

Expand All @@ -198,7 +198,7 @@ Plugins are added to the Site object's C<plugins> attribute:

=head2 Event Handlers

Instead of making an entire Statocles::Plugin, we can respond only to
Instead of making an entire Statocles::Role::Plugin, we can respond only to
certain events using Beam::Wire's event handling API.

In this example, we're going to enable the same LinkCheck plugin as
Expand Down
6 changes: 3 additions & 3 deletions lib/Statocles/Help/Theme.pod
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ allow you to evaluate Perl code, which is why the templates are also called

=head2 Template Variables

When an application assembles a L<page object|Statocles::Page>, it sets values
When an application assembles a L<page object|Statocles::Role::Page>, it sets values
inside. The page then gives those values to the template. The common values in
every template are:

=over 4

=item C<$self> - The current L<Statocles::Page|Statocles::Page> object
=item C<$self> - The current L<Statocles::Role::Page|Statocles::Role::Page> object

=item C<$site> - The current L<Statocles::Site|Statocles::Site> object

=item C<$app> - The current L<Statocles::App|Statocles::App> object
=item C<$app> - The current L<Statocles::Role::App|Statocles::Role::App> object

=back

Expand Down
8 changes: 4 additions & 4 deletions lib/Statocles/Page/Document.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ our $VERSION = '0.094';
# ABSTRACT: Render document objects into HTML

use Statocles::Base 'Class';
with 'Statocles::Page';
with 'Statocles::Role::Page';
use Statocles::Template;
use Statocles::Store;

Expand Down Expand Up @@ -108,7 +108,7 @@ If true, disables the processing of the content as a template. This will
improve performance if you're not using any template directives in your content.

This can be set in the document (L<Statocles::Document/disable_content_template>),
the application (L<Statocles::App/disable_content_template>), or the site
the application (L<Statocles::Role::App/disable_content_template>), or the site
(L<Statocles::Site/disable_content_template>).

=cut
Expand Down Expand Up @@ -240,7 +240,7 @@ sub tags {
my $tmpl = $page->template;

The L<template object|Statocles::Template> for this page. If the document has a template,
it will be used. Otherwise, the L<template attribute|Statocles::Page/template> will
it will be used. Otherwise, the L<template attribute|Statocles::Role::Page/template> will
be used.

=cut
Expand All @@ -258,7 +258,7 @@ around template => sub {
my $tmpl = $page->layout;

The L<layout template object|Statocles::Template> for this page. If the document has a layout,
it will be used. Otherwise, the L<layout attribute|Statocles::Page/layout> will
it will be used. Otherwise, the L<layout attribute|Statocles::Role::Page/layout> will
be used.

=cut
Expand Down
Loading