Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public/sass/cerulean.scss
public/sass/cerulean/
public/packed/
public/content-pics/dist-logos/
public/sprite.css
public/sprite.png
modulesperl6.db
building-modulesperl6.db
bin/hypnotoad.pid
Expand All @@ -23,3 +25,10 @@ META.list.local
ModulesPerl6-*
.build
public/proto.json
MYMETA.json
MYMETA.yml
assets/assetpack.db
assets/cache
t/03-app/public/sprite.css
t/03-app/public/sprite.png

11 changes: 6 additions & 5 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use strict;
use Module::Build;

my $build = Module::Build->new(
module_name => 'Perl6::Modules::Org',
dist_abstract => 'Perl 6 Ecosystem',
dist_name => 'perl6.modules.org',
dist_author => 'Perl 6 Hackers',
license => 'perl',
Expand Down Expand Up @@ -29,23 +31,22 @@ my $build = Module::Build->new(
'Import::Into' => '0',
'JSON::Meth' => '1.001006',
'LWP::UserAgent' => '0',
'Mew' => '1.001005',
'Mew' => '1.001006',
'Mojo::Base' => '0',
'Mojo::Collection' => '0',
'Mojo::Log' => '0',
'Mojo::URL' => '0',
'Mojo::UserAgent' => '0',
'Mojo::Util' => '0',
'Mojolicious' => '6.33',
'Mojolicious' => '7.0',
'Mojolicious::Commands' => '0',
'Mojolicious::Plugin::AssetPack' => '0.68',
'Mojolicious::Plugin::Bootstrap3' => '3.3600',
'Mojolicious::Plugin::AssetPack' => '1.18',
'POSIX' => '0',
'Pithub' => '0.01030',
'Pod::Usage' => '1.67',
'SQL::Translator' => '0.11021',
'Test::Mojo::Role::Debug' => '1.003004',
'Test::Mojo::Role::ElementCounter' => '1.001005',
'Test::Mojo::Role::ElementCounter' => '1.001006',
'Test::Mojo::Role::SubmitForm' => '1.001007',
'Test::Mojo::WithRoles' => '0.02',
'Test::More' => '0',
Expand Down
18 changes: 7 additions & 11 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ perl-5.22.0
...
...
```
Pick the latest available `perl` and run (substituting `perl-5.22.0` for
Pick the latest available `perl` and run (substituting `perl-5.24.0` for
the latest version you see available):

```bash
$ perlbrew install perl-5.22.0`
$ perlbrew install perl-5.24.0`
```

Now, run `perlbrew switch perl-5.22.0` to switch to that version of Perl 5.
Now, run `perlbrew switch perl-5.24.0` to switch to that version of Perl 5.

We'll also need [cpanm](metacpan.org/pod/App::cpanminus) and a
module, so run this next:
Expand Down Expand Up @@ -106,12 +106,9 @@ $ cd modules.perl6.org;
#### Install Perl 5 module dependencies:

```bash
$ perl Build.PL
$ ./Build installdeps
$ cpanm --installdeps -vn .
```

If asked whether to configure stuff automatically, just respond with `yes`.

### Production Deployment

If you're looking to deploy the app, you may wish to install *nginx*,
Expand All @@ -121,10 +118,10 @@ to use [Mojolicious](http://mojolicio.us/)'s server).

## Generating The Database

Run the `build-project-list.pl` build script that will generate the SQLite database file and launch the app in production mode. If you
want to launch the app yourself, specify `--no-app-start` flag (you may also use the `--limit=` parameter so you don't build info for all the dists):
Run the `build-project-list.pl` build script that will generate the SQLite database file. If you want it to also start the app in production mode, pass
`--restart-app` option. (you may also use the `--limit=` parameter so you don't build info for all the dists):
```bash
$ perl build-project-list.pl --no-app-start --limit=10
$ perl build-project-list.pl --limit=10
```

## Launching Development Server
Expand Down Expand Up @@ -203,4 +200,3 @@ error from Apache:
the content
2. Check that the proxy has been configured to listen to the correct port
specified in the app config. Currently, that's `:3333`

12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ You can also create file `META.list.local` that contains specific URLs
you may wish to fetch for debug purposes. Use the `--meta-list` argument
to specify the location of that file. See `--help` for all options.

- The build script automatically starts the Mojolicious app that powers the
front end. To disable that behaviour, specify the `--no-app-start` flag:
- The build script can start the Mojolicious app that powers the
front end of you pass the `--restart-app` option:
```bash
$ perl bin/build-project-list.pl --no-app-start
$ perl bin/build-project-list.pl --restart-app
```

For development purposes, you can use `bin/morbo` to power the web app,
as it will watch for changes and auto-restart the app.

#### Browser Support

We support the current and previous major releases of Chrome, Firefox, Internet Explorer (Edge), and Safari. Please test layout changes. Lacking actual browsers to test in, you can use [browsershots.org](http://browsershots.org)
Expand Down Expand Up @@ -79,6 +82,9 @@ See [LICENSE](LICENSE) file for the details of the license of the code in this r
This repository also contains code authored by third parties that may be licensed under a different license. Such
files indicate the copyright and license terms at the top of the file. Currently these include:

* Sprite generation code modified from now-deprecated [original
`Mojolicious::Plugin::AssetPack::Handler::Sprites`](https://github.com/jhthorsen/mojolicious-plugin-assetpack/blob/f2a31c17d5076b056673f26dcb82071b505c9059/lib/Mojolicious/Plugin/AssetPack/Handler/Sprites.pm)
Copyright (C) 2014 Jan Henning Thorsen
* jQuery deparam plugin: Copyright (c) 2010 "Cowboy" Ben Alman. Dual licensed under the MIT and GPL licenses. See [http://benalman.com/about/license/](http://benalman.com/about/license/)
* The Camelia image is copyright 2009 by Larry Wall. Permission to use is granted under the [Artistic License 2.0](License), or any subsequent version
of the Artistic License.
Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 18 additions & 1 deletion public/sass/main.scss → assets/sass/main.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
$color-link: #2FA4E7;
$color-panel-primary-bg: $color-link;

body {
background: lighten(#2FA4E7, 45%);
background: lighten($color-link, 45%);
color: #555;
}

a {
color: $color-link;
}

.panel-primary,
.panel-primary > .panel-heading {
border-color: lighten($color-panel-primary-bg, 30%);
}

.panel-primary > .panel-heading {
background: $color-panel-primary-bg;
}

.error-page {
Expand Down
5 changes: 2 additions & 3 deletions bin/morbo
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ morbo \
-w lib-db-builder \
-w bin \
-w templates \
-w public/content-pics \
-w public/js \
-w assets/js \
-w public/pics \
-w public/sass \
-w assets/sass \
-w modules_perl6.conf \
-w modulesperl6.db \
-l http://*:3333 bin/ModulesPerl6.pl
28 changes: 17 additions & 11 deletions lib/ModulesPerl6.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use Mojo::Util qw/slurp/;
use ModulesPerl6::Model::BuildStats;
use ModulesPerl6::Model::Dists;
use ModulesPerl6::Model::SiteTips;
use ModulesPerl6::SpriteMaker;
use experimental 'postderef';

sub startup {
Expand All @@ -30,26 +31,31 @@ sub startup {
]);

# ASSETS
$self->plugin(bootstrap3 => theme =>
{ cerulean => 'https://bootswatch.com/cerulean/_bootswatch.scss' },
jquery => 0, js => [],
);
$self->asset('app.css' => qw{
$self->plugin( AssetPack => { pipes => [qw/Sass JavaScript Combine/] });
$self->asset->process('app.css' => qw{
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css
/sass/main.scss
});

$self->asset('sprite.css' => 'sprites:///content-pics/dist-logos')
if map bsd_glob("$_/content-pics/dist-logos/*"),
$self->static->paths->@*;

$self->asset('app.js' => qw{
for ( $self->static->paths->@* ) {
next unless bsd_glob("$_/content-pics/dist-logos/*");
ModulesPerl6::SpriteMaker->new->make_sprites(
static_path => $_,
pic_dir => 'content-pics/dist-logos/',
class => 'dist-logos',
image_file => 'sprite.png',
css_file => 'sprite.css',
);
last;
}

$self->asset->process('app.js' => qw{
https://code.jquery.com/jquery-1.11.3.min.js
https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js
/js/jquery-deparam.js
/js/main.js
});
$self->asset->purge({always => 1}); # clean up old packed files

# HELPERS
$self->helper( dists => sub {
Expand Down
55 changes: 55 additions & 0 deletions lib/ModulesPerl6/SpriteMaker.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Adapted from now deprecated Mojolicious::Plugin::AssetPack::Handler::Sprites
# Copyright (C) 2014, Jan Henning Thorsen
# Original can be found at https://github.com/jhthorsen/mojolicious-plugin-assetpack/blob/f2a31c17d5076b056673f26dcb82071b505c9059/lib/Mojolicious/Plugin/AssetPack/Handler/Sprites.pm

package ModulesPerl6::SpriteMaker;
use File::Basename 'basename';
use File::Spec::Functions qw/catfile catdir/;
use Imager::File::PNG;
use Mojo::Base -base;
use Mojo::Util qw/spurt/;

sub make_sprites {
my $self = shift;
my %opts = @_;
my $class = $opts{class};
my $directory = catdir @opts{qw/static_path pic_dir /};
my $image_file = catfile @opts{qw/static_path image_file/};
my $css_file = catfile @opts{qw/static_path css_file /};

my $tiled = Imager->new(xsize => 1000, ysize => 10000, channels => 4);
my $css = '';
my @size = (0, 0);

die "Could not find sprites directory `$directory`" unless $directory;
opendir my $SPRITES, $directory or die "opendir $directory: $!";

for my $file (sort readdir $SPRITES) {
next unless $file =~ /\.(jpe?g|png)$/i;
my $tile = Imager->new(file => File::Spec->catfile($directory, $file))
or die Imager->errstr;

my $cn = $file;
my ($w, $h) = ($tile->getwidth, $tile->getheight);
$cn =~ s!\.\w+$!!;
$cn =~ s!\W!-!g;
$css .= ".$class.$cn { background-position: 0 -$size[1]px;"
. " width: ${w}px; height: ${h}px; }\n";

$tiled->paste(src => $tile, left => 0, top => $size[1])
or die $tiled->errstr;
$size[1] += $h;
$size[0] = $w if $size[0] < $w;
}

$tiled->crop(right => $size[0], bottom => $size[1])
->write(data => \my $sprite, type => 'png')
or die $tiled->errstr;

$css .= ".$class { background: url(/$opts{image_file})"
. " no-repeat; display: inline-block; }\n";
spurt $sprite => $image_file;
spurt $css => $css_file;
}

1;
Binary file not shown.
Loading