lib/Strehler.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 11 / 11 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Strehler/FormFu/Validator/UserUnique.pm ↑ Summary lib/Strehler/FormFu/Element/DisplayOrder.pm »
1 package Strehler;
2 12 $Strehler::VERSION = '1.6.8';
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: A light-weight, nerdy, smart CMS in perl based on Perl Dancer2 framework.
7  
8 12 our $STATICS_VERSION = 2;
9  
10 =encoding utf8
11  
12 =head1 NAME
13  
14 Strehler - A light-weight, nerdy, smart CMS in perl based on Perl Dancer2 framework.
15  
16 =head1 DESCRIPTION
17  
18 Strehler is a module that add to your Dancer2 app a simple backend to edit contents.
19  
20 It can be used to manage articles and images and arrange them with categories and tags.
21  
22 You can easly extend Strehler to add features or to manage through its interface contents different from the ones already provided.
23  
24 =head1 SYNOPSIS
25  
26 cpan -i Strehler
27  
28 strehler demo
29  
30 cd StrehlerDemo
31  
32 bin/app.pl
33  
34 Open a browser and go to http://localhost:3000/admin. As login use username: admin and password: admin.
35  
36 Welcome to Strehler! Here you can write contents. Study the documentation about how to develope a site to display them.
37  
38 =head1 STREHLER SCRIPT
39  
40 Strehler is shipped with a script to make easy initialization and configuration of the system. You can use it on an existing Dancer2 app to add Strehler powers to it.
41  
42 Before using any strehler command go in the directory where your Dancer2 app is and type
43  
44 export DANCER_CONFDIR=.
45  
46 Then do anything you want staying in the root dir of the Dancer app.
47  
48 =head2 Available commands
49  
50 Strehler script commands are
51  
52 =over 4
53  
54 =item commands
55  
56 Just to see this list on the command-line.
57  
58 =item statics
59  
60 Go in the root directory of your Dancer2 app and type
61  
62 strehler statics
63  
64 This command will copy static resources used by Strehler in the public directory of the app.
65  
66 Using strehler statics on your app is MANDATORY to use Strehler capabilities.
67  
68 strehler statics is included in strehler batch.
69  
70 B<Warning>: every time you run strehler statics the %PUBLIC%/strehler directory is removed and copied as new from the package. Do not use strehler directory for your files if you think you could run strehler statics more than once (for example, updating package)
71  
72 =item initdb
73  
74 Go in the root directory of your Dancer2 app, ensure you have in it a config.yml with a Dancer2::Plugin::DBIC configured and type
75  
76 strehler initdb
77  
78 The script will take the schema configured as Strehler schema in your config.yml (or default) and it will deploy in it Strehler database tables.
79  
80 B<Warning>: This will erase every previous table created with the name of a Strehler table. Create commands have a DROP IF EXISTS on top.
81  
82 If you want to work with the configurations of an environment different from the default one (development) just launch the command as
83  
84 DANCER_ENVIRONMENT=other-env strehler initdb
85  
86 During database initialization you'll have to choose your admin password. Use it to enter Strehler admin interface (username: admin). This password can be changed using pwdchange.
87  
88 Using strehler initdb on your app is MANDATORY to use Strehler capabilities.
89  
90 Strehler statics is included in strehler batch.
91  
92 =item layout
93  
94 Go in the root directory of your Dancer2 app and type
95  
96 strehler layout
97  
98 This will just copy the strehler layout file in your views/layouts directory. This file is only needed here if you want to customize Strehler, changing its homepage or adding navigations others the the ones already implemented. Otherwise, you can avoid this command.
99  
100 =item demo
101  
102 Just type
103  
104 strehler demo
105  
106 It will create a Dancer2 app named StrehlerDemo and then it will run on it C<strehler statics>, C<strehler initdb> and C<strehler layout>. Then some demo files will be added.
107  
108 If you want the app to be deployed in a directory different from StrehlerDemo just type
109  
110 strehler demo other-directory
111  
112 When installation is finished go under the newly created app and type
113  
114 bin/app.pl
115  
116 With your browser go to http://localhost:3000/admin, use "admin" as username and "admin" as password and try out Strehler!
117  
118 =item pwdchange
119  
120 Type
121
122 strehler pwdchange
123  
124 A new password for admin user will be asked. New password will substitute the old one.
125  
126 Only admin password can be changed.
127  
128 =item schemadump
129  
130 strehler schemadump
131  
132 Just run dbicdump using Dancer2::Plugin::DBIC configuration to setup database models. Do nothing is Strehler::Schema is the configured schema class.
133  
134 schemadump is included in strehler batch.
135  
136 =item batch
137  
138 strehler batch
139  
140 This command executes initdb, statics and, if needed, schemadump. Schemadump is executed only if configured schema class for database is different from Strehler::Schema.
141  
142 Typing batch you can setup a Strehler environment with just one command.
143  
144 =item categories
145
146 strehler categories FILE
147  
148 Provide to categories command a file like this:
149  
150 robots/giant robots
151 article;good,evil;good
152 image;pilot,machine
153 robots/androids
154 robots
155 all;japanese,american;japanese
156 robots/mech
157 spaceships
158 planets/bases
159 planets/cities
160 robots/androids
161  
162 This will generate on the database all the categories.
163  
164 An indented line (with spaces) under category name configure tags with this pattern:
165  
166 %ENTITY%;%TAGS%,%SEPARATED%,%BY%,%COMMAS%;%DEFAULT%
167  
168 If a category is present in the file more than one time, last configuration wins.
169  
170 If a category is present in the file more than one time, last configuration will be used.
171  
172 Using this script, categories can only be created, never erased. A tags configuration different from the one in the db will overwrite that with no warning.
173  
174 If you specify a parent that doesn't exists, the new parent will be created.
175  
176 Default file name is categories.txt, this file will be used if no filename is provided.
177  
178 =item testelement
179  
180 strehler testelement Strehler::Element::Article
181  
182 Run a check about configuration of an entity. Useful when new entity are written for a specific site.
183  
184 =item initentity
185  
186 strehler initentity Strehler::Element::Extra::Artwork
187  
188 Considering a non-standard entity installed from a package different from Strehler.
189  
190 Initelement run the install method of the class, allowing entity initialization if needed.
191  
192 =back
193  
194 =head1 HOW TO ADD STREHLER TO AN APP
195  
196 You already have a Dancer2 app correctly generated using Dancer2 tutorials. You also have Dancer2::Plugin::DBIC configured.
197  
198 Now go under root directory on your app and type
199  
200 strehler statics
201  
202 And then
203  
204 strehler initdb
205  
206 During initdb running password for admin will be requested. Choose one and remember it.
207  
208 For database schema you have to ways. You can just configure in the plugin the schema as Strehler::Schema. It will works well if you have no intention to add tables other than the ones provided by Strehler.
209 Other possibility is to create a schema using dbicdump script of DBIx::Class::Schema::Loader, dumping Strehler tables along with all the others you created.
210  
211 From start to here, all the procedure can be done just typing:
212  
213 strehler batch
214  
215 Finally open your bin/app.pl and add the line
216  
217 use Strehler::Admin
218  
219 I<below> the use directive about your main app. Placing it below it (and not above) is important to keep Dancer2 to consider right paths and configurations.
220  
221 Done!
222 Now at the url http://YOURAPP/admin you'll find Strehler backend!
223  
224 =head1 COMPLETE DOCUMENTATION
225  
226 For now, best place to learn how Strehler works is the github wiki: L<https://github.com/cym0n/strehler/wiki>
227  
228 =head1 AUTHOR
229  
230 Simone "Cymon" Fare'
231  
232 =head1 COPYRIGHT AND LICENSE
233  
234 This software is copyright (c) 2014 by Simone "Cymon" Fare'.
235  
236 This is free software; you can redistribute it and/or modify it under
237 the same terms as the Perl 5 programming language system itself.
238  
239 =cut
240  
241  
242 12 1;
« lib/Strehler/FormFu/Validator/UserUnique.pm ↑ Summary lib/Strehler/FormFu/Element/DisplayOrder.pm »