Browse Source

Adding initial project to build the project from.

main
sergiotarxz 2 months ago
parent
commit
d3cedf05b5
Signed by: sergiotarxz GPG Key ID: E5903508B6510AC2
11 changed files with 132 additions and 0 deletions
  1. +39
    -0
      Makefile.PL
  2. +9
    -0
      bin/beastbb
  3. +2
    -0
      lib/BeastBB.conf
  4. +24
    -0
      lib/BeastBB.pm
  5. +11
    -0
      lib/BeastBB/Controller/Example.pm
  6. +3
    -0
      migrations/1/down.sql
  7. +10
    -0
      migrations/1/up.sql
  8. +11
    -0
      public/index.html
  9. +9
    -0
      t/basic.t
  10. +9
    -0
      templates/example/welcome.html.ep
  11. +5
    -0
      templates/layouts/default.html.ep

+ 39
- 0
Makefile.PL View File

@ -0,0 +1,39 @@
## Please see file perltidy.ERR
## Please see file perltidy.ERR
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'BeastBB',
VERSION => '0.1',
INST_SCRIPT => './bin',
INST_BIN => './bin',
test => { TESTS => 't/*.t' },
);
package MY {
sub top_targets {
my $self = shift;
my $return = $self->SUPER::top_targets(@_);
$return = [ split /\n/, $return ];
for my $i ( keys @$return ) {
$return->[$i] .= ' install_frontend'
if $return->[$i] =~ /^all :/;
}
return join "\n", @$return;
}
sub postamble {
return
"\n"
. "install_frontend:\n"
. "\tif [ ! -e blib/BeastBB/public ]; then "
. "mkdir -pv blib/BeastBB/public; "
. "fi;"
. "if [ ! -e blib/BeastBB/templates ]; then "
. "mkdir -pv blib/BeastBB/templates; "
. "fi; "
. "cp -rfv templates/* blib/BeastBB/templates; "
. "cp -rfv public/* blib/BeastBB/public; ";
}
}

+ 9
- 0
bin/beastbb View File

@ -0,0 +1,9 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Mojolicious::Commands;
# Start command line interface for application
Mojolicious::Commands->start_app('BeastBB');

+ 2
- 0
lib/BeastBB.conf View File

@ -0,0 +1,2 @@
{
}

+ 24
- 0
lib/BeastBB.pm View File

@ -0,0 +1,24 @@
package BeastBB;
use Mojo::Base 'Mojolicious';
use Mojo::File;
use Data::Dumper;
sub startup {
my $self = shift;
my $config = $self->plugin(
'Config',
file => Mojo::File::curfile->dirname->child('BeastBB.conf')->to_string
);
$self->secrets( $config->{secrets} );
my $r = $self->routes;
$r->get('/')->to('example#welcome');
@{ $self->renderer->paths() } =
( Mojo::File::curfile->dirname->child('BeastBB')->child('templates')->to_string );
@{ $self->static->paths() } =
( Mojo::File::curfile->dirname->child('BeastBB')->child('public')->to_string );
STDERR->print(Data::Dumper::Dumper $self->static->paths());
STDERR->print(Data::Dumper::Dumper $self->renderer->paths());
}
1;

+ 11
- 0
lib/BeastBB/Controller/Example.pm View File

@ -0,0 +1,11 @@
package BeastBB::Controller::Example;
use Mojo::Base 'Mojolicious::Controller';
sub welcome {
my $self = shift;
$self->render(
msg => 'Welcome to the Mojolicious real-time web framework!' );
}
1;

+ 3
- 0
migrations/1/down.sql View File

@ -0,0 +1,3 @@
DROP INDEX username_index_users;
DROP INDEX matrix_address_index_users;
DROP TABLE users;

+ 10
- 0
migrations/1/up.sql View File

@ -0,0 +1,10 @@
create table users (
id SERIAL PRIMARY KEY,
username TEXT UNIQUE,
matrix_address TEXT UNIQUE,
is_confirmed INT[1] DEFAULT false,
"privileges" HSTORE
);
CREATE INDEX username_index_users ON users username;
CREATE INDEX matrix_address_index_users ON users matrix_address;

+ 11
- 0
public/index.html View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to the Mojolicious real-time web framework!</title>
</head>
<body>
<h2>Welcome to the Mojolicious real-time web framework!</h2>
This is the static document "public/index.html",
<a href="/">click here</a> to get back to the start.
</body>
</html>

+ 9
- 0
t/basic.t View File

@ -0,0 +1,9 @@
use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
my $t = Test::Mojo->new('BeastBB');
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i);
done_testing();

+ 9
- 0
templates/example/welcome.html.ep View File

@ -0,0 +1,9 @@
% layout 'default';
% title 'Welcome';
<h2><%= $msg %></h2>
<p>
This page was generated from the template "templates/example/welcome.html.ep"
and the layout "templates/layouts/default.html.ep",
<%= link_to 'click here' => url_for %> to reload the page or
<%= link_to 'here' => '/index.html' %> to move forward to a static page.
</p>

+ 5
- 0
templates/layouts/default.html.ep View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>

Loading…
Cancel
Save