-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.PL
156 lines (123 loc) · 4.58 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package Slovo;
use 5.026000;
use ExtUtils::MakeMaker 7.24;
use strict;
use warnings;
use utf8;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
my $module_file = 'lib/' . __PACKAGE__ . '.pm';
my $git_url = 'https://github.com/kberov/' . __PACKAGE__;
my $PREREQ_PM = {
'Authen::SASL' => '2.16',
'Class::Method::Modifiers' => '2.13',
'Cpanel::JSON::XS' => '4.32',
'Minion::Backend::SQLite' => '5.0.7',
'Mojo::SQLite' => '3.009',
'Mojolicious' => '9.28',
'Mojolicious::Plugin::PODViewer' => '0.007',
'Mojolicious::Plugin::Authentication' => '1.39',
'Mojolicious::Plugin::OpenAPI' => '5.07',
'Mojolicious::Plugin::RoutesConfig' => '0.07',
'Net::SMTP' => '3.14',
'Role::Tiny' => '2.002004',
'EV' => '4.33'
};
if ($ENV{TEST_AUTHOR}) {
$PREREQ_PM = {
%$PREREQ_PM,
'Test::Pod' => '1.52',
'Test::Perl::Critic' => '1.04',
'Perl::Critic' => '1.140',
'Test::PerlTidy' => '20220902'
};
}
WriteMakefile(
NAME => __PACKAGE__,
VERSION_FROM => $module_file,
AUTHOR => 'Красимир Беров ([email protected])',
ABSTRACT_FROM => $module_file,
LICENSE => 'artistic_2',
PREREQ_PM => $PREREQ_PM,
CONFIGURE_REQUIRES => {},
BUILD_REQUIRES => {'ExtUtils::MakeMaker' => '7.24'},
TEST_REQUIRES => {},
test => {TESTS => 't/*.t'},
EXE_FILES => ['script/slovo'],
clean => {FILES => '*.conf Slovo-* lib/Slovo/resources/data/*.sqli*'},
MIN_PERL_VERSION => '5.026000',
META_MERGE => {
dynamic_config => 0,
'meta-spec' => {version => 2},
no_index => {directory => ['t']},
prereqs => {runtime => {requires => {perl => '5.026000'}}},
resources => {
bugtracker => {web => "$git_url/issues"},
homepage => $git_url,
license => ['http://www.opensource.org/licenses/artistic-license-2.0'],
repository => {type => 'git', url => "$git_url.git", web => $git_url,},
},
},
);
sub MY::postamble {
my $preop = qq 'podselect $module_file > README.pod;';
my @perltidy_files = qw(script/slovo Makefile.PL);
my $options = {
no_chdir => 1,
wanted => sub {
push @perltidy_files, $_ if $_ =~ /\.(PL|pm|pl|t|conf)$/;
}
};
File::Find::find($options, 'lib', 't');
my $perltidy_files = join '\\' . $/ . "\t ", @perltidy_files;
return <<"TARGETS";
readme ::
\t$preop
dist : readme
perltidy ::
\tperltidy -pro=.perltidyrc \\
\t$perltidy_files
TARGETS
}
__END__
=encoding utf8
=head1 NAME
Makefile.PL for the Slovo project
=head1 SYNOPSIS
Some commands:
Set C<INSTALL_BASE>, remove old Slovo installation, make, test, install, create
data directory for sqlite database and run slovo to see available commands.
INSTALL_BASE=~/opt/slovo && rm -rf $INSTALL_BASE && make distclean; \
perl Makefile.PL INSTALL_BASE=$INSTALL_BASE && make && make test && make install \
&& $INSTALL_BASE/bin/slovo eval 'app->home->child("data")->make_path({mode => 0700});' \
&& $INSTALL_BASE/bin/slovo
Use cpanm to install or update into a custom location as self contained application and
run slovo to see how it's going
# From metacpan. org
export PREFIX=~/opt/slovo;
cpanm -M https://cpan.metacpan.org -n --self-contained -l $PREFIX Slovo \
$PREFIX/bin/slovo eval 'app->home->child("data")->make_path({mode => 0700});' \
$PREFIX/bin/slovo
# From the directory where you unpacked Slovo
export PREFIX=~/opt/slovo;
cpanm . -n --self-contained -l $PREFIX Slovo
$PREFIX/bin/slovo eval 'app->home->child("data")->make_path({mode => 0700});'
$PREFIX/bin/slovo
Start the development server and open a browser
morbo ./script/slovo -l http://*:3000 & sleep 1 exo-open http://localhost:3000
Start the production server
hypnotoad script/slovo
# you will see something like the following:
[2019-02-24 19:38:08.69754] [13570] [info] Listening at "http://127.0.0.1:9090"
Server available at http://127.0.0.1:9090
[2019-02-24 19:38:08.69804] [13570] [info] Listening at "http://[::1]:9090"
Server available at http://[::1]:9090
Build Makefile even directly in vim
!perl Makefile.PL
When you want to add new files to the ditribution
make manifest
Beautify your code
make perltidy
Re-generate README and README.pod
make readme
=cut