Skip to content

Commit

Permalink
add meta info to all produced views
Browse files Browse the repository at this point in the history
small tweak to interface with sqlports 7.33
  • Loading branch information
marcespie committed Jan 29, 2021
1 parent becbb0c commit c208be5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
30 changes: 24 additions & 6 deletions lib/SqlPorts.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ my $list_req = $db->prepare(
order by _categorykeys.value
});
$list_req->bind_columns(\($category));
$list_req->execute;

my $list_cat_req = $db->prepare(
q{select min(_paths.fullpkgpath),
Expand Down Expand Up @@ -168,7 +167,26 @@ my $canonical_req = $db->prepare(
my $canonical;
$canonical_req->bind_columns(\$canonical);

my $e;
my ($version, $creation_date);

my $meta_req = $db->prepare(
q{select SchemaVersion, CreationDate from meta});
$meta_req->bind_columns(\$version, \$creation_date);
$meta_req->execute;
while ($meta_req->fetch) {
}

sub create_hash
{
return {
version => $version,
creation_date => $creation_date,
@_
};
}

my $e = create_hash();
$list_req->execute;
while ($list_req->fetch) {
push(@{$e->{categories}}, {
name => $category,
Expand All @@ -185,7 +203,7 @@ sub category
{
my ($class, $cat) = @_;
$list_cat_req->execute($cat);
my $e = { name => $cat };
my $e = create_hash( name => $cat );
while ($list_cat_req->fetch) {
push(@{$e->{category}}, {
name => $fullpkgname,
Expand All @@ -206,13 +224,13 @@ sub pkgpath
}
# zap the email part
$maintainer =~ s/\s+\<.*?\>//g;
my $e = { path => $path,
my $e = create_hash( path => $path,
simplepath => $simplepath,
comment => $comment,
homepage => $homepage,
maintainer => $maintainer,
descr => $descr,
fullpkgname => $fullpkgname };
fullpkgname => $fullpkgname );
unless ($permit =~ /yes/i) {
$e->{permit} = $permit;
}
Expand Down Expand Up @@ -354,7 +372,7 @@ sub search
my $req = $db->prepare($s);
$req->bind_columns(\($fullpkgpath, $fullpkgname));
$req->execute(@params);
my $e = {};
my $e = create_hash();
while ($req->fetch) {
push(@{$e->{result}}, {
name => $fullpkgname,
Expand Down
2 changes: 1 addition & 1 deletion views/layouts/main.tt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
</form>
</div>
<div id="footer">
<a href="/path/databases/ports-readmes-dancer">Ports Readmes</a>, powered by <a href="http://perldancer.org/">Dancer</a> <% dancer_version %>
<a href="/path/databases/ports-readmes-dancer">Ports Readmes <% version %></a>, created on <% creation_date %>, powered by <a href="http://perldancer.org/">Dancer</a> <% dancer_version %>
</div>
<script type="text/javascript" src="//<% request.host %>/javascripts/script.js"></script>

0 comments on commit c208be5

Please sign in to comment.