summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-03-03 23:38:29 +0100
committerMax Magorsch <arzano@gentoo.org>2020-03-04 03:13:27 +0100
commitc6cfca15b1b20492ebeb4178e234176520483bd4 (patch)
tree56e1b5904988fe12c968d942a4c9381d30c306aa
parentFix the cve import (diff)
downloadglsamaker-c6cfca15b1b20492ebeb4178e234176520483bd4.tar.gz
glsamaker-c6cfca15b1b20492ebeb4178e234176520483bd4.tar.bz2
glsamaker-c6cfca15b1b20492ebeb4178e234176520483bd4.zip
Display version and last update in the footer2.1.18glsamakerv2
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/views/layouts/application.html.erb3
-rw-r--r--config/environment.rb2
-rw-r--r--config/initializers/glsamaker_constants.rb1
-rw-r--r--lib/tasks/cve.rake5
5 files changed, 11 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2138571..68194e7 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -152,6 +152,10 @@ module ApplicationHelper
content_tag("h2", content, :class => "boxtitle")
end
+ def last_import_start
+ Rails.cache.fetch(::CVE_CACHE_LAST_IMPORT)
+ end
+
def with_format(format, &block)
old_formats = formats
begin
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 689051f..4120f34 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -85,7 +85,8 @@
<%= yield %>
</div>
<div id="footer">
- <span><strong>GLSAMaker <%= GLSAMAKER_VERSION %></strong></span>
+ <span><strong>GLSAMaker <%= `git describe --tags` %></strong></span>
+ <span><strong>CVE Data current as of: <%= last_import_start ? last_import_start : 'unknown' %></strong></span>
<span><%= link_to "About&hellip;".html_safe, :controller => 'index', :action => 'about' %></span>
<span class="floatright"><strong>Administrative contact: <a href="mailto:<%= GLSAMAKER_ADMIN_EMAIL%>"><%= GLSAMAKER_ADMIN_EMAIL%></a></strong></span>
diff --git a/config/environment.rb b/config/environment.rb
index 4f0c553..8ec6d35 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -4,6 +4,6 @@ require File.expand_path('../application', __FILE__)
# Initialize the Rails application
Rails.application.initialize!
-GLSAMAKER_VERSION = '2.1.12'
+GLSAMAKER_VERSION = '2.1.18'
require 'digest/md5'
diff --git a/config/initializers/glsamaker_constants.rb b/config/initializers/glsamaker_constants.rb
new file mode 100644
index 0000000..6476c7d
--- /dev/null
+++ b/config/initializers/glsamaker_constants.rb
@@ -0,0 +1 @@
+CVE_CACHE_LAST_IMPORT = 'cve/last-import'
diff --git a/lib/tasks/cve.rake b/lib/tasks/cve.rake
index 4fccf47..dbdc7a8 100644
--- a/lib/tasks/cve.rake
+++ b/lib/tasks/cve.rake
@@ -46,6 +46,7 @@ namespace :cve do
desc 'Full CVE data import'
task full_import: [:environment, 'db:load_config'] do
+ Rails.cache.write(CVE_CACHE_LAST_IMPORT, Time.now.utc)
start_ts = Time.now
(YEAR..Date.today.year).each do |year|
@@ -72,7 +73,7 @@ namespace :cve do
desc 'Incrementally update last CVEs'
task update: :environment do
-
+ Rails.cache.write(CVE_CACHE_LAST_IMPORT, Time.now.utc)
info 'Running incremental CVE data update...'
jsondata = status 'Downloading' do
@@ -90,7 +91,7 @@ namespace :cve do
desc 'Update all CVEs'
task update_all: :environment do
-
+ Rails.cache.write(CVE_CACHE_LAST_IMPORT, Time.now.utc)
info 'Running complete CVE data update...'
(YEAR..Date.today.year).each do |year|