view release on metacpan or search on metacpan
resources => {
repository => "https://github.com/kberov/Ado",
bugtracker => "https://github.com/kberov/Ado/issues",
},
keywords => [qw/Ado Mojolicious realtime web ERP REST CMS enterprise/],
no_index => {namespace => ['Ado::Model'],}
},
script_files => 'bin',
add_to_cleanup => [
'Ado-*', '*.bak',
'public/doc/**/*.html', 'public/articles/*.html',
'public/articles/**/*.html', 't/ado/etc/ado.sqlite'
],
);
$builder->create_build_script();
- Rearranged Plugin::MarkdounRender tests to avoid potential failures.
0.92 2015-06-01
- Ado::Control::list_for_json() accepts a new argument $meta for arbitrary
content, specific to the served resource.
- Removed a lot of debug messages.
- Added database storage for lexicons to Ado::I18n.
Now plugins can store their translated messages in i18n table.
See Ado::Plugin::Vest as example.
- Refactored and improved /articles section.
- Decided not to remove documents from public/doc. They will be used as
end-user documentation and written when time permits.
- $CODENAME changed to "иже" U+2C09 GLAGOLITIC CAPITAL LETTER IZHE (â°)
0.91 2015-05-10
- Upgraded to Mojolicious::Plugin::SemanticUI 0.17 to use only some of
Semantic UI components. This way the first rendering of the default
page is faster on the browser side.
- Implemented header_css and header_javascript helpers to add minimalistic asset
management. Used to refer specific Semantic UI components from templates
and render links to them in the <head> section of the default layout.
that will be an example of how to build applications on Ado.
- Upgraded to Mojolicious::Plugin::SemanticUI 0.05.
- Renamed method PERL_FILES to PERL_DIRS in Ado::Build.
- Importing PERL_DIRS in Ado::BuildPlugin so it can be used
for plugins like Ado::Build is used for installing Ado.
- Upgraded to Mojolicious 5.42.
- Fixed bug in Ado::Control::validate_input().
- Added dummy records in tables groups and users.
- Test::AdoPlugin is deprecated.
- In Ado::Plugin::initialise() now we also check for plugin specific
public folder and add it to Ado $app->static->paths.
- Downgraded to Module::Build 0.42.
0.63 2014-09-09
- Deleted public/vendor/Semantic-UI.
- Now example pages depend on Mojolicious::Plugin::SemanticUI,
but you can just comment 'SemanticUI' in ado.conf and it will not be loaded.
- Today in 1944 the communists took over Bulgaria.
As a consequence in 1951 my grand-daddy got bitten and killed by them.
http://en.wikipedia.org/wiki/Bulgarian_coup_d%27%C3%A9tat_of_1944
0.62 2014-09-07
- Ado::Plugin: simplified guessing of home_dir and speeded it up.
- Upgraded to Mojolicious 5.39.
- Started work on Mojolicious::Plugin::SemanticUI.
0.39 2014-04-15
- Fixed missing 'require' in Build.PL for Email::Address.
- Fixed 'require' in Build.PL for Mojolicious 4.93.
0.38 2014-04-14
- Bugfix in ado build test.
- Improved "adduser" functionality.
- Added Email::Address for validating... well, email addresses.
- Upgraded to Mojolicious 4.93.
- Upgraded to Semantic UI 0.15.5
- Drawn the public/img/Ado-Building-Blocks.svg diagram.
0.37 2014-04-05
- Added experimental Ado::Command::adduser.
- Small improvements and higher test coverage in Ado::Plugin::Auth.
- Made Ado::Command more consistent with Ado::Plugin.
0.36 2014-03-22
- Improved documentation.
- Added sha1.js from CryptoJS v3.1.2.
- Added experimental tests for Ado::Build.
- Fixed ACTION_perltidy - did not tidy Build.PL
- Dynamically generating META.json and META.yml
depending on if $ENV{TEST_AUTHOR} is set
thus requiring fewer dependencies.
- Updated Manual.pod
- Added uninstall and fakeuninstall actions to Ado::Build (Valcho).
- Fixed wrong install_path for lib directory
when "--install_base" is not passed as argument.
- Using Perl's $Config{siteprefixexp} for
other directories: qw(etc public log templates).
0.22 2013-12-29 03:30:38 CET
- Refactored creation of README.md, kept README.
- Wellcome Valcho to the core team :)!
- Removed $ADO_HOME (by popular demand)
and symplified installation process a lot.
- Improved Manual.pod/README.
0.21 2013-12-28 03:37:42 CET
- Added build action submit (draft).
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-------------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
lib/Ado/Sessions.pm
lib/Ado/Sessions/Database.pm
lib/Ado/Sessions/File.pm
LICENSE
log/development.log
log/production.log
log/README
MANIFEST This list of files
META.json
META.yml
public/articles/ala/bala.md
public/articles/hello.md
public/css/ado.css
public/css/flags/bg.png
public/css/flags/de.png
public/css/flags/en.png
public/css/flags/es.png
public/css/flags/fr.png
public/css/flags/readme.txt
public/css/flags/ru.png
public/css/ui-bg_diagonal-maze_light_10x10.png
public/doc/bg/accounting.md
public/doc/bg/admin.md
public/doc/bg/apps.md
public/doc/bg/articles.md
public/doc/bg/blog.md
public/doc/bg/cms.md
public/doc/bg/cover.md
public/doc/bg/crm.md
public/doc/bg/domains.md
public/doc/bg/groups.md
public/doc/bg/img/default_admin_screen.epz
public/doc/bg/img/default_admin_screen.png
public/doc/bg/intro.md
public/doc/bg/messages.md
public/doc/bg/no_title.md
public/doc/bg/pages.md
public/doc/bg/products.md
public/doc/bg/projects.md
public/doc/bg/purchases.md
public/doc/bg/sales.md
public/doc/bg/settings.md
public/doc/bg/shops.md
public/doc/bg/site_apps.md
public/doc/bg/store.md
public/doc/bg/toc.md
public/doc/bg/users.md
public/doc/en/cover.md
public/doc/en/intro.md
public/doc/en/no_title.md
public/doc/en/toc.md
public/favicon.png
public/fonts/FreeSerif-Glagolitic-UC.woff
public/fonts/README
public/img/5FE59-ado.jpg
public/img/Ado-Building-Blocks.png
public/img/Ado-Building-Blocks.svg
public/index.html
public/js/auth.js
public/js/help_toc.js
public/js/jquery.cookie.js
public/vendor/crypto-js/rollups/sha1.js
public/vendor/pagedown/LICENSE.txt
public/vendor/pagedown/Markdown.Converter.js
public/vendor/pagedown/Markdown.Editor.js
public/vendor/pagedown/Markdown.Sanitizer.js
public/vendor/pagedown/node-pagedown.js
public/vendor/pagedown/package.json
public/vendor/pagedown/README.txt
public/vendor/pagedown/wmd-buttons.png
README
README.md
t/.perlcriticrc
t/00-load.t
t/ado-build.t
t/ado/etc/bare.conf
t/ado/etc/empty.conf
t/ado/etc/plugins/bar.alabala.dummy
t/ado/etc/plugins/example.conf
t/ado/etc/plugins/example.development.conf
etc/ado.conf view on Meta::CPAN
#app->secrets([Mojo::Util::sha1_sum($mode . $home),]);
#Application/site specific templates
#See /perldoc/Mojolicious/Renderer#paths
#unshift @{app->renderer->paths}, $home->rel_dir('site_templates');
#Application specific static files
#See /perldoc/Mojolicious/Static
#It is better to leave static files to be served by a server like Apache
#This setting can be used during development.
#unshift @{$app->static->paths}, app->home->rel_dir('path/to/other/public/files');
#Setting the Controller class from which all controllers must inherit.
#See /perldoc/Mojolicious/#controller_class
#See /perldoc/Mojolicious/Guides/Growing#Controller_class
app->controller_class('Ado::Control');
#Namespace(s) to load controllers from
#See /perldoc/Mojolicious#routes
#app->routes->namespaces(['Ado::Control']);
etc/plugins/markdown_renderer.conf view on Meta::CPAN
#First paramether is the md_renderer instance and
#the second is the markdown text
md_method => 'markdown',
#md_method => sub {shift->markdown(shift)},
#These options will be passed to the md_renderer constructor
md_options => {use_wikilinks => 0, disable_footnotes => 0},
#Where the files reside?
md_root => app->home->rel_file('public/doc'),
md_file_sufixes => ['.md'],
#Do not convert markdown files on each request but reuse already produced html files.
md_reuse_produced_html => 1,
#Default helper name
md_helper => 'md_to_html',
#Default routes! Define additional routes in ado.conf/plugins/markdown_renderer[$i]/routes
routes => [
sub _initialise {
my ($app) = @_;
my $home = $app->home;
my $mode = $app->mode;
my $ado_home = $app->ado_home;
# add paths to bundled files if needed.
my $templates_dir = $ado_home->rel_file('templates');
my $site_templates = $home->rel_file('site_templates');
my $renderer_paths = $app->renderer->paths;
my $public_dir = $ado_home->rel_file('public');
my $static_paths = $app->static->paths;
push @$renderer_paths, $templates_dir
unless (first { $_ eq $templates_dir } @$renderer_paths);
push @$static_paths, $public_dir
unless (first { $_ eq $public_dir } @$static_paths);
$app->secrets([Mojo::Util::sha1_sum($app->moniker . $mode . $home),]);
unshift @$renderer_paths, $site_templates if -d $site_templates;
$app->controller_class("${CLASS}::Control");
$app->routes->namespaces(["${CLASS}::Control"]);
$app->plugins->namespaces(['Mojolicious::Plugin', "${CLASS}::Plugin",]);
unshift @{$app->commands->namespaces}, "${CLASS}::Command";
return $app;
}
Ado inherits all attributes from Mojolicious and implements the following new
ones.
=head2 ado_home
Returns an instance of L<Mojo::Home> pointing to the base directory where
L<Ado> is installed.
~$ ado eval 'say app->ado_home'
/home/berov/opt/public_dev/Ado
=head2 CODENAME
Returns the current C<CODENAME>.
=head2 home
#/where/is/your_app/rootdir
$app->home;
=head1 METHODS
Ado inherits all methods from Mojolicious and implements
the following new ones.
=head2 startup
Sets various default paths like C<templates>, C<site_templates>, C<public>.
Defines L<Mojolicious/secrets> as sha1_sum of C<$moniker.$mode. $home>. Sets
L<Mojolicious/controller_class> and L<Mojolicious::Routes/namespaces> to
L<${CLASS}::Control>. Sets L<Mojolicious::Plugins/namespaces> to
C<['Mojolicious::Plugin', "${CLASS}::Plugin"]>. Sets
L<Mojolicious::Commands/namespaces> to C<${CLASS}::Command>. C<$CLASS> is
usually L<Ado>. Then calls the following methods in the order they are listed.
Returns void.
You can amend this behavior in the application configuration file.
lib/Ado/Build.pm view on Meta::CPAN
use warnings FATAL => 'all';
use File::Spec::Functions qw(catdir catfile);
use File::Path qw(make_path);
use File::Copy qw(copy);
use ExtUtils::Installed;
use ExtUtils::Install;
use parent 'Module::Build';
use Exporter qw( import ); #export functionality to Ado::BuildPlugin etc..
our @EXPORT_OK = qw(
create_build_script process_etc_files do_create_readme
process_public_files process_templates_files
ACTION_perltidy ACTION_submit PERL_DIRS);
sub PERL_DIRS {
state $dirs = [map { catdir($_[0]->base_dir, $_) } qw(bin lib etc t)];
return @$dirs;
}
sub create_build_script {
my $self = shift;
#Deciding where to install
my $prefix = $self->install_base || $self->config('siteprefix');
for my $be (qw(etc public log templates)) {
#in case of installing a plugin, check if folder exists
next unless -d $be;
$self->add_build_element($be);
$self->install_path($be => catdir($prefix, $be));
}
return $self->SUPER::create_build_script();
}
sub process_public_files {
my $self = shift;
for my $asset (@{$self->rscan_dir('public')}) {
if (-d $asset) {
make_path(catdir('blib', $asset));
next;
}
copy($asset, catfile('blib', $asset));
}
return;
}
sub process_etc_files {
lib/Ado/Build.pm view on Meta::CPAN
=head1 METHODS
Ado::Build inherits all methods from L<Module::Build> and implements
the following ones.
=head2 create_build_script
This method is called in C<Build.PL>.
In this method we also call C<add_build_element> for C<etc> C<public>,
C<templates> and C<log> folders.
Finally we set all the C<install_path>s for the distro
and we call C<$self-E<gt>SUPER::create_build_script>.
=head2 process_etc_files
Moves files found in C<Ado/etc> to C<Ado/blib/etc>.
See L<Module::Build::API/METHODS>
Returns void.
=head2 process_log_files
Moves files found in C<Ado/log> to C<Ado/blib/log>.
Returns void.
=head2 process_public_files
Moves files found in C<Ado/public> to C<Ado/blib/public>.
Returns void.
=head2 process_templates_files
Moves files found in C<Ado/templates> to C<Ado/blib/templates>.
Returns void.
=head2 ACTION_build
We put here custom functionality executed around the
lib/Ado/BuildPlugin.pm view on Meta::CPAN
package Ado::BuildPlugin;
use 5.014;
use strict;
use warnings FATAL => 'all';
use parent 'Module::Build';
use Ado::Build qw(
process_etc_files process_public_files do_create_readme
process_templates_files create_build_script
ACTION_perltidy ACTION_submit PERL_DIRS);
1;
=pod
=encoding utf8
=head1 NAME
lib/Ado/BuildPlugin.pm view on Meta::CPAN
that we use beside C<lib> and C<bin>. These modules also can serve as examples
for your own builders if you have some custom things to do during
build, test, install and even if you need to add a new C<ACTION_*>
to your setup.
=head1 METHODS
Ado::BuildPlugin inherits all methods from L<Module::Build>.
It also imports C<create_build_script>, C<process_etc_files>,
C<process_public_files>, C<process_templates_files> from L<Ado::Build>.
=head1 AUTHOR
ÐÑаÑÐ¸Ð¼Ð¸Ñ ÐеÑов (Krasimir Berov)
=head1 COPYRIGHT AND LICENSE
Copyright 2013-2014 ÐÑаÑÐ¸Ð¼Ð¸Ñ ÐеÑов (Krasimir Berov).
lib/Ado/Command/generate/adoplugin.pm view on Meta::CPAN
=encoding utf8
=head1 NAME
Ado::Command::generate::adoplugin - Generates an Ado::Plugin
=head1 SYNOPSIS
On the command-line:
$ cd ~/opt/public_dev
# Ado is "globally" installed for the current perlbrew Perl
$ ado generate adoplugin --name MyBlog
$ ado generate adoplugin --name MyBlog --crud -t 'articles,news'
Programmatically:
use Ado::Command::generate::adoplugin;
my $vhost = Ado::Command::generate::adoplugin->new;
$vhost->run(-n => 'MyBlog', -c => 1, -t => 'articles,news');
lib/Ado/Manual/Contributing.pod view on Meta::CPAN
L<QUnit|http://qunitjs.com/>. Use exclusively L<Test::Mojo> for REST API tests.
Looking at your tests, one should easily conclude how your code should be used.
=head2 REST AND CORS
Ado is a system that will provide REST services out of the box.
Separation of concerns must be to its maximum. Your REST API must be
self describing. Elaborate on the recommendations in
"RESTful Service Best Practices" at L<www.RestApiTutorial.com>.
You must have a reference implementation of a browser-based user-agent(yourpluginroute.html) residing in
C<Ado/public/>. It would be best if your code is CORS-ready this
should be easy if your code depends on Ado::Plugin::CORS(TODO).
See L<Ado::Manual::RESTAPI>(TODO). Feel free to propose additional best
practices. Be ready to explain well your proposal.
=head2 TEMPLATES
We have a minimal set of templates residing in the C<templates> directory.
Separation of concerns must be to its maximum. Strive for minimal logic in
your templates if you have such.
lib/Ado/Manual/FiveMinutes.pod view on Meta::CPAN
cd ~/ado
morbo -w ./lib -w ./site_templates -w templates bin/ado
You should see:
Server available at http://127.0.0.1:3000
Open a new terminal window and create a markdown file that will contain your first
article. Or edit one of the already existing sample files there.
touch ~/ado/public/articles/my_article.md
vim ~/ado/public/articles/my_article.md
Eventually add a link to the newly created file (but with .html extension) to
the menu containing links to the articles which are "published". Copy the menu
template so it is not overwritten when you upgrade Ado.
mkdir -p ~/ado/site_templates/articles
cp ~/ado/templates/articles/menu.html.ep ~/ado/site_templates/articles/
#edit ~/ado/site_templates/articles/menu.html.ep
lib/Ado/Manual/FiveMinutes.pod view on Meta::CPAN
touch ~/ado/etc/plugins/markdown_renderer.development.conf
Add the following code to C<markdown_renderer.development.conf>:
{
#Do not convert files to HTML on every request
#but reuse already produced html files.
md_reuse_produced_html => 1,
};
Refresh L<http://127.0.0.1:3000/articles/my_article.html>. In C<~/ado/public/articles> You will find C<my_article.html>.
Congratulations! You created your first article with L<Ado> without much ado.
=head1 WHAT'S NEXT
Look at the source of L<Ado::Control::Articles> to see how it works. Go to
L<http://127.0.0.1:3000/> and play more or visit the links in the L</SEE ALSO>
section. Now you can fork the project on
L<Github|https://github.com/kberov/Ado>, improve C<menu.html.ep> to
automatically traverse the articles directory and generate the list of
articles, then make a merge request. You just contributed to the project.
lib/Ado/Manual/Intro.pod view on Meta::CPAN
â  â  âââ generate # Generators such as Ado::Command::generate::apache2vhost are here
â  âââ Control # Controller namespace where controller classes
â  â # like Ado::Control::Users reside
â  âââ I18n # Namespace for lexicon packages such as Ado::I18n::bg
â  âââ Manual # Namespace for developer manuals like this very file
â  âââ Model # Controller namespace where controller classes
â  â # like Ado::Model::Users reside
â  âââ Plugin # Ado plugins namespace, e.g. Ado::Plugin::Auth
â  âââ Sessions # Server side sessions - e.g. Ado::Sessions::Database
âââ log # Log directory
âââ public # Static file directory (served automatically)
â  â # Good for generated static pages served by e.g. Apache or Nginx
â  âââ css
â  â  âââ flags
â  âââ doc
â  â  âââ bg
â  â  â  âââ img
â  â  âââ en
â  âââ fonts
â  âââ img
â  âââ js
lib/Ado/Manual/Intro.pod view on Meta::CPAN
â # modify if you want to override some of the system templates
âââ default
âââ doc
âââ layouts
âââ partials
âââ test
And here is how Ado looks as building blocks:
=for HTML <img src="https://raw.githubusercontent.com/kberov/Ado/master/public/img/Ado-Building-Blocks.png" />
To learn more about Ado plugins, please look at L<Ado::Manual::Plugins>.
Now that you know what additional features Ado provides, you can proceed to
L<Ado::Manual::Installation>.
=head1 SEE ALSO
L<Ado::Manual>, L<Ado::Manual::Installation>, L<Ado::Manual::Plugins>, L<Mojolicious::Guides>
lib/Ado/Manual/Plugins.pod view on Meta::CPAN
=head1 DESCRIPTION
C<@Ado::ISA=qw(Mojolicious)>. It is distributed together with a few plugins to
make it usable as a basic Mojolicious application. Theoretically all of the
plugins, distributed with L<Ado> could be disabled so you can start your project
only as a bare (I<but full>) L<Mojolicious> application, if you wish. Later you
can decide to enable some of them and eventually add (your own) L<Mojolicious>
or L<Ado> plugins. Here is how it looks.
=for HTML <img src="https://raw.githubusercontent.com/kberov/Ado/master/public/img/Ado-Building-Blocks.png" />
=head1 PLUGINS
Ado comes with the following default plugins. They can be used as examples and
for inspiration.
=over
=item * L<Ado::Plugin::AdoHelpers> - Default Ado helpers
lib/Ado/Manual/Plugins.pod view on Meta::CPAN
=item * Add some dummy records.
INSERT INTO blog(title,body,user_id,group_id)
VALUES('Hey','Hello world',3,3);
INSERT INTO blog(title,body,user_id,group_id)
VALUES('Hey You','Hello Universe',3,3);
=item * Generate the files for the plugin. These are the files which you will edit :).
$ cd ~/opt/public_dev
$ ado generate adoplugin -n Blog --crud -t blog
The above command will generate the needed files for an ado plugin which can
even be uploaded to and subsequently downloaded from
L<CPAN|http://www.cpan.org/>. L<CPAN> is the best open source dependency
management system. You can also use L<Stratopan|https://stratopan.com/> if you
wish.
=back
Ado uses L<Ado::Build> and L<Ado::BuildPlugin> which extend L<Module::Build>.
They were created to add some custom actions and handle the additional
C<templates>,C<log> and C<public> directories in Ado root folder.
The file tree looks like the following:
~/opt/public_dev/Ado-Plugin-Blog$ tree
.
âââ Build.PL
âââ etc
â  âââ plugins
â  âââ blog.conf
âââ lib
â  âââ Ado
â  âââ Control
â  â  âââ Blog.pm
â  âââ Plugin
lib/Ado/Plugin.pm view on Meta::CPAN
$app->load_routes($conf->{routes}) if (@{$conf->{routes} || []});
# Add templates folder if the plugin is not in the same folder
my $templates_dir = catdir($self->home_dir, 'templates');
if ((!List::Util::first { $templates_dir eq $_ // '' } @{$app->renderer->paths})
&& -d $templates_dir)
{
push @{$app->renderer->paths}, $templates_dir;
}
# Add plugin specific public folder if differs from app public
my $public_dir = catdir($self->home_dir, 'public');
if ((!List::Util::first { $public_dir eq $_ // '' } @{$app->static->paths})
&& -d $public_dir)
{
push @{$app->static->paths}, $public_dir;
}
return ($self, $app, $conf);
}
1;
=pod
lib/Ado/Plugin.pm view on Meta::CPAN
=item * Pushes C<@{$conf-E<gt>{namespaces}}> to C<$app-E<gt>routes-E<gt>namespaces>
if additional namespaces are defined in configuration file.
=item * Loads routes if defined in configuration file.
=item * Pushes the plugin C<templates> directory to C<@{app-E<gt>renderer-E<gt>paths}>
(if it exists and is not the same as Ado's one) so the templates can be found by
L<Ado> while developing your plugin.
=item * Pushes the plugin C<public> directory to C<@{app-E<gt>static-E<gt>paths}>
(if it exists and is not the same as Ado's one) so the templates can be found by
L<Ado> while developing your plugin.
=item * Returns C<($self, $app, $config)>.
=back
Look at some of the configuration files of the plugins that come with L<Ado>.
lib/Ado/Plugin/Auth.pm view on Meta::CPAN
providers => {
google => {
key =>'123456789....apps.googleusercontent.com',
secret =>'YourSECR3T',
scope=>'profile email',
info_url => 'https://www.googleapis.com/userinfo/v2/me',
},
facebook => {
key =>'123456789',
secret =>'123456789abcdef',
scope =>'public_profile,email',
info_url => 'https://graph.facebook.com/v2.2/me',
},
}
}
=head1 DESCRIPTION
L<Ado::Plugin::Auth> is a plugin that authenticates users to an L<Ado> system.
Users can be authenticated via Google, Facebook, locally and in the future
other authentication service-providers.
lib/Ado/Plugin/I18n.pm view on Meta::CPAN
=head1 TEMPLATES
L<Ado::Plugin::I18n> contains one embedded template.
=head2 partials/language_menu.html.ep
Generates HTML for a language menu.
If you want to modify the template you can inflate all templates and do that.
A usage example can be found at L<http://localhost:3000> after starting ado.
berov@u165:~/opt/public_dev/Ado$ bin/ado inflate
...
[exist] /home/berov/opt/public_dev/Ado/templates/partials
[write] /home/berov/opt/public_dev/Ado/templates/partials/language_menu.html.ep
#then choose the preferred way to switch languages...
%= include 'partials/language_menu'; # use default language_from => 'route'
%= include 'partials/language_menu', language_from => 'route';
%= include 'partials/language_menu', language_from => 'host';
%= include 'partials/language_menu', language_from => 'param';
%= include 'partials/language_menu', language_from => 'cookie';
=head1 METHODS
lib/Ado/Plugin/MarkdownRenderer.pm view on Meta::CPAN
Mojo::ByteStream->import('b');
sub register {
my ($self, $app, $config) = shift->initialise(@_);
#Make sure we have all we need from config files.
$config->{md_renderer} ||= 'Text::MultiMarkdown';
$config->{md_method} ||= 'markdown';
$config->{md_options} ||= {use_wikilinks => 1,};
$config->{md_helper} ||= 'md_to_html';
$config->{md_root} ||= $app->home->rel_file('public/doc');
$config->{md_articles_root} ||= $app->home->rel_file('public/articles');
$config->{md_file_sufixes} ||= ['.md'];
if ($config->{md_renderer} eq 'Text::MultiMarkdown') {
require Text::MultiMarkdown;
$app->helper($config->{md_helper} => sub { md_to_html(shift, $config, @_) });
$app->helper(
markdown => sub {
my $c = shift;
return Text::MultiMarkdown::markdown(@_);
}
lib/Ado/Plugin/MarkdownRenderer.pm view on Meta::CPAN
md_helper => 'md_to_html',
Helper name. You may want to change this if you want to have
different helpers for different markup converters,
configurations, applications etc. in the same ado instance.
Default helper name is L</md_to_html>.
=head2 md_root
md_root => app->home->rel_dir('public/doc'),
Directory where the raw files reside.
=head2 md_articles_root
md_articles_root => app->home->rel_dir('public/articles'),
Directory used by L<Ado::Control::Articles> where the raw markdown files reside
and where the static HTML files are generated.
=head2 md_file_sufixes
md_file_sufixes => ['.md'],
File-suffixes supported by your renderer.
lib/Ado/Plugin/MarkdownRenderer.pm view on Meta::CPAN
#in a template
%==markdown($text)
=head2 md_to_html
Given a Markdown string returns C<E<lt>articleE<gt>$htmlE<lt>/articleE<gt>>
produced by the converter - L<Text::MultiMarkdown> by default.
You may want to use your own helper name. See L</md_helper>.
#Markdown from $MOJO_HOME/public/doc/bg/intro.md
#http://example.com/doc/bg/intro.md
my $html = $c->md_to_html();
#Markdown from arbitrary file
my $html_string = $c->md_to_html($some_filepath);
% #in a template
<%= md_to_html();%>
% #<article>$html</article>
public/css/flags/readme.txt view on Meta::CPAN
Flag icons - http://www.famfamfam.com
These icons are public domain, and as such are free for any use (attribution appreciated but not required).
Note that these flags are named using the ISO3166-1 alpha-2 country codes where appropriate. A list of codes can be found at http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
If you find these icons useful, please donate via paypal to mjames@gmail.com (or click the donate button available at http://www.famfamfam.com/lab/icons/silk)
Contact: mjames@gmail.com
public/img/Ado-Building-Blocks.svg view on Meta::CPAN
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="800"
height="600"
id="svg3774"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Ado-Building-Blocks.svg"
inkscape:export-filename="/home/berov/opt/public_dev/Ado/public/img/Ado-Building-Blocks.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs3776" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
public/index.html view on Meta::CPAN
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Ado!</title>
</head>
<body>
<h2>Welcome to <a href="/perldoc/Ado/Manual">Ado</a></h2>
<p>Welcome to <a href="/perldoc/Ado/Manual">Ado</a> - a framework
for web projects written in the <a href="http://www.perl.org">Perl programming language</a> and based on the <a href="/perldoc/Mojolicious/Guides">Mojolicious</a>
real-time web framework!</p>
<p>This is the static document "public/index.html",
<a href="/">click here</a> to get back to the start.</p>
</body>
</html>
t/00-load.t view on Meta::CPAN
my $module = $file;
$module =~ s,\.pm$,,;
$module =~ s,.*/?lib/,,;
$module =~ s,/,::,g;
use_ok($module) || diag $@;
}
for (
qw(_empty_log_files process_etc_files
process_public_files process_log_files process_templates_files
ACTION_build ACTION_dist ACTION_install ACTION_perltidy ACTION_submit ACTION_fakeuninstall ACTION_uninstall )
)
{
can_ok('Ado::Build', $_);
}
for (
qw(process_etc_files process_public_files process_templates_files
ACTION_build ACTION_dist ACTION_install ACTION_perltidy ACTION_submit)
)
{
can_ok('Ado::BuildPlugin', $_);
}
diag("Testing loading of Ado $Ado::VERSION, Perl $], $^X");
done_testing();
t/ado-build.t view on Meta::CPAN
'Module::Build'
);
subtest 'missing build element' => sub {
ok(rename('log', 'log_'), 'no "log" dir');
stdout_like(
sub { $build->create_build_script(); },
qr/Creating\snew\s'Build'\sscript/,
'create_build_script()(no "log" dir) output ok'
);
my $elems = join('', qw(etc public templates));
like(join('', @{$build->build_elements()}), qr/$elems$/, " build_elements($elems) present");
ok(rename('log_', 'log'), 'yes "log" dir');
done_testing();
};
stdout_like(
sub { $build->create_build_script(); },
qr/Creating\snew\s'Build'\sscript/,
'create_build_script() output ok'
);
my $build_elements = [qw(etc public log templates)];
subtest 'install_paths and build elements' => sub {
my $c = $build->{config};
my $prefix = $c->get('siteprefixexp');
is_deeply(
$build->install_path,
{map { $_ => catdir($prefix, $_) } @$build_elements},
'ok - install paths'
);
t/plugin/example-00.t view on Meta::CPAN
ok($app->plugins->namespaces->[-1] eq 'Ado::Plugin',
'$app->plugins->namespaces->[-1]: ' . $app->plugins->namespaces->[-1]);
isnt($app->home, $app->ado_home, '$app->home is not $app->ado_home');
isnt($plugin->home_dir, $app->ado_home, '$plugin->home_dir is not $app->ado_home');
is($plugin->home_dir, $ENV{MOJO_HOME}, '$plugin->home_dir is $MOJO_HOME');
is( $plugin->config_dir,
catdir($ENV{MOJO_HOME}, 'etc', 'plugins'),
'$plugin->config_dir is $MOJO_HOME/etc/plugins'
);
is($app->home->rel_file('public'), $app->static->paths->[0], 'app static path is first');
is($app->ado_home->rel_file('public'), $app->static->paths->[1], 'Ado static path is second');
is($app->home->rel_file('templates'), $app->renderer->paths->[0], 'app renderer path is first');
is( $app->ado_home->rel_file('templates'),
$app->renderer->paths->[1],
'Ado renderer path is second'
);
is_deeply(
$plugin->config,
{ "a" => 1,
"bla" => "off",
t/plugin/markdown_renderer-01.t view on Meta::CPAN
eval "use Text::MultiMarkdown;";
plan skip_all => "Text::MultiMarkdown required for this test" if $@;
my $t = Test::Mojo->new('Ado');
my $app = $t->app;
#test Ado::Control::Articles
my $config = $app->config('Ado::Plugin::MarkdownRenderer');
is($config->{md_reuse_produced_html}, 1);
my $static_file = $app->home->rel_file('public/articles/hello.html');
unlink($static_file);
#file is generated and the user is redirected to it.
$t->get_ok('/articles/hello.html')->status_is(302);
$t->get_ok('/articles/not_found.html')->status_is(404)->text_like('h1' => qr'Not Found');
ok(-e $static_file, 'file /articles/hello.html really exists');
#static file
$t->get_ok('/articles/hello.html')->status_is(200)
->text_like('h1' => qr'ÐолзаÑа Ð¾Ñ Ð¸ÑÑоÑиÑÑа');
t/plugin/markdown_renderer.t view on Meta::CPAN
#test missing/default configuration
$plugin->{config} = {};
isa_ok($plugin->register($app) => $class);
is_deeply($plugin->config('md_file_sufixes') => ['.md'], 'default md_file_sufixes');
is($plugin->config('md_method') => 'markdown', 'default md_method');
is_deeply(
$plugin->config('md_options') => {'use_wikilinks' => 1},
'default md_options'
);
is($plugin->config('md_renderer') => 'Text::MultiMarkdown', 'default md_renderer');
like($md_root, qr|[\\/]public[\\/]doc$|, "ok md_root:$md_root");
#cleanup any created html during the tests
find(
{ no_chdir => 1,
wanted => sub {
ok(unlink($_), 'unlinked created ' . $_)
if $_ =~ /\.html$/;
}
},
$app->home->rel_file('public/doc/bg')
);
#test the helper markdown
$t->get_ok('/test/mark_down')->status_is(200)->text_is('li' => 'some text');
done_testing();
templates/partials/apache2htaccess.ep view on Meta::CPAN
Options +FollowSymLinks
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
ExpiresDefault "access plus 1 month"
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
<FilesMatch <%=$moniker%>$>
# Do not allow Ado responses to be cached unless they explicitly send cache
# headers themselves.
ExpiresActive Off
</FilesMatch>
<FilesMatch "\.(appcache)$">
#Expire manifest files immediately.
ExpiresDefault "access plus 0 seconds"
</FilesMatch>
templates/partials/apache2htaccess.ep view on Meta::CPAN
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# use the following line:
# RewriteBase /
# Otherwise set RewriteBase to the subdirectory where your site is, e.g. /<%=$moniker%>.
# RewriteBase /<%=$moniker%>
# Redirect all requests for Ado static files to public/ directory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((css|doc|fonts|img|js|vendor|favicon|index)\b.*)$ /public/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /bin/<%=$moniker%>/$1 [L]
</IfModule>