[gentoo-commits] proj/infra-status:master commit in: public/assets/css/

2014-04-20 Thread Alex Legler
commit: 02877dad26a860459827ea88c035675720719b5f
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Apr 20 09:49:14 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Apr 20 09:49:14 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=02877dad

fix symlinked file

---
 public/assets/css/tyrian.css | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/public/assets/css/tyrian.css b/public/assets/css/tyrian.css
deleted file mode 12
index 1fcd584..000
--- a/public/assets/css/tyrian.css
+++ /dev/null
@@ -1 +0,0 @@
-/home/alex/work/gentoo/git/tyrian/sources/css/tyrian/dist/tyrian.css
\ No newline at end of file

diff --git a/public/assets/css/tyrian.css b/public/assets/css/tyrian.css
new file mode 100644
index 000..f0d9bb8
--- /dev/null
+++ b/public/assets/css/tyrian.css
@@ -0,0 +1,4 @@
+.navbar-default{background-image:-webkit-linear-gradient(top, #54487a 0, 
#493f6a 100%);background-image:-o-linear-gradient(top, #54487a 0, #493f6a 
100%);background-image:linear-gradient(to bottom, #54487a 0, #493f6a 
100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff54487a',
 endColorstr='#ff493f6a', GradientType=0)}@font-face{font-family:'Open 
Sans';font-style:normal;font-weight:400;src:local('Open 
Sans'),local('OpenSans'),url(../fonts/OpenSans-Regular.woff) 
format('woff')}@font-face{font-family:'Open 
Sans';font-style:normal;font-weight:600;src:local('Open Sans 
Semibold'),local('OpenSans-Semibold'),url(../fonts/OpenSans-Semibold.woff) 
format('woff')}@font-face{font-family:'Open 
Sans';font-style:normal;font-weight:700;src:local('Open Sans 
Bold'),local('OpenSans-Bold'),url(../fonts/OpenSans-Bold.woff) 
format('woff')}@font-face{font-family:'Open 
Sans';font-style:italic;font-weight:400;src:local('Open Sans 
Italic'),local('OpenSans-Italic
 '),url(../fonts/OpenSans-Italic.woff) 
format('woff')}@font-face{font-family:'Open 
Sans';font-style:italic;font-weight:700;src:local('Open Sans Bold 
Italic'),local('OpenSans-BoldItalic'),url(../fonts/OpenSans-BoldItalic.woff) 
format('woff')}@font-face{font-family:'Bitter';font-style:normal;font-weight:400;src:local('Bitter-Regular'),url(../fonts/Bitter-Regular.woff)
 format('woff')}h1.first-header{margin-top:-10px}h1 small,h2 small,h3 small,h4 
small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 
small{font-family:Open Sans,Helvetica 
Neue,Helvetica,Arial,sans-serif}textarea{font-family:monospace}.site-title{background-image:-webkit-linear-gradient(top,
 #beb8db 0, #dddaec 20%);background-image:-o-linear-gradient(top, #beb8db 0, 
#dddaec 20%);background-image:linear-gradient(to bottom, #beb8db 0, #dddaec 
20%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffbeb8db',
 endColorstr='#ffdddaec', GradientType=0);backgrou
 nd-color:#ee}.site-label{display:inline;padding:.2em .6em 
.3em;font-size:75%;font-weight:bold;line-height:1;color:#ff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;background-color:#54487a;color:white}.site-label:empty{display:none}.btn
 
.site-label{position:relative;top:-1px}.site-title-buttons{margin-top:1em;float:right
 !important;float:right}@media 
(max-width:767px){.site-title-buttons{display:none 
!important}}.site-title-button-group{position:relative;display:inline-block;vertical-align:middle}.site-title-button-group.btn{position:relative;float:left}.site-title-button-group.btn:hover,.site-title-button-group.btn:focus,.site-title-button-group.btn:active,.site-title-button-group.btn.active{z-index:2}.site-title-button-group.btn:focus{outline:0}.site-title-button-group
 .btn+.btn,.site-title-button-group .btn+.btn-group,.site-title-button-group 
.btn-group+.btn,.site-title-button-group 
.btn-group+.btn-group{margin-left:-1px}.get-gento
 
o{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px
 solid transparent;white-space:nowrap;padding:6px 
12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#ff;background-color:#54487a;border-color:#493f6a}.get-gentoo:hover,.get-gentoo:focus{color:#33;text-decoration:none}.get-gentoo:active,.get-gentoo.active{outline:0;background-image:none;-webkit-box-shadow:inset
 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px 
rgba(0,0,0,0.125)}.get-gentoo.disabled,.get-gentoo[disabled],fieldset[disabled] 
.get-gentoo{cursor:not-allowed;pointer-events:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.get-gentoo:hover,.get-gentoo:focus,.get-gentoo:active,.get-gentoo.active,.open.dropdown-toggle.get-gentoo{color:#ff;background-color:#3e355a;border-color:#2e284
 
3}.get-gentoo:active,.get-gentoo.active,.open.dropdown

[gentoo-commits] proj/infra-status:master commit in: lib/

2014-04-26 Thread Alex Legler
commit: bd69c347389e01b910b6b8f34f7f164e0e47823b
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Apr 26 14:34:43 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Apr 26 14:34:43 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=bd69c347

Fix tooltip location to avoid :last-child bugs

---
 lib/helpers.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 85c62e0..9b37c49 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -24,7 +24,7 @@ helpers do
 services.each do |service|
   content  
 a class=\list-group-item has-tooltip notice-link\ href=\#notices\ 
title=\#{status_text(service_status(service))}\
-   data-toggle=\tooltip\ data-placement=\top\
+   data-toggle=\tooltip\ data-placement=\top\ 
data-container=\body\
data-service=\#{service}\ 
data-service-name=\#{ServiceRegistry.instance.services[service][:name].gsub 
'', '}\
 #{service_info service}
 #{ServiceRegistry.instance.services[service][:name]}



[gentoo-commits] proj/infra-status:master commit in: views/

2014-04-27 Thread Alex Legler
commit: b52b1bbd9459187f5fb9629b4bfee14672804aff
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Apr 27 13:10:38 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Apr 27 13:10:38 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=b52b1bbd

Load site_logo.png from CDN as well

---
 views/layout.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/layout.erb b/views/layout.erb
index 7aa4891..1a18d87 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -39,7 +39,7 @@
   /div
 /div
 div class=logo
-  img src=/assets/img/site-logo.png alt=Gentoo Linux Logo/
+  img 
src=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/site-logo.png;
 alt=Gentoo Linux Logo/
   span class=site-labelInfra Status/span
 /div
   /div



[gentoo-commits] proj/infra-status:master commit in: lib/

2014-04-30 Thread Alex Legler
commit: 38945e1b33ea90486f495681a6c7c2ba6e3a0fd7
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Apr 30 12:12:25 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Apr 30 12:12:25 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=38945e1b

Be more resilient to status.json update failures

---
 lib/helpers.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 9b37c49..b321f0a 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -35,6 +35,7 @@ helpers do
   end
 
   def service_status(service)
+return 'na' unless ServiceRegistry.instance.services.has_key? service
 active_notices = NoticeStore.instance.active_notices_for(service)
 
 unless (forced_state = get_forced_state(active_notices)) == nil
@@ -130,4 +131,4 @@ helpers do
   end
 }.compact.reverse.join(' ')
   end
-end
\ No newline at end of file
+end



[gentoo-commits] proj/infra-status:master commit in: lib/

2014-05-12 Thread Alex Legler
commit: 45d9d907f809c246d635c09b95635282a3dd5140
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon May 12 15:00:01 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon May 12 15:00:01 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=45d9d907

Return NA when a service has no data for a given host.

---
 lib/service_registry.rb | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/lib/service_registry.rb b/lib/service_registry.rb
index e374f1f..c6d208a 100644
--- a/lib/service_registry.rb
+++ b/lib/service_registry.rb
@@ -7,6 +7,7 @@ module State
   UP=1
   DOWN=2
   WARNING=3
+  NA=0
 end
 
 module HelperMethods
@@ -44,6 +45,10 @@ module HelperMethods
 status_data['services'][host][service]['is_flapping'] != 0
   end
 
+  def has_service?(host, service)
+status_data['services'][host].has_key?(service)
+  end
+
   def default(host, service = nil)
 if service == nil
   if host_flapping? host
@@ -54,6 +59,8 @@ module HelperMethods
 State::DOWN
   end
 else
+  return State::NA unless has_service? host, service
+
   if service_flapping? host, service
 State::WARNING
   elsif service_up? host, service



[gentoo-commits] proj/infra-status:master commit in: data/

2014-04-16 Thread Alex Legler
commit: 3d72f26c40de4d10eea418aafde19488b8c1ee9e
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Apr 16 21:53:31 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Apr 16 21:53:31 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=3d72f26c

Remove services.rb

You shouldn't need to update the app code to update service locations.
services.rb moves to puppet.

---
 data/.gitignore   | 1 +
 data/{services.rb = services.rb.example} | 0
 2 files changed, 1 insertion(+)

diff --git a/data/.gitignore b/data/.gitignore
index a574e5e..567a7b4 100644
--- a/data/.gitignore
+++ b/data/.gitignore
@@ -1 +1,2 @@
 status.json
+services.rb

diff --git a/data/services.rb b/data/services.rb.example
similarity index 100%
rename from data/services.rb
rename to data/services.rb.example



[gentoo-commits] proj/infra-status:master commit in: /, views/

2014-04-17 Thread Alex Legler
commit: d91d7be69ed627d7c5c9e733da0aad5732407967
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 14:05:31 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 14:05:31 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=d91d7be6

Set title when displaying a notice

---
 infra-status.rb  | 1 +
 views/layout.erb | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/infra-status.rb b/infra-status.rb
index 2bff57c..b332df6 100644
--- a/infra-status.rb
+++ b/infra-status.rb
@@ -35,6 +35,7 @@ get '/notice/:id' do
   'h1No such notice/h1pThe notice you have requested does not exist 
or has been removed as it was resolved long ago./p'
 end
   else
+@title = notice['title']
 erb :notice, :locals = { :notice = notice }
   end
 end

diff --git a/views/layout.erb b/views/layout.erb
index be50e02..d43b914 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -1,7 +1,7 @@
 !DOCTYPE html
 html
 head
-  titleGentoo Infrastructure Status/title
+  title%= #{h @title} -  if @title %Gentoo Infrastructure Status/title
   meta charset=utf-8
   meta name=viewport content=width=device-width, initial-scale=1.0
   meta name=description content=



[gentoo-commits] proj/infra-status:master commit in: views/

2014-04-17 Thread Alex Legler
commit: 15253a210025865dfae22996efe2ea1dff3c8269
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 16:41:31 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 16:41:31 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=15253a21

Notice footer rework

---
 views/notice.erb | 37 +++--
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/views/notice.erb b/views/notice.erb
index c27f802..5a91342 100644
--- a/views/notice.erb
+++ b/views/notice.erb
@@ -6,11 +6,36 @@
 %= markdown notice.get_content %
   /div
   div class=panel-footer
-span class=pull-rightPosted at em%= date_format 
notice['created_at'] %/em/span
-% if notice.has_key? 'eta' %
-  strongEstimated time of service recovery: em%= date_format 
notice['eta'] %/em/strong
-% else %
-  strongNo estimated time of service recovery available./strong
-% end %
+div class=row
+  div class=col-sm-4 has-tooltip data-toggle=tooltip 
data-placement=top title=Notice publication date
+span class=glyphicon glyphicon-send pull-left title=Notice 
publication date/span
+div style=margin-left: 1.25emem%= date_format 
notice['created_at'] %/em/div
+  /div
+  % if notice.has_key? 'starts_at' %
+div class=col-sm-4 has-tooltip data-toggle=tooltip 
data-placement=top title=Maintenance start time
+% diff = ((DateTime.now - notice['starts_at']) * 24 * 60 * 60).to_i %
+  span class=glyphicon glyphicon-wrench pull-left 
title=Maintenance start time/span
+  div style=margin-left: 1.25em;em%= date_format 
notice['starts_at'] %/embr
+% if diff  0 %
+  (in em%= humanize(-diff) %/em)
+% else %
+  (em%= humanize(diff) %/em ago)
+% end %
+  /div
+/div
+  % else %
+div class=col-sm-4/div
+  % end %
+  div class=col-sm-4 has-tooltip data-toggle=tooltip 
data-placement=top title=Estimated time of service recovery
+span class=glyphicon glyphicon-ok pull-left title=Estimated time 
of service recovery/span
+div style=margin-left: 1.25em;
+  % if notice.has_key? 'eta' %
+em%= date_format notice['eta'] %/em (estimated)
+  % else %
+No estimated time of service recovery available.
+  % end %
+/div
+  /div
+/div
   /div
 /div



[gentoo-commits] proj/infra-status:master commit in: lib/, views/

2014-04-17 Thread Alex Legler
commit: cd5e000195d4afaadaa227e9d6b92580d1573fed
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 16:41:16 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 16:41:16 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=cd5e0001

Implement starts_at

start_at marks the date when an event (maintenance usually) described in the 
notice starts.
This is then the date when effects like force_state are applied.

---
 lib/helpers.rb  | 11 ++-
 lib/notice_store.rb | 20 +++-
 views/index.erb |  2 +-
 views/layout.erb|  4 
 4 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index aaaf632..ec65b37 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -20,7 +20,7 @@ helpers do
 
   def service_info(service)
 content = ''
-active_notices = NoticeStore.instance.active_notices_for(service)
+active_notices = NoticeStore.instance.visible_notices_for(service)
 
 unless (forced_state = get_forced_state(active_notices)) == nil
   content  status_icon(forced_state)
@@ -87,4 +87,13 @@ helpers do
   date.rfc2822
 end
   end
+
+  def humanize(secs)
+[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, 
name|
+  if secs  0
+secs, n = secs.divmod(count)
+#{n.to_i} #{name} unless name == :seconds
+  end
+}.compact.reverse.join(' ')
+  end
 end
\ No newline at end of file

diff --git a/lib/notice_store.rb b/lib/notice_store.rb
index 1d29fdd..c3c7093 100644
--- a/lib/notice_store.rb
+++ b/lib/notice_store.rb
@@ -34,11 +34,23 @@ class NoticeStore
 @notices
   end
 
+  def visible_notices
+notices.select do |notice|
+  is_active = notice['active']
+  is_active = notice['expire_at'] = DateTime.now if notice.has_key? 
'expire_at'
+  is_active = notice['created_at'] = DateTime.now if notice.has_key? 
'created_at'
+
+  is_active
+end
+
+  end
+
   def active_notices
 notices.select do |notice|
   is_active = notice['active']
   is_active = notice['expire_at'] = DateTime.now if notice.has_key? 
'expire_at'
   is_active = notice['created_at'] = DateTime.now if notice.has_key? 
'created_at'
+  is_active = notice['starts_at'] = DateTime.now if notice.has_key? 
'starts_at'
 
   is_active
 end
@@ -50,6 +62,12 @@ class NoticeStore
 end
   end
 
+  def visible_notices_for(service)
+visible_notices.select do |notice|
+  notice.has_key? 'affects' and notice['affects'].include? service
+end
+  end
+
   def notice(id)
 notices.each do |notice|
   return notice if notice['id'] == id
@@ -95,7 +113,7 @@ class Notice
   def initialize(id, metadata, content)
 @metadata = metadata
 
-%w[created_at eta expire_at].each do |key|
+%w[created_at eta expire_at starts_at].each do |key|
   @metadata[key] = DateTime.parse(@metadata[key]) if @metadata.has_key? key
 end
 

diff --git a/views/index.erb b/views/index.erb
index beea7c0..98869a2 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -94,4 +94,4 @@
 
 h2Maintenance and Outage Notices/h2
 
-%= partial :notice, :collection = NoticeStore.instance.active_notices %
\ No newline at end of file
+%= partial :notice, :collection = NoticeStore.instance.visible_notices %
\ No newline at end of file

diff --git a/views/layout.erb b/views/layout.erb
index d43b914..c31a71a 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -122,6 +122,10 @@
 var d=document, g=d.createElement(script), 
s=d.getElementsByTagName(script)[0]; g.type=text/javascript;
 g.defer=true; g.async=true; g.src=u+piwik.js; 
s.parentNode.insertBefore(g,s);
   })();
+
+  jQuery(function($) {
+$('.has-tooltip').tooltip()
+  });
 /script
 /body
 /html



[gentoo-commits] proj/infra-status:master commit in: views/

2014-04-17 Thread Alex Legler
commit: a1a617007788faa5e49a68a46bd43a331cd05d88
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 16:45:15 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 16:45:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=a1a61700

Right-align ETA in desktop browsers.

TODO: Push this to tyrian

---
 views/layout.erb | 7 +++
 views/notice.erb | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/views/layout.erb b/views/layout.erb
index c31a71a..338f620 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -7,6 +7,13 @@
   meta name=description content=
   link href=/assets/css/bootstrap.css rel=stylesheet media=screen
   link rel=icon href=http://www.gentoo.org/favicon.ico; 
type=image/x-icon
+  style type=text/css
+@media (min-width: 1200px) {
+  .text-right-lg {
+text-align: right;
+  }
+}
+  /style
 /head
 body
 header

diff --git a/views/notice.erb b/views/notice.erb
index 5a91342..9b1ff11 100644
--- a/views/notice.erb
+++ b/views/notice.erb
@@ -26,7 +26,7 @@
   % else %
 div class=col-sm-4/div
   % end %
-  div class=col-sm-4 has-tooltip data-toggle=tooltip 
data-placement=top title=Estimated time of service recovery
+  div class=col-sm-4 has-tooltip text-right-lg data-toggle=tooltip 
data-placement=top title=Estimated time of service recovery
 span class=glyphicon glyphicon-ok pull-left title=Estimated time 
of service recovery/span
 div style=margin-left: 1.25em;
   % if notice.has_key? 'eta' %



[gentoo-commits] proj/infra-status:master commit in: views/

2014-04-17 Thread Alex Legler
commit: 691f943b9181ccfe5fcc9e0ee708c2ed979b7101
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 16:49:50 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 16:49:50 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=691f943b

Revert Right-align ETA in desktop browsers.

This reverts commit a1a617007788faa5e49a68a46bd43a331cd05d88.

---
 views/layout.erb | 7 ---
 views/notice.erb | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/views/layout.erb b/views/layout.erb
index 338f620..c31a71a 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -7,13 +7,6 @@
   meta name=description content=
   link href=/assets/css/bootstrap.css rel=stylesheet media=screen
   link rel=icon href=http://www.gentoo.org/favicon.ico; 
type=image/x-icon
-  style type=text/css
-@media (min-width: 1200px) {
-  .text-right-lg {
-text-align: right;
-  }
-}
-  /style
 /head
 body
 header

diff --git a/views/notice.erb b/views/notice.erb
index 9b1ff11..5a91342 100644
--- a/views/notice.erb
+++ b/views/notice.erb
@@ -26,7 +26,7 @@
   % else %
 div class=col-sm-4/div
   % end %
-  div class=col-sm-4 has-tooltip text-right-lg data-toggle=tooltip 
data-placement=top title=Estimated time of service recovery
+  div class=col-sm-4 has-tooltip data-toggle=tooltip 
data-placement=top title=Estimated time of service recovery
 span class=glyphicon glyphicon-ok pull-left title=Estimated time 
of service recovery/span
 div style=margin-left: 1.25em;
   % if notice.has_key? 'eta' %



[gentoo-commits] proj/infra-status:master commit in: lib/

2014-04-17 Thread Alex Legler
commit: 9816353aa5ef74b8475a28970cf2700750e4a1f3
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 16:52:15 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 16:52:15 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=9816353a

Make only active notices apply overrides

---
 lib/helpers.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index ec65b37..2b737e9 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -20,7 +20,7 @@ helpers do
 
   def service_info(service)
 content = ''
-active_notices = NoticeStore.instance.visible_notices_for(service)
+active_notices = NoticeStore.instance.active_notices_for(service)
 
 unless (forced_state = get_forced_state(active_notices)) == nil
   content  status_icon(forced_state)



[gentoo-commits] proj/infra-status:master commit in: lib/

2014-04-17 Thread Alex Legler
commit: c0b3436592c5ed7471949c3b65240014f00d9b42
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Apr 17 16:59:24 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Apr 17 16:59:24 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=c0b34365

...but all visible notices count when calculating the number of items

---
 lib/helpers.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 2b737e9..7693239 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -21,6 +21,7 @@ helpers do
   def service_info(service)
 content = ''
 active_notices = NoticeStore.instance.active_notices_for(service)
+visible_notices = NoticeStore.instance.visible_notices_for(service)
 
 unless (forced_state = get_forced_state(active_notices)) == nil
   content  status_icon(forced_state)
@@ -37,7 +38,7 @@ helpers do
   end
 end
 
-content  'span class=badge style=margin-right: 1em; title=There 
are notices (%s) below regarding this service.%s/span' % 
[active_notices.count, active_notices.count] if active_notices.count  0
+content  'span class=badge style=margin-right: 1em; title=There 
are notices (%s) below regarding this service.%s/span' % 
[visible_notices.count, visible_notices.count] if visible_notices.count  0
 
 content
   end



[gentoo-commits] proj/qa-scripts:master commit in: htdocs/img/, htdocs/css/, htdocs/

2014-09-01 Thread Alex Legler
commit: 86eca7121ae8fcc074fefc0141bb6df4b93cf8dd
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Sep  1 13:34:29 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Sep  1 13:34:29 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/qa-scripts.git;a=commit;h=86eca712

Update index page to use Tyrian, remove local resources.

Remember kids, a href=/foo is bad. Use quotes.

---
 htdocs/css/style.css|  60 ---
 htdocs/gentoo-header-bar-bg.png | Bin 210 - 0 bytes
 htdocs/gentoo_org.png   | Bin 47830 - 0 bytes
 htdocs/img/gentoo-header-bar-bg.png | Bin 210 - 0 bytes
 htdocs/img/gentoo_org.png   | Bin 47830 - 0 bytes
 htdocs/index.html   | 206 
 htdocs/screen.css   |  44 
 7 files changed, 139 insertions(+), 171 deletions(-)

diff --git a/htdocs/css/style.css b/htdocs/css/style.css
deleted file mode 100644
index 671db51..000
--- a/htdocs/css/style.css
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Gentoo bar */
-body {
-background: none repeat scroll 0 0 #D2D0D4;
-font-family: Helvetica,Arial,Geneva;
-margin: 1em;
-}
-
-#gentoo-main {
-background: none repeat scroll 0 0 #F0F0F0;
-border: 1px solid #747E93;
-border-radius: 5px 5px 5px 5px;
-color: black;
-font-size: 10pt;
-   font-family: Sans-Serif;
-padding: 10px;
-}
-#header {
-text-align:center;
-}
-div#gentoo-bar {
-   background: url(../img/gentoo-header-bar-bg.png) repeat-x;
-   margin-bottom: 2em;
-   margin-top: -1em;
-   margin-left: -1em;
-   margin-right: -1em;
-   overflow:hidden;
-   padding-bottom:0.3em;
-}
-
-div#gentoo-bar img {
-border: none !important;
-}
-
-div#gentoo-bar div {
-font-size: 10pt;
-padding: .25em;
-}
-
-div#gentoo-bar a.home-link {
-margin-right: .5em;
-float: left;
-}
-
-div#gentoo-bar div a {
-text-decoration: none;
-padding: .25em;
-padding-left: .5em;
-padding-right: .5em;
-color: #231A3F;
-}
-
-div#gentoo-bar div a:hover {
-background-color: #A898DD;
-color: #45347B;
-}
-
-div#gentoo-bar div a.active {
-background-color: white;
-font-weight: bold;
-}
\ No newline at end of file

diff --git a/htdocs/gentoo-header-bar-bg.png b/htdocs/gentoo-header-bar-bg.png
deleted file mode 100644
index fca09df..000
Binary files a/htdocs/gentoo-header-bar-bg.png and /dev/null differ

diff --git a/htdocs/gentoo_org.png b/htdocs/gentoo_org.png
deleted file mode 100644
index a790fe9..000
Binary files a/htdocs/gentoo_org.png and /dev/null differ

diff --git a/htdocs/img/gentoo-header-bar-bg.png 
b/htdocs/img/gentoo-header-bar-bg.png
deleted file mode 100644
index 9e7b3c2..000
Binary files a/htdocs/img/gentoo-header-bar-bg.png and /dev/null differ

diff --git a/htdocs/img/gentoo_org.png b/htdocs/img/gentoo_org.png
deleted file mode 100644
index a790fe9..000
Binary files a/htdocs/img/gentoo_org.png and /dev/null differ

diff --git a/htdocs/index.html b/htdocs/index.html
index 53c57ae..62e137c 100644
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -1,76 +1,148 @@
 !DOCTYPE html
 html
 head
-   titleQA-Reports - Output from various QA scripts/title
-   meta name=author content=Gentoo QA Team /
-   meta name=copyright content=Gentoo Foundation 2012 /
-   meta http-equiv=content-type content=text/html; charset=UTF-8 /
-   meta http-equiv=content-type content=application/xhtml+xml; 
charset=UTF-8 /
-   link type=image/x-icon href=http://www.gentoo.org/favicon.ico; 
rel=shortcut icon /
-   link rel=stylesheet type=text/css href=css/style.css
+  titleGentoo QA Reports/title
+  meta charset=utf-8
+  meta name=viewport content=width=device-width, initial-scale=1.0
+  link 
href=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/bootstrap.min.css;
 rel=stylesheet media=screen
+  link 
href=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/tyrian.min.css;
 rel=stylesheet media=screen
+  link rel=icon href=http://www.gentoo.org/favicon.ico; 
type=image/x-icon
 /head
 body
-!-- gentoo header, stolen from bugzilla --
- div id=gentoo-bar
-a class=home-link title=Go to the Gentoo Linux homepage 
href=http://gentoo.org;
-img alt=Gentoo Websites Logo 
src=https://www.bugs.gentoo.org/extensions/Gentoo/web/gentoo_org.png;/a
-div
-Go to:
-a href=http://www.gentoo.org/;Gentoo Home/a
-a 
href=http://www.gentoo.org/doc/en/index.xml;Documentation/a
-a href=http://forums.gentoo.org/;Forums/a
-a href=http://www.gentoo.org/main/en/lists.xml;Lists/a
-a href=http://bugs.gentoo.org;Bugs/a
-a href=http://planet.gentoo.org;Planet/a
-a href=http://store.gentoo.org;Store/a
-a href=http

[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-16 Thread Alex Legler
commit: ee89dd3428d1677d5896b74791ac542851e0524f
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Dec 16 21:36:00 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Dec 16 21:36:00 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=ee89dd34

Remove rsync6.ca, bug 527638

---
 files/mirrors/rsync.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/rsync.xml b/files/mirrors/rsync.xml
index 1ffac30..20960da 100644
--- a/files/mirrors/rsync.xml
+++ b/files/mirrors/rsync.xml
@@ -24,10 +24,6 @@
   nameArctic Network Mirrors - rsync5.ca.gentoo.org/name
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync5.ca.gentoo.org/uri
 /mirror
-mirror
-  namemirror.the-best-hosting.net - rsync6.ca.gentoo.org/name
-  uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync6.ca.gentoo.org/uri
-/mirror
   /mirrorgroup
   mirrorgroup region=North America (rsync.namerica.gentoo.org) country=US 
countryname=USA
 mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-16 Thread Alex Legler
commit: 1c135d2cc0c6c3366ab64b0d97118ca02660a9a8
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Dec 16 22:18:56 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Dec 16 22:18:56 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=1c135d2c

Remove rsync service of gentoo-distfiles, bug 394771

---
 files/mirrors/distfiles.xml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 7e1b8b9..1ad8225 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -449,7 +449,6 @@
 /mirror
 mirror
   nameStar Studio of UESTC/name
-  uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://mirrors.stuhome.net/gentoo//uri
   uri protocol=http ipv4=y ipv6=n 
partial=nhttp://mirrors.stuhome.net/gentoo//uri
   uri protocol=ftp ipv4=y ipv6=n 
partial=nftp://mirrors.stuhome.net/gentoo//uri
 /mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-16 Thread Alex Legler
commit: fbb46e0f0c4fcfa2378cb74d5e6188f2076a7e31
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Dec 16 21:33:25 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Dec 16 21:33:25 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=fbb46e0f

Remove the-best-hosting.net, bug 527638

---
 files/mirrors/distfiles.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 39a8bad..7e1b8b9 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -20,10 +20,6 @@
   uri protocol=http ipv4=y ipv6=n 
partial=nhttp://gentoo.gossamerhost.com/uri
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://gentoo.gossamerhost.com/gentoo-distfiles//uri
 /mirror
-mirror
-  namemirror.the-best-hosting.net/name
-  uri protocol=http ipv4=y ipv6=y 
partial=nhttp://mirror.the-best-hosting.net/uri
-/mirror
   /mirrorgroup
   mirrorgroup region=North America country=US countryname=USA
 mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-16 Thread Alex Legler
commit: a2a2adeeb3a7f07b603ffb561da208b72a479f42
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Dec 16 21:26:38 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Dec 16 21:26:38 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=a2a2adee

Remove gentoo.mneisen.org, bug 532210

---
 files/mirrors/distfiles.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index c82cf54..39a8bad 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -242,10 +242,6 @@
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://ftp-stud.hs-esslingen.de/gentoo//uri
 /mirror
 mirror
-  namemneisen.org/name
-  uri protocol=http ipv4=y ipv6=n 
partial=nhttp://gentoo.mneisen.org//uri
-/mirror
-mirror
   namede-mirror.org/name
   uri protocol=ftp ipv4=y ipv6=n 
partial=nftp://de-mirror.org/gentoo//uri
   uri protocol=http ipv4=y ipv6=n 
partial=nhttp://de-mirror.org/gentoo//uri



[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-16 Thread Alex Legler
commit: 8e4e84ac3a6f6bbbc9674c950d06a866805ede1e
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Dec 16 21:32:14 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Dec 16 21:32:14 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=8e4e84ac

Remove rsync3.de, bug 529662

---
 files/mirrors/rsync.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/rsync.xml b/files/mirrors/rsync.xml
index 09cc82f..1ffac30 100644
--- a/files/mirrors/rsync.xml
+++ b/files/mirrors/rsync.xml
@@ -119,10 +119,6 @@
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync1.de.gentoo.org/uri
 /mirror
 mirror
-  namehosteurope.de - rsync3.de.gentoo.org/name
-  uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync3.de.gentoo.org/uri
-/mirror
-mirror
   nameI-Node - rsync5.de.gentoo.org/name
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync5.de.gentoo.org/uri
 /mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-16 Thread Alex Legler
commit: e8f08a148729541e553ca3efbba5c76eb974211a
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Dec 16 22:24:31 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Dec 16 22:24:31 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=e8f08a14

Remove anl.gov, bug 532384

---
 files/mirrors/distfiles.xml | 6 --
 1 file changed, 6 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 1ad8225..e1dd955 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -70,12 +70,6 @@
   uri protocol=http ipv4=y ipv6=n 
partial=nhttp://mirror.usu.edu/mirrors/gentoo//uri
 /mirror
 mirror
-  nameArgonne National Laboratory/name
-  uri protocol=http ipv4=y ipv6=y 
partial=nhttp://mirror.mcs.anl.gov/pub/gentoo//uri
-  uri protocol=ftp ipv4=y ipv6=y 
partial=nftp://mirror.mcs.anl.gov/pub/gentoo//uri
-  uri protocol=rsync ipv4=y ipv6=y 
partial=nrsync://mirror.mcs.anl.gov/gentoo//uri
-/mirror
-mirror
   nameEasynews NNTP Hosting/name
   uri protocol=http ipv4=y ipv6=n 
partial=nhttp://gentoo.mirrors.easynews.com/linux/gentoo//uri
 /mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2014-12-17 Thread Alex Legler
commit: 7f965cbf0f76a79b3863bcc4a543e51571f5734b
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Dec 17 08:34:57 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Dec 17 08:34:57 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=7f965cbf

Update frp.rnl.ist.utl.pt, bug 513590

---
 files/mirrors/distfiles.xml | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index e1dd955..36a2fec 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -317,10 +317,10 @@
   /mirrorgroup
   mirrorgroup region=Europe country=PT countryname=Portugal
 mirror
-  nameInstituto Superior Técnico/name
-  uri protocol=http ipv4=y ipv6=y 
partial=nhttp://ftp.rnl.ist.utl.pt/pub/gentoo/gentoo-distfiles//uri
-  uri protocol=ftp ipv4=y ipv6=y 
partial=nftp://ftp.rnl.ist.utl.pt/pub/gentoo/gentoo-distfiles//uri
-  uri protocol=rsync ipv4=y ipv6=y 
partial=nrsync://ftp.rnl.ist.utl.pt/pub/gentoo/gentoo-distfiles//uri
+  nameRNL - Técnico Lisboa/name
+  uri protocol=http ipv4=y ipv6=y 
partial=nhttp://ftp.rnl.tecnico.ulisboa.pt/pub/gentoo/gentoo-distfiles//uri
+  uri protocol=ftp ipv4=y ipv6=y 
partial=nftp://ftp.rnl.tecnico.ulisboa.pt/pub/gentoo/gentoo-distfiles//uri
+  uri protocol=rsync ipv4=y ipv6=y 
partial=nrsync://ftp.rnl.tecnico.ulisboa.pt/pub/gentoo/gentoo-distfiles//uri
 /mirror
 mirror
   nameUniversity of Coimbra/name



[gentoo-commits] proj/api:master commit in: files/overlays/

2014-09-04 Thread Alex Legler
commit: 0ba13d38d03482bb925b1db3e4bdd458c561d63e
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Sep  4 18:58:37 2014 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Sep  4 18:58:37 2014 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=0ba13d38

-a3li

---
 files/overlays/repositories.xml | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/files/overlays/repositories.xml b/files/overlays/repositories.xml
index 9f61b7e..d22f7a8 100644
--- a/files/overlays/repositories.xml
+++ b/files/overlays/repositories.xml
@@ -47,17 +47,6 @@ SYN
   /repo
 FIN
 --
-  repo quality=experimental status=official
-namea3li/name
-description lang=en![CDATA[a3li's ebuild ward]]/description
-homepagehttps://github.com/a3li/a3li-overlay/homepage
-owner type=person
-  emaila...@gentoo.org/email
-  nameAlex Legler/name
-/owner
-source type=gitgit://github.com/a3li/a3li-overlay.git/source
-feedhttps://github.com/a3li/a3li-overlay/commits/master.atom/feed
-  /repo
   repo quality=experimental status=unofficial
 nameabendbrot/name
 description lang=enDesktop oriented overlay for various ebuilds and 
the occasional gamer/description



[gentoo-commits] proj/api:master commit in: files/mirrors/

2015-01-14 Thread Alex Legler
commit: f11585120f76f73e6bc8b6b3efe457bd45386293
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Jan 14 14:22:51 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Jan 14 14:22:51 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=f1158512

Remove channelx.biz; bug 534390

---
 files/mirrors/distfiles.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 36a2fec..779748e 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -460,10 +460,6 @@
   uri protocol=ftp ipv4=y ipv6=n 
partial=nftp://gg3.net/pub/linux/gentoo//uri
 /mirror
 mirror
-  nameChannelX.biz/name
-  uri protocol=http ipv4=y ipv6=n 
partial=nhttp://gentoo.channelx.biz//uri
-/mirror
-mirror
   nameJapan Advanced Institute of Science and Technology/name
   uri protocol=http ipv4=y ipv6=y 
partial=nhttp://ftp.jaist.ac.jp/pub/Linux/Gentoo//uri
   uri protocol=rsync ipv4=y ipv6=y 
partial=nrsync://ftp.jaist.ac.jp/pub/Linux/Gentoo//uri



[gentoo-commits] proj/ag: New branch: master

2015-02-19 Thread Alex Legler
commit: 
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Feb 19 19:22:58 2015 +

New branch: master




[gentoo-commits] proj/ag-web: New branch: master

2015-02-19 Thread Alex Legler
commit: 
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Feb 19 23:19:06 2015 +

New branch: master




[gentoo-commits] proj/api:master commit in: files/mirrors/

2015-01-14 Thread Alex Legler
commit: bd5be18766fd77c0aad1c4596a334d5f878d1aae
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Jan 14 14:17:33 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Jan 14 14:17:33 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=bd5be187

Remove rsync13.de.g.o; bug 530220

---
 files/mirrors/rsync.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/rsync.xml b/files/mirrors/rsync.xml
index 20960da..edd9f9c 100644
--- a/files/mirrors/rsync.xml
+++ b/files/mirrors/rsync.xml
@@ -148,10 +148,6 @@
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync12.de.gentoo.org/uri
 /mirror
 mirror
-  namesonic-lux.net - rsync13.de.gentoo.org/name
-  uri protocol=rsync ipv4=y ipv6=y 
partial=nrsync://rsync13.de.gentoo.org/uri
-/mirror
-mirror
   nameRWTH Aachen University/name
   uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync15.de.gentoo.org/uri
 /mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2015-02-10 Thread Alex Legler
commit: d9a50fb34c6357ef0c3c2a5ea044425d4dde98bd
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Feb 10 20:11:12 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Feb 10 20:11:12 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=d9a50fb3

Remove datapipe.net, bug 539490

---
 files/mirrors/distfiles.xml | 5 -
 1 file changed, 5 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 94ce548..cea1a1d 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -61,11 +61,6 @@
   uri protocol=ftp ipv4=y ipv6=y 
partial=nftp://gentoo.llarian.net/pub/gentoo/uri
 /mirror
 mirror
-  nameDatapipe Managed Hosting/name
-  uri protocol=http ipv4=y ipv6=n 
partial=nhttp://mirror.datapipe.net/gentoo/uri
-  uri protocol=ftp ipv4=y ipv6=n 
partial=nftp://mirror.datapipe.net/gentoo/uri
-/mirror
-mirror
   nameUtah State University/name
   uri protocol=http ipv4=y ipv6=n 
partial=nhttp://mirror.usu.edu/mirrors/gentoo//uri
 /mirror



[gentoo-commits] proj/api:master commit in: files/mirrors/

2015-02-05 Thread Alex Legler
commit: 72f47cb737b818a18fb4ae4ece03abba1b84f50f
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Feb  5 20:25:44 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Feb  5 20:25:44 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/api.git;a=commit;h=72f47cb7

Update OVH, bug 538940

---
 files/mirrors/distfiles.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 779748e..94ce548 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -185,9 +185,9 @@
   /mirrorgroup
   mirrorgroup region=Europe country=FR countryname=France
 mirror
-  nameOvh Hosting Provider/name
-  uri protocol=http ipv4=y ipv6=y 
partial=nhttp://mirror.ovh.net/gentoo-distfiles//uri
-  uri protocol=ftp ipv4=y ipv6=y 
partial=nftp://mirror.ovh.net/gentoo-distfiles//uri
+  nameOVH/name
+  uri protocol=http ipv4=y ipv6=y 
partial=nhttp://gentoo.mirrors.ovh.net/gentoo-distfiles//uri
+  uri protocol=ftp ipv4=y ipv6=y 
partial=nftp://gentoo.mirrors.ovh.net/gentoo-distfiles//uri
 /mirror
 mirror
   nameIMJ.fr/name



[gentoo-commits] proj/api:master commit in: files/overlays/

2015-03-17 Thread Alex Legler
commit: 49377bac4288a52991d2b4dadee6bb2c5342435d
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Mar 17 10:42:07 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Mar 17 10:42:07 2015 +
URL:https://gitweb.gentoo.org/proj/api.git/commit/?id=49377bac

infra@ for email, infra-bugs@ only accepts bugmail

 files/overlays/repositories.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/overlays/repositories.xml b/files/overlays/repositories.xml
index 1c94208..6b4f9c4 100644
--- a/files/overlays/repositories.xml
+++ b/files/overlays/repositories.xml
@@ -1730,7 +1730,7 @@ FIN
 descriptionOfficial Gentoo ebuild repository/description
 homepagehttp://gentoo.org//homepage
 owner
-  emailinfra-b...@gentoo.org/email
+  emailin...@gentoo.org/email
 /owner
 source type=rsyncrsync://rsync.gentoo.org/gentoo-portage/source
 source 
type=githttps://github.com/gentoo/gentoo-portage-rsync-mirror/source



[gentoo-commits] proj/api:master commit in: files/overlays/

2015-03-17 Thread Alex Legler
commit: 2d31e1bb63af238eb40ed0da0da0645132d86706
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Mar 17 10:44:26 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Mar 17 10:44:26 2015 +
URL:https://gitweb.gentoo.org/proj/api.git/commit/?id=2d31e1bb

Fix DTD URL

 files/overlays/repositories.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/overlays/repositories.xml b/files/overlays/repositories.xml
index 6b4f9c4..0190ed2 100644
--- a/files/overlays/repositories.xml
+++ b/files/overlays/repositories.xml
@@ -1,5 +1,5 @@
 ?xml version=1.0 encoding=UTF-8?
-!DOCTYPE repositories SYSTEM /dtd/repositories.dtd
+!DOCTYPE repositories SYSTEM http://www.gentoo.org/dtd/repositories.dtd;
 repositories xmlns= version=1.0
 !--
 SYN



[gentoo-commits] proj/qa-scripts:master commit in: pkg_lists/

2015-03-20 Thread Alex Legler
commit: f7632e9c853bb0a711a14d74e40355f791c1d927
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Fri Mar 20 18:23:10 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Fri Mar 20 18:23:10 2015 +
URL:https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=f7632e9c

Add package list script from www.g.o

 pkg_lists/distrowatch.sh | 28 
 pkg_lists/pkglist.py | 20 
 2 files changed, 48 insertions(+)

diff --git a/pkg_lists/distrowatch.sh b/pkg_lists/distrowatch.sh
new file mode 100755
index 000..2e165a6
--- /dev/null
+++ b/pkg_lists/distrowatch.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# $Id: distrowatch.sh,v 1.2 2008/07/12 02:02:47 robbat2 Exp $
+# this file creates a list of packages from the Portage tree for distrowatch
+#
+# $1 = web script directory
+# $2 = web site htdocs directory
+
+if ! [ -d $1 -a -d $2 ]; then
+   echo You must specify the path to the web scripts and the path to the 
output directory
+   exit 1
+fi
+
+#Note: distrowatch lists non-x86 packages like yaboot, so I'm now including 
all arches (drobbins, 04/04/2003)
+
+STABLE_ARCHES= x86 amd64 ppc alpha arm hppa ia64 m68k mips ppc64 s390 sh 
sparc sparc-fbsd x86-fbsd
+UNSTABLE_ARCHES= ~x86 ~amd64 ~ppc ~alpha ~arm ~hppa ~ia64 ~m68k ~mips ~ppc64 
~s390 ~sh ~sparc ~sparc-fbsd ~x86-fbsd
+
+tmp=$(mktemp)
+
+# gentoo_pkglist_x86.txt contains the stable branch packages
+ACCEPT_KEYWORDS=$STABLE_ARCHES $1/pkglist.py 1 $tmp 2 /dev/null
+cat $tmp  $2/gentoo_pkglist_stable.txt
+
+# gentoo_pkglist_X86.txt contains the unstable branch packages
+ACCEPT_KEYWORDS=$STABLE_ARCHES $UNSTABLE_ARCHES $1/pkglist.py 1 $tmp 2 
/dev/null
+cat $tmp  $2/gentoo_pkglist_unstable.txt
+
+rm -f $tmp

diff --git a/pkg_lists/pkglist.py b/pkg_lists/pkglist.py
new file mode 100755
index 000..9777401
--- /dev/null
+++ b/pkg_lists/pkglist.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# $Id: pkglist.py,v 1.1 2005/11/24 23:45:54 ramereth Exp $
+
+import portage
+
+allpkgs=portage.db[/][porttree].dbapi.cp_all()
+bestpkgs={}
+mycount=0
+
+for x in allpkgs:
+   if x not in bestpkgs.keys():
+   y=portage.db[/][porttree].dbapi.xmatch(bestmatch-visible, 
x)
+   bestpkgs[x]=y
+   if y==:
+   continue
+   xs=portage.pkgsplit(bestpkgs[x])
+   print xs[0].split(/)[1],
+   print xs[1],
+   print bestpkgs[x]
+   mycount+=1



[gentoo-commits] proj/ag:master commit in: /

2015-03-07 Thread Alex Legler
commit: 2a9bce09b8ee60da240b4d5e22e057cf3457b39a
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Mar  7 20:54:59 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Mar  7 20:54:59 2015 +
URL:https://gitweb.gentoo.org/proj/ag.git/commit/?id=2a9bce09

Revert Revert Revert Revert TODO!

This reverts commit d012813f2150138fc80bee530ca0874ef5e68ef3.

 TODO | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/TODO b/TODO
index 3346d25..bbc7c4c 100644
--- a/TODO
+++ b/TODO
@@ -3,4 +3,4 @@
   - for index versioning
 - Index more headers
 - Use different analyzers for text in non-english lists
-
+- Fix addresses without  and 



[gentoo-commits] proj/ag:master commit in: lib/

2015-03-07 Thread Alex Legler
commit: 89afb65f423c9eb3e34c09596603e60fb8a96729
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Mar  7 21:13:50 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Mar  7 21:13:50 2015 +
URL:https://gitweb.gentoo.org/proj/ag.git/commit/?id=89afb65f

Clarify error message

 lib/storage.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index 56f3ef0..6ba4026 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -160,7 +160,7 @@ module Ag::Storage
 begin
   identifier = message['X-Archives-Hash'].value
 rescue NoMethodError
-  raise 'No archives hash'
+  raise 'No archives hash found in the message headers'
 end
 
 raw_parent = Ag::Threading.get_parent_message_id(message)



[gentoo-commits] proj/ag:master commit in: lib/

2015-03-07 Thread Alex Legler
commit: b67e866d53ee3fd665d1d23ab69d609035cedca8
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Mar  7 21:11:01 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Mar  7 21:11:01 2015 +
URL:https://gitweb.gentoo.org/proj/ag.git/commit/?id=b67e866d

one more minor fix

 lib/storage.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index e8de874..56f3ef0 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -15,7 +15,7 @@ module Ag::Storage
 [:green, :yellow].include? index_status(indexname).downcase.to_sym
   end
 
-  # Throws Elasticsearch::Transport::Transport::Errors::NotFound
+  # throws Elasticsearch::Transport::Transport::Errors::NotFound
   # if the list does not exist
   def delete_index(list)
   $es.indices.delete(index: 'ml-' + list)



[gentoo-commits] proj/ag:master commit in: /

2015-03-07 Thread Alex Legler
commit: af35510ab65b2baa006324fed7a8ebd5c8d79350
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Mar  7 21:05:13 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Mar  7 21:05:13 2015 +
URL:https://gitweb.gentoo.org/proj/ag.git/commit/?id=af35510a

Title is not a sentence, hence remove the period

hopefully the last useless test commit

 README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README b/README
index b091a5d..960bc8d 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Archives-Ag: Gentoo Archives, backend tool.
+Archives-Ag: Gentoo Archives, backend tool
 
 Setup instructions:
 - Set up Elasticsearch



[gentoo-commits] proj/test:master commit in: /, files/

2015-03-10 Thread Alex Legler
commit: 7f4350a1d75a94794ac4b58cd6da8b603c22
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Mar 10 14:44:02 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Mar 10 14:44:02 2015 +
URL:https://gitweb.gentoo.org/proj/test.git/commit/?id=7f43

Testing paths bold, message plain

 FOO   | 1 +
 files/BAR | 1 +
 2 files changed, 2 insertions(+)

diff --git a/FOO b/FOO
index e69de29..257cc56 100644
--- a/FOO
+++ b/FOO
@@ -0,0 +1 @@
+foo

diff --git a/files/BAR b/files/BAR
index e69de29..5716ca5 100644
--- a/files/BAR
+++ b/files/BAR
@@ -0,0 +1 @@
+bar



[gentoo-commits] proj/test:master commit in: /, files/

2015-03-10 Thread Alex Legler
commit: e94239bce4419f7239fc7110101359ad4cbde033
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Mar 10 14:49:57 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Mar 10 14:49:57 2015 +
URL:https://gitweb.gentoo.org/proj/test.git/commit/?id=e94239bc

Testing again

 FOO   | 2 +-
 files/BAR | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/FOO b/FOO
index 257cc56..8480c53 100644
--- a/FOO
+++ b/FOO
@@ -1 +1 @@
-foo
+asfoo

diff --git a/files/BAR b/files/BAR
index 5716ca5..a486f1a 100644
--- a/files/BAR
+++ b/files/BAR
@@ -1 +1,2 @@
 bar
+bar



[gentoo-commits] proj/test:master commit in: files/, /

2015-03-10 Thread Alex Legler
commit: 4ac30a876e402d1f3fa41e728a466a19758515d9
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Tue Mar 10 14:51:44 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Mar 10 14:51:44 2015 +
URL:https://gitweb.gentoo.org/proj/test.git/commit/?id=4ac30a87

Yellow?

 FOO   | 2 +-
 files/BAR | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/FOO b/FOO
index 8480c53..ae53a2d 100644
--- a/FOO
+++ b/FOO
@@ -1 +1 @@
-asfoo
+fdaasfoo

diff --git a/files/BAR b/files/BAR
index a486f1a..47c6432 100644
--- a/files/BAR
+++ b/files/BAR
@@ -1,2 +1,2 @@
-bar
+fe ^:wqbar
 bar



[gentoo-commits] proj/test: New branch: master

2015-03-10 Thread Alex Legler
commit: 
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Tue Mar 10 14:42:42 2015 +

New branch: master




[gentoo-commits] proj/api:master commit in: files/mirrors/

2015-03-25 Thread Alex Legler
commit: df37cea1bfd5962a32b1e2e9e65fa7856f0bc313
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Mar 25 13:05:43 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Mar 25 13:05:43 2015 +
URL:https://gitweb.gentoo.org/proj/api.git/commit/?id=df37cea1

rsync3.fr merged with rsync2.fr, bug 538940

 files/mirrors/rsync.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/files/mirrors/rsync.xml b/files/mirrors/rsync.xml
index edd9f9c..22bb390 100644
--- a/files/mirrors/rsync.xml
+++ b/files/mirrors/rsync.xml
@@ -180,10 +180,6 @@
   nameOvh Hosting Provider - rsync2.fr.gentoo.org/name
   uri protocol=rsync ipv4=y ipv6=y 
partial=nrsync://rsync2.fr.gentoo.org/uri
 /mirror
-mirror
-  nameOvh Hosting Provider - rsync3.fr.gentoo.org/name
-  uri protocol=rsync ipv4=y ipv6=n 
partial=nrsync://rsync3.fr.gentoo.org/uri
-/mirror
   /mirrorgroup
   mirrorgroup region=Europe (rsync.europe.gentoo.org) country=GR 
countryname=Greece
 mirror



[gentoo-commits] proj/ag:master commit in: /

2015-03-04 Thread Alex Legler
commit: 81e6445a5f9d47a4b29cf045fcfbc9a4ac8284c4
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Mar  4 14:37:50 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Mar  4 14:37:50 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=81e6445a

test mirroring

 README | 1 -
 1 file changed, 1 deletion(-)

diff --git a/README b/README
index b091a5d..5b8d358 100644
--- a/README
+++ b/README
@@ -6,4 +6,3 @@ Setup instructions:
 - bundle exec ag --help
 - bundle exec ag --index-full $MAILDIR
 - bundle exec ag --index-new $MAILDIR
-



[gentoo-commits] proj/ag:master commit in: /

2015-03-04 Thread Alex Legler
commit: 6487b8bbff308278eb8a43c58993e09ec38771b1
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Mar  4 15:12:03 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Mar  4 15:12:03 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=6487b8bb

Revert test mirroring

This reverts commit 81e6445a5f9d47a4b29cf045fcfbc9a4ac8284c4.

 README | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README b/README
index 5b8d358..b091a5d 100644
--- a/README
+++ b/README
@@ -6,3 +6,4 @@ Setup instructions:
 - bundle exec ag --help
 - bundle exec ag --index-full $MAILDIR
 - bundle exec ag --index-new $MAILDIR
+



[gentoo-commits] proj/ag-web:master commit in: /

2015-02-21 Thread Alex Legler
commit: 7123639511ce9d1cc012d2effcdd792b88d5b315
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:24:29 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:24:29 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=71236395

generify captcha error message

---
 ag-web.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ag-web.rb b/ag-web.rb
index f53e94f..b178b71 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -71,7 +71,7 @@ post '/report' do
   )
   msg = 'Thanks for your report.'
 else
-  msg = 'No, Larry does not make that sound (Invalid CAPTCHA). Report not 
sent.'
+  msg = 'Invalid CAPTCHA. Report not sent.'
 end
 
 erb :reportsent, locals: { message: result_data, list: params[:list], msg: 
msg }



[gentoo-commits] proj/ag-web:master commit in: views/, /

2015-02-21 Thread Alex Legler
commit: 35278c94afd68d99416398e4dff1a9a5499db8f4
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:28:54 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:28:54 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=35278c94

show raw mesages if there are no threads

---
 ag-web.rb   | 5 +
 views/listmonth.erb | 6 ++
 2 files changed, 11 insertions(+)

diff --git a/ag-web.rb b/ag-web.rb
index b178b71..182d269 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -106,6 +106,11 @@ get '/:list/threads/:year-:month/:page?' do
 result = threads_in_month(params[:list], params[:year], params[:month], 
current_page)
 max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil
 
+if result['hits']['total'] == 0
+  redirect to(/%s/messages/%s-%s?no_threads=1 % [params[:list], 
params[:year], params[:month]])
+  return
+end
+
 erb :listmonth, locals: { results: result, list: params[:list], 
current_page: current_page, max_pages: max_pages, mode: :threads }
   rescue = e
 $stderr.puts e.to_s

diff --git a/views/listmonth.erb b/views/listmonth.erb
index 4cdabe3..a986eb8 100644
--- a/views/listmonth.erb
+++ b/views/listmonth.erb
@@ -6,6 +6,12 @@
 
 %= partial :views, locals: { list: list, mode: mode } %
 
+% if params[:no_threads] %
+div class=alert alert-info
+  There were no threads that started this month, showing you all messages 
instead.
+/div
+% end %
+
 table class=table table-condensed table-hover ag-message-table
   tr
 th class=ag-message-table-subjectSubject/th



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: 416dec280acb094e40338fe6198b682e71659ba8
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 23:59:59 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 23:59:59 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=416dec28

Limit pages shown in pagination

---
 views/pagination.erb | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/views/pagination.erb b/views/pagination.erb
index 7d7be9c..9b85ec9 100644
--- a/views/pagination.erb
+++ b/views/pagination.erb
@@ -12,9 +12,15 @@
   /a
 % end %
 /li
-% (1..max_pages).each do |page| %
+% min = [1, current_page - 5].max ; max = [max_pages, current_page + 
5].min %
+% if min  10 %
+  lia href=11/a/li
+% end %
+% (min..max).each do |page| %
 li % if page == current_page %%= 'class=active' %% end %a 
href=%= page %%= page %/a/li
 % end %
+% if (max_pages - max)  10 %
+lia href=%= max_pages %%= max_pages %/a/li
 % if current_page == max_pages %
 li class=disabled
   a href=# aria-label=Next



[gentoo-commits] proj/ag-web:master commit in: views/, public/css/

2015-02-22 Thread Alex Legler
commit: 99121ff1198b8e5b7ceafa3be36249d398008f85
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 11:17:18 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 11:17:18 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=99121ff1

Responsiveness fix #4: Message tables

---
 public/css/main.css | 32 +---
 views/listmonth.erb | 26 ++
 2 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/public/css/main.css b/public/css/main.css
index 67488de..bd52860 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -5,24 +5,26 @@
   display: block;
 }
 
-.ag-message-table {
-  width: 100%;
-  table-layout: fixed;
-}
+@media (min-width: 768px) {
+  .ag-message-table {
+width: 100%;
+table-layout: fixed;
+  }
 
-.ag-message-table td {
-  text-overflow: ellipsis;
-  max-height: 1.2em;
-  overflow: hidden;
-  white-space: nowrap;
-}
+  .ag-message-table td {
+text-overflow: ellipsis;
+max-height: 1.2em;
+overflow: hidden;
+white-space: nowrap;
+  }
 
-.ag-message-table-date {
-  width: 22%;
-}
+  .ag-message-table-date {
+width: 22%;
+  }
 
-.ag-message-table-from {
-  width: 18%;
+  .ag-message-table-from {
+width: 18%;
+  }
 }
 
 .ag-quote {

diff --git a/views/listmonth.erb b/views/listmonth.erb
index a986eb8..485df49 100644
--- a/views/listmonth.erb
+++ b/views/listmonth.erb
@@ -12,19 +12,21 @@
 /div
 % end %
 
-table class=table table-condensed table-hover ag-message-table
-  tr
-th class=ag-message-table-subjectSubject/th
-th class=ag-message-table-fromFrom/th
-th class=ag-message-table-dateDate/th
-  /tr
-  % results['hits']['hits'].each do |message| %
+div class=table-responsive
+  table class=table table-condensed table-hover ag-message-table
 tr
-  tda href=../../message/%= message['_id'] %%= h 
message['_source']['subject'] %/a/td
-  td%= h message['_source']['from_realname'] %/td
-  td%= date_format message['_source']['date'] %/td
+  th class=ag-message-table-subjectSubject/th
+  th class=ag-message-table-fromFrom/th
+  th class=ag-message-table-dateDate/th
 /tr
-  % end %
-/table
+% results['hits']['hits'].each do |message| %
+  tr
+tda href=../../message/%= message['_id'] %%= h 
message['_source']['subject'] %/a/td
+td%= h message['_source']['from_realname'] %/td
+td%= date_format message['_source']['date'] %/td
+  /tr
+% end %
+  /table
+/div
 
 %= partial :pagination, locals: { current_page: current_page, max_pages: 
max_pages } %
\ No newline at end of file



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-22 Thread Alex Legler
commit: 852fca3a0175ad0f22d99ec69534a1d358081afb
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 11:02:27 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 11:02:27 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=852fca3a

Responsiveness fixes for the headers table

---
 views/message.erb | 69 +--
 1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/views/message.erb b/views/message.erb
index d9c1c66..74525ca 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -1,38 +1,41 @@
 h1 class=first-headerGentoo Archives: %= list %/h1
 
-table class=table table-condensed ag-header-table
-  tr
-th class=ag-header-name-colFrom:/th
-td colspan=3%= h strip_email_domain(message['_source']['from']) 
%/td
-  /tr
-  tr
-thTo:/th
-td colspan=3%= h strip_email_domain(message['_source']['to']) %/td
-  /tr
-  % unless message['_source']['cc'] == nil or message['_source']['cc'] == '' 
%
-  tr
-thCc:/th
-td colspan=3%= h strip_email_domain(message['_source']['cc']) %/td
-  /tr
-  % end %
-  tr
-thSubject:/th
-td colspan=3strong%= h message['_source']['subject'] 
%/strong/td
-  /tr
-  tr
-thDate:/th
-td%= date_format message['_source']['date'] %/td
-th class=ag-header-msgid-colMessage-Id:/th
-td%= message['_source']['raw_message_id'] %/td
-  /tr
-  % unless parent == nil %
-  tr
-thIn Reply to:/th
-td colspan=3a href=%= parent['_id'] %%= 
parent['_source']['subject'] %/a by %= parent['_source']['from'] %/td
-  /tr
-  % end %
-/table
-!-- Message-Id: %= message['_source']['raw_message_id'] % --
+div class=table-responsive
+  table class=table table-condensed ag-header-table
+tr
+  th class=ag-header-name-colFrom:/th
+  td%= h strip_email_domain(message['_source']['from']) %/td
+/tr
+tr
+  thTo:/th
+  td%= h strip_email_domain(message['_source']['to']) %/td
+/tr
+% unless message['_source']['cc'] == nil or message['_source']['cc'] == 
'' %
+tr
+  thCc:/th
+  td%= h strip_email_domain(message['_source']['cc']) %/td
+/tr
+% end %
+tr
+  thSubject:/th
+  tdstrong%= h message['_source']['subject'] %/strong/td
+/tr
+tr
+  thDate:/th
+  td%= date_format message['_source']['date'] %/td
+/tr
+tr
+  thMessage-Id:/th
+  tdtt%= h message['_source']['raw_message_id'] %/tt/td
+/tr
+% unless parent == nil %
+tr
+  thIn Reply to:/th
+  td colspan=3a href=%= parent['_id'] %%= 
parent['_source']['subject'] %/a by %= parent['_source']['from'] %/td
+/tr
+% end %
+  /table
+/div
 
 pre class=ag-message-content
 %= linkize(strip_email(message['_source']['content'])) %



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-22 Thread Alex Legler
commit: 60aca1405d6471a0026a74abaadc7ae23ed7a028
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 11:05:33 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 11:05:33 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=60aca140

Repsonsivness fix 2: Undo the button group

---
 views/message.erb | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/views/message.erb b/views/message.erb
index 74525ca..b1b4fee 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -75,8 +75,6 @@
 /table
 % end %
 
-div class=btn-group btn-group-xs role=group aria-label=Message Actions
-  a href=/%= h list %/report/%= message['_id'] % class=btn 
btn-dangerspan class=fa fa-fw fa-ban/span Report Message/a
-  a href=%= msgid_to_gmane(message['_source']['raw_message_id']) % 
class=btn btn-defaultspan class=fa fa-fw fa-share-square/spanFind on 
GMANE/a
-  a href=%= msgid_to_marc(message['_source']['raw_message_id']) % 
class=btn btn-defaultspan class=fa fa-fw fa-share-square/spanFind on 
MARC/a
-/div
+a href=/%= h list %/report/%= message['_id'] % class=btn btn-danger 
btn-xsspan class=fa fa-fw fa-ban/span Report Message/a
+a href=%= msgid_to_gmane(message['_source']['raw_message_id']) % 
class=btn btn-default btn-xsspan class=fa fa-fw 
fa-share-square/spanFind on GMANE/a
+a href=%= msgid_to_marc(message['_source']['raw_message_id']) % 
class=btn btn-default btn-xsspan class=fa fa-fw 
fa-share-square/spanFind on MARC/a
\ No newline at end of file



[gentoo-commits] proj/ag-web:master commit in: lib/, views/

2015-02-22 Thread Alex Legler
commit: 72b8c84b55e84a0f5287b417d256db4d10aec095
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 11:29:49 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 11:29:49 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=72b8c84b

Fix mail count

---
 lib/index.rb|  9 +
 views/index.erb | 21 +++--
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/lib/index.rb b/lib/index.rb
index a50ba4c..5690afe 100644
--- a/lib/index.rb
+++ b/lib/index.rb
@@ -73,6 +73,15 @@ def get_month_listing(list)
   )
 end
 
+def get_message_count(list)
+  $es.search(
+index: 'ml-' + list,
+size: 1,
+body: {}
+  )['hits']['total']
+rescue = e
+  '?'
+end
 
 def get_message(list, hash)
   $es.search(

diff --git a/views/index.erb b/views/index.erb
index 77eda4c..d1454ea 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -6,7 +6,11 @@
   div class=col-xs-12 col-md-6
 div class=list-group
   % $config['active_lists'].each do |list| %
-  a href=%= h list %/ class=list-group-itemspan class=fa fa-fw 
fa-archive/span %= h list %/a
+a href=%= h list %/ class=list-group-item
+  span class=fa fa-fw fa-archive/span
+  %= h list %
+  span class=badge%= get_message_count(list) %/span
+/a
   % end %
 /div
   /div
@@ -24,15 +28,12 @@
 div class=row
   div class=col-xs-12 col-md-6
 div class=list-group
-  % $config['frozen_lists'].each do |list| 
-  begin
-  months = get_month_listing(list)
-  count = months['hits']['total'] + ' mails'
-  rescue = e
-  count = 'mail count unavailable'
-  end 
-  %
-  a href=%= h list %/ class=list-group-itemspan class=fa fa-fw 
fa-archive/span %= h list % (%= count %)/a
+  % $config['frozen_lists'].each do |list| %
+a href=%= h list %/ class=list-group-item
+  span class=fa fa-fw fa-archive/span
+  %= h list %
+  span class=badge%= get_message_count(list) %/span
+/a
   % end %
 /div
   /div



[gentoo-commits] proj/ag-web:master commit in: /, views/, lib/

2015-02-22 Thread Alex Legler
commit: f93dd2d194eaa5b9b23715edf6b71ecb5001d839
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 14:44:19 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 14:44:19 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=f93dd2d1

Cache message counts

---
 ag-web.rb   |  3 +++
 lib/cache.rb| 35 +++
 lib/index.rb|  2 +-
 views/index.erb |  4 ++--
 4 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/ag-web.rb b/ag-web.rb
index ef326c8..8855dd7 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -13,6 +13,7 @@ require 'pony'
 
 require_relative 'lib/index.rb'
 require_relative 'lib/helpers.rb'
+require_relative 'lib/cache.rb'
 
 configure do
   set :partial_template_engine, :erb
@@ -24,6 +25,8 @@ $es.transport.reload_connections!
 
 $config = YAML.load_file('config.yml')
 
+MessageCountCache.instance.update!
+
 get '/:list/report/:msgid' do
   return unless list_check
 

diff --git a/lib/cache.rb b/lib/cache.rb
new file mode 100644
index 000..c2968d1
--- /dev/null
+++ b/lib/cache.rb
@@ -0,0 +1,35 @@
+require 'date'
+
+class MessageCountCache
+  include Singleton
+  CACHE_SECONDS = 3600
+
+  def initialize
+update!
+  end
+
+  def update!
+@message_counts ||= {}
+
+@new_counts = {}
+[$config['active_lists'], $config['frozen_lists']].flatten.each do |list|
+  @new_counts[list] = get_message_count_internal(list)
+end
+
+@message_counts = @new_counts
+@load_date = DateTime.now
+  end
+
+  def [](list)
+update?
+
+@message_counts[list]
+  end
+
+  private
+  def update?
+if ((DateTime.now - @load_date) * 60 * 60 * 24).to_i  CACHE_SECONDS
+  update!
+end
+  end
+end
\ No newline at end of file

diff --git a/lib/index.rb b/lib/index.rb
index 5690afe..de3d4f0 100644
--- a/lib/index.rb
+++ b/lib/index.rb
@@ -73,7 +73,7 @@ def get_month_listing(list)
   )
 end
 
-def get_message_count(list)
+def get_message_count_internal(list)
   $es.search(
 index: 'ml-' + list,
 size: 1,

diff --git a/views/index.erb b/views/index.erb
index d1454ea..c2cee2c 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -9,7 +9,7 @@
 a href=%= h list %/ class=list-group-item
   span class=fa fa-fw fa-archive/span
   %= h list %
-  span class=badge%= get_message_count(list) %/span
+  span class=badge%= MessageCountCache.instance[list] %/span
 /a
   % end %
 /div
@@ -32,7 +32,7 @@
 a href=%= h list %/ class=list-group-item
   span class=fa fa-fw fa-archive/span
   %= h list %
-  span class=badge%= get_message_count(list) %/span
+  span class=badge%= MessageCountCache.instance[list] %/span
 /a
   % end %
 /div



[gentoo-commits] proj/ag-web:master commit in: public/css/, views/

2015-02-22 Thread Alex Legler
commit: 20e4eafc838f3cb68850e9e903a2eee2b78107f6
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 11:10:58 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 11:10:58 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=20e4eafc

Responsiveness fix #3: Finally nice buttons

---
 public/css/main.css |  5 ++---
 views/message.erb   | 54 ++---
 2 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/public/css/main.css b/public/css/main.css
index f04d4f3..67488de 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -53,9 +53,8 @@
   width: 10em;
 }
 
-.ag-header-msgid-col {
-  width: 10em;
-  border-left: 1px solid #ddd;
+.ag-message-actions {
+  line-height: 2em;
 }
 
 .ag-pager {

diff --git a/views/message.erb b/views/message.erb
index b1b4fee..78823c2 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -44,37 +44,45 @@
 % if message['_source']['attachments'] and not 
message['_source']['attachments'].empty? %
 h3Attachments/h3
 
-table class=table table-condensed ag-attachment-table
-  tr
-thFile name/th
-thMIME type/th
-  /tr
-  % message['_source']['attachments'].each do |attachment| %
+div class=table-responsive
+  table class=table table-condensed ag-attachment-table
 tr
-  td%= h attachment['filename'] %/td
-  td%= h attachment['mime'] %/td
+  thFile name/th
+  thMIME type/th
 /tr
-  % end %
-/table
+% message['_source']['attachments'].each do |attachment| %
+  tr
+td%= h attachment['filename'] %/td
+td%= h attachment['mime'] %/td
+  /tr
+% end %
+  /table
+/div
 % end %
 
 % unless children == nil %
 h3Replies/h3
 
-table class=table table-condensed ag-replies-table
-  tr
-thSubject/th
-thAuthor/th
-  /tr
-  % children.each do |child| %
+div class=table-responsive
+  table class=table table-condensed ag-replies-table
 tr
-  tda href=%= child['_id'] %%= h child['_source']['subject'] 
%/a/td
-  td%= h strip_email_domain(child['_source']['from']) %/td
+  thSubject/th
+  thAuthor/th
 /tr
-  % end %
-/table
+% children.each do |child| %
+  tr
+tda href=%= child['_id'] %%= h child['_source']['subject'] 
%/a/td
+td%= h strip_email_domain(child['_source']['from']) %/td
+  /tr
+% end %
+  /table
+/div
 % end %
 
-a href=/%= h list %/report/%= message['_id'] % class=btn btn-danger 
btn-xsspan class=fa fa-fw fa-ban/span Report Message/a
-a href=%= msgid_to_gmane(message['_source']['raw_message_id']) % 
class=btn btn-default btn-xsspan class=fa fa-fw 
fa-share-square/spanFind on GMANE/a
-a href=%= msgid_to_marc(message['_source']['raw_message_id']) % 
class=btn btn-default btn-xsspan class=fa fa-fw 
fa-share-square/spanFind on MARC/a
\ No newline at end of file
+div class=ag-message-actions
+  a href=/%= h list %/report/%= message['_id'] % class=btn btn-danger 
btn-xsspan class=fa fa-fw fa-ban/span Report Message/a
+  div class=btn-group btn-group-xs
+a href=%= msgid_to_gmane(message['_source']['raw_message_id']) % 
class=btn btn-defaultspan class=fa fa-fw fa-share-square/spanFind on 
GMANE/a
+a href=%= msgid_to_marc(message['_source']['raw_message_id']) % 
class=btn btn-defaultspan class=fa fa-fw fa-share-square/spanFind on 
MARC/a
+  /div
+/div
\ No newline at end of file



[gentoo-commits] proj/ag:master commit in: lib/, /

2015-02-23 Thread Alex Legler
commit: 2a13f18aa0a7ac3fe7d19eeea45842de818a615c
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 14:21:27 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 14:21:27 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=2a13f18a

use more threads!

---
 Gemfile  |  4 +++-
 Gemfile.lock |  4 
 ag   | 12 +---
 lib/storage.rb   | 10 +-
 lib/threading.rb |  4 +++-
 5 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/Gemfile b/Gemfile
index 6689dd1..c676b7c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,4 +4,6 @@ gem 'mail'
 gem 'maildir'
 gem 'elasticsearch'
 gem 'sanitize'
-gem 'charlock_holmes'
\ No newline at end of file
+gem 'charlock_holmes'
+gem 'parallel'
+gem 'ruby-progressbar'
\ No newline at end of file

diff --git a/Gemfile.lock b/Gemfile.lock
index ca40918..d2e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -24,6 +24,8 @@ GEM
   mini_portile (~ 0.6.0)
 nokogumbo (1.2.0)
   nokogiri
+parallel (1.4.0)
+ruby-progressbar (1.7.1)
 sanitize (3.1.1)
   crass (~ 1.0.1)
   nokogiri (= 1.4.4)
@@ -37,4 +39,6 @@ DEPENDENCIES
   elasticsearch
   mail
   maildir
+  parallel
+  ruby-progressbar
   sanitize

diff --git a/ag b/ag
index dbb1584..ca81b22 100755
--- a/ag
+++ b/ag
@@ -7,6 +7,8 @@ require 'mail'
 require 'maildir'
 require 'elasticsearch'
 require 'optparse'
+require 'parallel'
+require 'ruby-progressbar'
 require_relative 'lib/utils'
 require_relative 'lib/threading'
 require_relative 'lib/rendering'
@@ -111,7 +113,9 @@ $es.transport.reload_connections!
 def do_full
   Ag::Storage.create_index($options.name)
 
-  $maildir.list(:cur).each do |maildir_message|
+  messages = $maildir.list(:cur)
+
+  Parallel.each(messages, progress: Importing #{$options.name}) do 
|maildir_message|
 mail = maildir_message.data
 
 begin
@@ -126,14 +130,16 @@ def do_full
 end
 
 def do_incremental
-  $maildir.list(:new).each do |maildir_message|
+  messages = $maildir.list(:cur)
+
+  Parallel.each(messages, progress: Importing #{$options.name}) do 
|maildir_message|
 mail = maildir_message.data
 
 begin
   Ag::Storage.store($options.name, mail, maildir_message.filename)
   maildir_message.process unless $options.readonly
 rescue = e
-  $stderr.puts Cannot save message #{mail.message_id} (file 
#{maildir_message.filename}): #{e.message}
+  $stderr.puts Cannot save message #{mail.message_id} (file 
#{maildir_message.filename}): #{e.message} if $options.debug
   next
 end
   end

diff --git a/lib/storage.rb b/lib/storage.rb
index f255633..d32ba2b 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -7,7 +7,7 @@ module Ag::Storage
 begin
   $es.indices.delete index: 'ml-' + list
 rescue Elasticsearch::Transport::Transport::Errors::NotFound = e
-  $stderr.puts Index did not exist yet. Creating.
+  $stderr.puts Index did not exist yet. Creating. if $options.debug
 end
 
 $es.indices.create(
@@ -84,10 +84,10 @@ module Ag::Storage
   content = Ag::Utils.fix_encoding(raw_content || '', true).strip
 
   if content == ''
-$stderr.puts #{message.message_id}: Content empty?
+$stderr.puts #{message.message_id}: Content empty? if $options.debug
   end
 rescue = e
-  $stderr.puts Cannot render message #{message.message_id} (file: 
#{filename}): #{e}
+  $stderr.puts Cannot render message #{message.message_id} (file: 
#{filename}): #{e} if $options.debug
 end
 
 content
@@ -174,7 +174,7 @@ module Ag::Storage
 )
   end
 
-  def fix_threading(list)
+  def fix_threading(list, pass)
 result = $es.search(
   index: 'ml-' + list,
   size: 10,
@@ -201,7 +201,7 @@ module Ag::Storage
   }
 )
 
-result['hits']['hits'].each do |hit|
+Parallel.each(result['hits']['hits'], progress: Calculating Threading 
(Pass #{pass})) do |hit|
   msg = resolve_message_id(list, hit['_source']['raw_parent'])
 
   unless msg == nil

diff --git a/lib/threading.rb b/lib/threading.rb
index 8988f23..212bb98 100644
--- a/lib/threading.rb
+++ b/lib/threading.rb
@@ -57,11 +57,13 @@ module Ag
 
 def calc(list)
   number_of_root_threads = -1
+  pass = 1
   loop do
-new_num = Ag::Storage.fix_threading(list)
+new_num = Ag::Storage.fix_threading(list, pass)
 
 break if new_num == number_of_root_threads
 number_of_root_threads = new_num
+pass += 1
   end
 end
   end



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-23 Thread Alex Legler
commit: bbc8b2a61544af2859276cf8badb53ca3b1244c5
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 20:56:21 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 20:56:21 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=bbc8b2a6

Test (hopefully) faster encoding fix method

---
 lib/utils.rb | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/utils.rb b/lib/utils.rb
index aaa04c7..fc4427e 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -2,8 +2,15 @@ require 'charlock_holmes'
 
 module Ag
   module Utils
+
 module_function
-def fix_encoding(str, fail_hard = false)
+def fix_encoding(str)
+  s = str.encode('UTF-8', 'UTF-8', invalid: :replace, replace: '')
+  s = s.unpack('C*').pack('U*') unless s.valid_encoding?
+  s
+end
+
+def fix_encoding_old(str, fail_hard = false)
   detection = CharlockHolmes::EncodingDetector.detect(str)
   CharlockHolmes::Converter.convert(str, detection[:encoding], 'UTF-8')
 rescue = e



[gentoo-commits] proj/ag:master commit in: /

2015-02-23 Thread Alex Legler
commit: c85644c7e9931d0b872bd1c8768aeb08cb237961
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 15:08:08 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 15:08:08 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=c85644c7

Don't store the flags in raw_filename.

---
 ag | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ag b/ag
index ca81b22..083b9ee 100755
--- a/ag
+++ b/ag
@@ -119,7 +119,7 @@ def do_full
 mail = maildir_message.data
 
 begin
-  Ag::Storage.store($options.name, mail, maildir_message.filename)
+  Ag::Storage.store($options.name, mail, maildir_message.unique_name)
 rescue = e
   $stderr.puts Cannot save message #{mail.message_id}: #{e.message}
   next
@@ -136,7 +136,7 @@ def do_incremental
 mail = maildir_message.data
 
 begin
-  Ag::Storage.store($options.name, mail, maildir_message.filename)
+  Ag::Storage.store($options.name, mail, maildir_message.unique_name)
   maildir_message.process unless $options.readonly
 rescue = e
   $stderr.puts Cannot save message #{mail.message_id} (file 
#{maildir_message.filename}): #{e.message} if $options.debug



[gentoo-commits] proj/ag:master commit in: /

2015-02-23 Thread Alex Legler
commit: 06f782971261539ee316ad59ac4937b19a4ec22a
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 21:05:08 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 21:05:08 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=06f78297

hello linux

---
 ag | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ag b/ag
index bcb1ac6..d36acc4 100755
--- a/ag
+++ b/ag
@@ -1,7 +1,9 @@
-#!/usr/bin/env ruby -W0
+#!/usr/bin/env ruby
 # Ag -- archiving all the 'golden' flamewars on -dev
 # Alex Legler a...@gentoo.org
 
+VERBOSE=nil
+
 require 'bundler/setup'
 require 'mail'
 require 'maildir'



[gentoo-commits] proj/ag:master commit in: /, lib/

2015-02-23 Thread Alex Legler
commit: 88d9781c469e27ca77901a05326f598821715b33
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 20:58:05 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 20:58:05 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=88d9781c

Only occupy 3/4 of the processors

---
 ag | 6 +++---
 lib/storage.rb | 6 +++---
 lib/utils.rb   | 8 
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ag b/ag
index 73c189b..bcb1ac6 100755
--- a/ag
+++ b/ag
@@ -115,13 +115,13 @@ def do_full
 
   messages = $maildir.list(:cur)
 
-  Parallel.each(messages, progress: Importing #{$options.name}) do 
|maildir_message|
+  Parallel.each(messages, in_processes: Ag::Utils.proc_count, progress: 
Importing #{$options.name}) do |maildir_message|
 mail = maildir_message.data
 
 begin
   Ag::Storage.store($options.name, mail, maildir_message.unique_name)
 rescue = e
-  $stderr.puts Cannot save message #{mail.message_id}: #{e.message}
+  $stderr.puts Cannot save message #{mail.message_id}: (#{e.class}) 
#{e.message} if $options.debug
   next
 end
   end
@@ -132,7 +132,7 @@ end
 def do_incremental
   messages = $maildir.list(:cur)
 
-  Parallel.each(messages, progress: Importing #{$options.name}) do 
|maildir_message|
+  Parallel.each(messages, in_processes: Ag::Utils.proc_count, progress: 
Importing #{$options.name}) do |maildir_message|
 mail = maildir_message.data
 
 begin

diff --git a/lib/storage.rb b/lib/storage.rb
index 6409df2..5b360f5 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -201,9 +201,9 @@ module Ag::Storage
   def fix_threading(list, pass)
 result = $es.search(
   index: 'ml-' + list,
-  size: 10,
+  size: 5000,
   body: {
-size: 10,
+size: 5000,
 query: {
   filtered: {
 filter: {
@@ -225,7 +225,7 @@ module Ag::Storage
   }
 )
 
-Parallel.each(result['hits']['hits'], progress: Calculating Threading 
(Pass #{pass})) do |hit|
+Parallel.each(result['hits']['hits'], in_processes: Ag::Utils.proc_count, 
progress: Calculating Threading (Pass #{pass})) do |hit|
   msg = resolve_message_id(list, hit['_source']['raw_parent'])
 
   unless msg == nil

diff --git a/lib/utils.rb b/lib/utils.rb
index d621a2e..0213c6d 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -1,5 +1,9 @@
 require 'charlock_holmes'
 
+module Parallel::ProcessorCount
+  module_function :processor_count
+end
+
 module Ag
   module Utils
 
@@ -62,5 +66,9 @@ module Ag
 rescue ArgumentError
   ''
 end
+
+def proc_count
+  (Parallel::ProcessorCount.processor_count.to_f * 0.75).floor
+end
   end
 end
\ No newline at end of file



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-23 Thread Alex Legler
commit: d38a68108d6224c7d5e8fd97fcdfe26ef0e0cf8c
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 20:57:35 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 20:57:35 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=d38a6810

More robust header parsing (again hopefully)

---
 lib/storage.rb | 54 +++---
 lib/utils.rb   | 29 +
 2 files changed, 68 insertions(+), 15 deletions(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index d32ba2b..6409df2 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -28,6 +28,18 @@ module Ag::Storage
   }
 }
   },
+  received: {
+properties: {
+  hop: {
+type: 'string',
+index: 'not_analyzed'
+  },
+  date: {
+type: 'date',
+format: 'dateOptionalTime'
+  }
+}
+  },
   cc: {
 type: 'string'
   },
@@ -81,7 +93,7 @@ module Ag::Storage
 content = 'Cannot parse MIME/contents.'
 begin
   raw_content = Ag::Rendering::HTMLizer.HTMLize(message)
-  content = Ag::Utils.fix_encoding(raw_content || '', true).strip
+  content = Ag::Utils.fix_encoding(raw_content || '').strip
 
   if content == ''
 $stderr.puts #{message.message_id}: Content empty? if $options.debug
@@ -125,24 +137,35 @@ module Ag::Storage
   def store(list, message, filename)
 content = get_content(message, filename)
 
-identifier = message['X-Archives-Hash'].value
+identifier = nil
+begin
+  identifier = message['X-Archives-Hash'].value
+rescue NoMethodError
+  raise 'No archives hash'
+end
+
 raw_parent = Ag::Threading.get_parent_message_id(message)
 
-from = Ag::Utils.fix_encoding(message[:from].formatted.first)
-from_realname = from.gsub(/(.*)/, '').strip
+from = Ag::Utils.resolve_address_header(message, :from).first
+from_realname = Ag::Utils.get_sender_displayname(message)
+to = Ag::Utils.resolve_address_header(message, :to)
+cc = Ag::Utils.resolve_address_header(message, :cc)
+subject = Ag::Utils.fix_encoding(message.subject)
 
-to = ''
-if message[:to]
-  to = Ag::Utils.fix_encoding(message[:to].formatted.join(','))
-end
+date = [message.received].flatten.first.field.date_time
 
-cc = ''
-if message[:cc]
-  cc = Ag::Utils.fix_encoding(message[:cc].formatted.join(','))
+received = []
+[message.received].flatten.each do |hop|
+  begin
+received  {
+  hop: hop.field.info,
+  date: hop.field.date_time
+}
+  rescue = e
+next
+  end
 end
 
-subject = Ag::Utils.fix_encoding(message.subject)
-
 attachments = []
 if message.has_attachments?
   message.attachments.each do |attachment|
@@ -164,10 +187,11 @@ module Ag::Storage
 cc: cc,
 from: from,
 from_realname: from_realname,
-date: message.date,
-month: (%i%02i % [message.date.year, message.date.month]).to_i, # 
this is a sortable number!
+date: date,
+month: (%i%02i % [date.year, date.month]).to_i, # this is a sortable 
number!
 content: content,
 attachments: attachments,
+received: received,
 raw_parent: raw_parent,
 raw_filename: filename
   }

diff --git a/lib/utils.rb b/lib/utils.rb
index fc4427e..d621a2e 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -33,5 +33,34 @@ module Ag
 
   id
 end
+
+def resolve_address_header(message, header)
+  if message[header].is_a? Mail::StructuredField
+# Good header, properly parsed
+message[header].addrs.map {|s| fix_encoding(s.to_s)}
+  elsif nil == message[header]
+# Header not set, return empty
+[]
+  else
+# Parsing failed, do best-effort parsing
+[message[header].to_s.split(/,\s*/)].flatten.map {|s| fix_encoding(s)}
+  end
+rescue ArgumentError
+  []
+end
+
+def get_sender_displayname(message)
+  if message[:from].is_a? Mail::StructuredField
+fix_encoding(message[:from].addrs.first.to_s).strip
+  else
+if message[:from].respond_to? :addrs and display_name = 
message[:from].addrs.first.display_name
+  fix_encoding(display_name).strip
+else
+  fix_encoding(message[:from].to_s).strip
+end
+  end
+rescue ArgumentError
+  ''
+end
   end
 end
\ No newline at end of file



[gentoo-commits] proj/ag:master commit in: /

2015-02-23 Thread Alex Legler
commit: 273cd900db7c24be76a0f1cee96a522b145c7908
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 20:57:45 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 20:57:45 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=273cd900

Silence encoding warnings

---
 ag | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ag b/ag
index 083b9ee..73c189b 100755
--- a/ag
+++ b/ag
@@ -1,4 +1,4 @@
-#!/usr/bin/env ruby
+#!/usr/bin/env ruby -W0
 # Ag -- archiving all the 'golden' flamewars on -dev
 # Alex Legler a...@gentoo.org
 



[gentoo-commits] proj/ag-web:master commit in: lib/

2015-02-23 Thread Alex Legler
commit: 2371c90f4f0d72eb9db29502599b78d9d2d0b0c4
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 20:58:25 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 20:58:25 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=2371c90f

All dates are UTC now, strip timezone

---
 lib/helpers.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 88b8f59..525dd93 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -22,7 +22,7 @@ helpers do
   end
 
   def date_format(date)
-DateTime.iso8601(date).rfc2822
+DateTime.iso8601(date).strftime('%a, %d %b %Y %T')
   end
 
   def to_monthint(year, month)



[gentoo-commits] proj/ag-web:master commit in: public/css/, views/, lib/

2015-02-23 Thread Alex Legler
commit: 496ba5a82637b8f023846f53d6c219d3e18259ad
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 20:58:52 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 20:58:52 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=496ba5a8

Various UI bit fixes for new storage format

---
 lib/helpers.rb  | 26 +-
 public/css/main.css |  7 +--
 views/layout.erb|  3 ++-
 views/listmonth.erb |  2 +-
 views/message.erb   | 10 +-
 views/report.erb|  6 +++---
 6 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 525dd93..5b4d2e3 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -42,8 +42,9 @@ helpers do
 ERB::Util::url_encode(text)
   end
 
-  def strip_email_domain(str)
-str.split(/,\s*/).map do |email|
+  # This method strips domains from header fields.
+  def strip_email_headers(ary)
+[ary].flatten.map do |email|
   email.gsub(/@(.*?)(|$)/) do |s|
 if $1 == 'gentoo.org'
   @g.o#{$2}
@@ -53,21 +54,20 @@ helpers do
   @#{'×' * $1.length}#{$2}
 end
   end
-end.join(', ')
+end
   end
 
+  # This method is meant to strip emails from free text, not header fields
   def strip_email(str)
-str.split(/,\s*/).map do |email|
-  email.gsub(/([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+)\.([a-zA-Z]{2,10})/) do 
|s|
-if $2 == 'gentoo' and $3 == 'org'
-  #{$1}@g.o
-elsif $2 == 'lists.gentoo' and $3 == 'org'
-  #{$1}@l.g.o
-else
-  #{$1}@#{'×' * $2.length}.#{$3}
-end
+str.gsub(/([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+)\.([a-zA-Z]{2,10})/) do |s|
+  if $2 == 'gentoo' and $3 == 'org'
+#{$1}@g.o
+  elsif $2 == 'lists.gentoo' and $3 == 'org'
+#{$1}@l.g.o
+  else
+#{$1}@#{'×' * $2.length}.#{$3}
   end
-end.join(', ')
+end
   end
 
   def linkize(str)

diff --git a/public/css/main.css b/public/css/main.css
index c6ffc94..449d356 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -21,11 +21,11 @@
   }
 
   .ag-message-table-date {
-width: 22%;
+width: 18%;
   }
 
   .ag-message-table-from {
-width: 18%;
+width: 22%;
   }
 
   .ag-mostrecent-table-author {
@@ -91,4 +91,7 @@
 
 .ag-view-selection {
   margin-bottom: .5em;
+}
+
+.ag-date {
 }
\ No newline at end of file

diff --git a/views/layout.erb b/views/layout.erb
index 67a7e8b..e3bb34c 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -93,7 +93,8 @@
 div class=row
   div class=col-xs-12 col-md-offset-2 col-md-7
 p class=spacer
-  All contents reflect the opinion of the author, not the Gentoo 
project or the Gentoo Foundation.
+  All times displayed are UTC (GMT+0).br
+  Contents reflect the opinion of the author, not the Gentoo 
project or the Gentoo Foundation.
 /p
   /div
   div class=col-xs-12 col-md-3

diff --git a/views/listmonth.erb b/views/listmonth.erb
index 485df49..76a2244 100644
--- a/views/listmonth.erb
+++ b/views/listmonth.erb
@@ -23,7 +23,7 @@
   tr
 tda href=../../message/%= message['_id'] %%= h 
message['_source']['subject'] %/a/td
 td%= h message['_source']['from_realname'] %/td
-td%= date_format message['_source']['date'] %/td
+tdspan class=ag-date%= date_format message['_source']['date'] 
%/span/td
   /tr
 % end %
   /table

diff --git a/views/message.erb b/views/message.erb
index 78823c2..ee700fd 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -4,16 +4,16 @@
   table class=table table-condensed ag-header-table
 tr
   th class=ag-header-name-colFrom:/th
-  td%= h strip_email_domain(message['_source']['from']) %/td
+  td%= h strip_email_headers(message['_source']['from']).first %/td
 /tr
 tr
   thTo:/th
-  td%= h strip_email_domain(message['_source']['to']) %/td
+  td%= h strip_email_headers(message['_source']['to']).join ', ' %/td
 /tr
-% unless message['_source']['cc'] == nil or message['_source']['cc'] == 
'' %
+% unless message['_source']['cc'] == nil or message['_source']['cc'] == 
[] %
 tr
   thCc:/th
-  td%= h strip_email_domain(message['_source']['cc']) %/td
+  td%= h strip_email_headers(message['_source']['cc']).join ', ' %/td
 /tr
 % end %
 tr
@@ -72,7 +72,7 @@
 % children.each do |child| %
   tr
 tda href=%= child['_id'] %%= h child['_source']['subject'] 
%/a/td
-td%= h strip_email_domain(child['_source']['from']) %/td
+td%= h strip_email_headers(child['_source']['from']).first %/td
   /tr
 % end %
   /table

diff --git a/views/report.erb b/views/report.erb
index 559dc23..13a8cf4 100644
--- a/views/report.erb
+++ b/views/report.erb
@@ -11,15 +11,15 @@
   /tr
   tr
 th class=ag-header-name-colFrom:/th
-td%= h

[gentoo-commits] proj/ag-web:master commit in: lib/

2015-02-25 Thread Alex Legler
commit: 38ac05111cba0a13ab89228b17094da936f7c5ef
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 14:19:41 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 14:19:41 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=38ac0511

Display TLD in escaped header fields

---
 lib/helpers.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 987caeb..873d50f 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -51,7 +51,8 @@ helpers do
 elsif $1 == 'lists.gentoo.org'
   @l.g.o#{$2}
 else
-  @#{'×' * $1.length}#{$2}
+  domain, dot, tld = $1.rpartition '.'
+  @#{'×' * domain.length}.#{tld}#{$2}
 end
   end
 end



[gentoo-commits] proj/ag-web:master commit in: public/js/

2015-02-25 Thread Alex Legler
commit: ddd4204478a4ae7399dbc259238d49938dc78d95
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 14:21:07 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 14:21:07 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=ddd42044

Don't show the toggle button on XS devices

---
 public/js/quoting.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/public/js/quoting.js b/public/js/quoting.js
index edf8ec0..84be70f 100644
--- a/public/js/quoting.js
+++ b/public/js/quoting.js
@@ -9,7 +9,7 @@ $(function() {
 return;
   }
 
-  var btn = $(button class=\btn btn-xs btn-default ag-toggle-quotes\span 
class=\fa fa-quote-left\/span Toggle quotes/button);
+  var btn = $(button class=\btn btn-xs btn-default hidden-xs 
ag-toggle-quotes\span class=\fa fa-quote-left\/span Toggle 
quotes/button);
   btn.insertAfter(table);
   btn.click(function() {
 $('.ag-quote').each(function(index) {



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-25 Thread Alex Legler
commit: 8e0d92ff895ff71d20e40743ac9349f33f3c553b
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 21:44:15 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 21:44:15 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=8e0d92ff

site_notice

---
 views/index.erb | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/views/index.erb b/views/index.erb
index 0ca71c9..b5d2908 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -1,5 +1,11 @@
 h1 class=first-headerGentoo Mailing List Archives/h1
 
+% if $config['site_notice'] %
+div class=alert alert-info
+%= $config['site_notice'] %
+/div
+% end %
+
 p class=lead
   Here you can find the archives of our most important mailing lists.
 /p



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-25 Thread Alex Legler
commit: d0df386eb94e95a11e8bdc0d5a2d9e22a9919443
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 21:44:06 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 21:44:06 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=d0df386e

basic description

---
 views/layout.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/layout.erb b/views/layout.erb
index e3bb34c..9a25690 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -5,7 +5,7 @@
 meta charset=utf-8
 meta name=viewport content=width=device-width, initial-scale=1.0
 meta name=theme-color content=#54487a
-meta name=description content=
+meta name=description content=The Gentoo Mailing List Archives
 link 
href=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/bootstrap.min.css;
 rel=stylesheet media=screen
 link 
href=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/tyrian.min.css;
 rel=stylesheet media=screen
 link href=/css/main.css rel=stylesheet media=screen



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: 2199b57209ccc37b0dc0a9ed4f42e68bd244e567
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:03:07 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:03:07 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=2199b572

less pages, add ... item

---
 views/pagination.erb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/views/pagination.erb b/views/pagination.erb
index 5b1b3c5..68d1a6b 100644
--- a/views/pagination.erb
+++ b/views/pagination.erb
@@ -12,14 +12,16 @@
   /a
 % end %
 /li
-% min = [1, current_page - 5].max ; max = [max_pages, current_page + 
5].min %
+% min = [1, current_page - 3].max ; max = [max_pages, current_page + 
3].min %
 % if min  10 %
   lia href=11/a/li
+  li class=disableda href=#…/a/li
 % end %
 % (min..max).each do |page| %
 li % if page == current_page %%= 'class=active' %% end %a 
href=%= page %%= page %/a/li
 % end %
 % if (max_pages - max)  10 %
+li class=disableda href=#…/a/li
 lia href=%= max_pages %%= max_pages %/a/li
 % end %
 % if current_page == max_pages %



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: 6a5810db065cdc99c10c13e263ccdfd16f4e2471
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:01:22 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:01:22 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=6a5810db

erb fix

---
 views/pagination.erb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/views/pagination.erb b/views/pagination.erb
index 9b85ec9..5b1b3c5 100644
--- a/views/pagination.erb
+++ b/views/pagination.erb
@@ -21,6 +21,7 @@
 % end %
 % if (max_pages - max)  10 %
 lia href=%= max_pages %%= max_pages %/a/li
+% end %
 % if current_page == max_pages %
 li class=disabled
   a href=# aria-label=Next



[gentoo-commits] proj/ag-web:master commit in: public/css/, views/

2015-02-21 Thread Alex Legler
commit: 47d4d4fa804e4062898edbcb84bd4ff327af4da6
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:19:27 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:19:46 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=47d4d4fa

add a little border

---
 public/css/main.css | 5 +
 views/message.erb   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/public/css/main.css b/public/css/main.css
index 2827892..f04d4f3 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -53,6 +53,11 @@
   width: 10em;
 }
 
+.ag-header-msgid-col {
+  width: 10em;
+  border-left: 1px solid #ddd;
+}
+
 .ag-pager {
   margin: 0;
 }

diff --git a/views/message.erb b/views/message.erb
index 7c5be12..d9c1c66 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -22,7 +22,7 @@
   tr
 thDate:/th
 td%= date_format message['_source']['date'] %/td
-th class=ag-header-name-colMessage-Id:/th
+th class=ag-header-msgid-colMessage-Id:/th
 td%= message['_source']['raw_message_id'] %/td
   /tr
   % unless parent == nil %



[gentoo-commits] proj/ag:master commit in: lib/, /

2015-02-21 Thread Alex Legler
commit: 3fe02ff3df0f83234e0d4b05ce1d268e2cadc235
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 22:37:18 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 22:37:18 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=3fe02ff3

Show more filenames when rendering fails

---
 ag |  4 ++--
 lib/storage.rb | 14 +++---
 lib/utils.rb   | 10 +++---
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/ag b/ag
index 4b857e3..be04609 100755
--- a/ag
+++ b/ag
@@ -109,7 +109,7 @@ def do_full
 mail = maildir_message.data
 
 begin
-  Ag::Storage.store($options.name, mail)
+  Ag::Storage.store($options.name, mail, maildir_message.filename)
 rescue = e
   $stderr.puts Cannot save message #{mail.message_id}: #{e.message}
   next
@@ -124,7 +124,7 @@ def do_incremental
 mail = maildir_message.data
 
 begin
-  Ag::Storage.store($options.name, mail)
+  Ag::Storage.store($options.name, mail, maildir_message.filename)
   maildir_message.process unless $options.readonly
 rescue = e
   $stderr.puts Cannot save message #{mail.message_id} (file 
#{maildir_message.filename}): #{e.message}

diff --git a/lib/storage.rb b/lib/storage.rb
index da9e8ad..fdf70b6 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -73,17 +73,17 @@ module Ag::Storage
 sleep 1
   end
 
-  def get_content(message)
-content = Cannot parse MIME/contents.
+  def get_content(message, filename)
+content = 'Cannot parse MIME/contents.'
 begin
   raw_content = Ag::Rendering::HTMLizer.HTMLize(message)
-  content = Ag::Utils.fix_encoding(raw_content || '').strip
+  content = Ag::Utils.fix_encoding(raw_content || '', true).strip
 
   if content == ''
-$stderr.puts #{message.message_id}: Content empty
+$stderr.puts #{message.message_id}: Content empty?
   end
-rescue
-  $stderr.puts #{message.message_id}: Invalid encoding
+rescue = e
+  $stderr.puts Cannot render message #{message.message_id} (file: 
#{filename}): #{e}
 end
 
 content
@@ -111,7 +111,7 @@ module Ag::Storage
 result['hits']['hits'].first['_id']
   end
 
-  def store(list, message)
+  def store(list, message, filename)
 content = get_content(message)
 
 identifier = message['X-Archives-Hash'].value

diff --git a/lib/utils.rb b/lib/utils.rb
index 109a6a5..3714614 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -3,12 +3,16 @@ require 'charlock_holmes'
 module Ag
   module Utils
 module_function
-def fix_encoding(str)
+def fix_encoding(str, fail_hard = false)
   detection = CharlockHolmes::EncodingDetector.detect(str)
   CharlockHolmes::Converter.convert(str, detection[:encoding], 'UTF-8')
 rescue = e
-  $stderr.puts e.message if $options.debug
-  'Encoding could not be reliably detected. Message contents not 
available.'
+  if fail_hard
+raise e
+  else
+$stderr.puts e.message if $options.debug
+'Encoding could not be reliably detected. Contents not available.'
+  end
 end
   end
 end
\ No newline at end of file



[gentoo-commits] proj/ag-web:master commit in: /

2015-02-21 Thread Alex Legler
commit: fd64b3e0ee9c92ea18e77190ff6d9bf0e404572c
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:48:28 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:48:28 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=fd64b3e0

and a slash

---
 ag-web.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ag-web.rb b/ag-web.rb
index 63d194f..ef326c8 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -107,7 +107,7 @@ get '/:list/threads/:year-:month/:page?' do
 max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil
 
 if result['hits']['total'] == 0
-  redirect /%s/messages/%s-%s?no_threads=1 % [params[:list], 
params[:year], params[:month]]
+  redirect /%s/messages/%s-%s/?no_threads=1 % [params[:list], 
params[:year], params[:month]]
   return
 end
 



[gentoo-commits] proj/ag:master commit in: /

2015-02-21 Thread Alex Legler
commit: 3dba5ecae440817434b182e5f0148016db826634
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 21:57:39 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 21:57:58 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=3dba5eca

Print filename for failed files

---
 ag | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ag b/ag
index 7b6d662..4b857e3 100755
--- a/ag
+++ b/ag
@@ -127,7 +127,7 @@ def do_incremental
   Ag::Storage.store($options.name, mail)
   maildir_message.process unless $options.readonly
 rescue = e
-  $stderr.puts Cannot save message #{mail.message_id}: #{e.message}
+  $stderr.puts Cannot save message #{mail.message_id} (file 
#{maildir_message.filename}): #{e.message}
   next
 end
   end



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: 34977bb3ac3da7c95bf8acb8148a788419adc9f8
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 23:56:57 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 23:56:57 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=34977bb3

Style message action buttons

---
 views/message.erb | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/views/message.erb b/views/message.erb
index 789e2d1..c3ee987 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -72,7 +72,7 @@
 /table
 % end %
 
-a href=/%= h list %/report/%= message['_id'] % class=btn btn-danger 
btn-xsspan class=fa fa-ban/span Report Message/a
-
-a href=http://news.gmane.org/find-root.php?message_id=%= 
u(message['_source']['raw_message_id']) % class=btn btn-xsspan 
class=fa/spanFind on GMANE/a
-
+div class=btn-group btn-group-xs role=group aria-label=Message Actions
+  a href=/%= h list %/report/%= message['_id'] % class=btn 
btn-dangerspan class=fa fa-fw fa-ban/span Report Message/a
+  a href=http://news.gmane.org/find-root.php?message_id=%= 
u(message['_source']['raw_message_id']) % class=btn btn-defaultspan 
class=fa fa-fw fa-share-square/spanFind on GMANE/a
+/div
\ No newline at end of file



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: b4349612cb3a0481d66645c1f60dad81e89f607e
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:15:37 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:15:37 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=b4349612

CC nil?

---
 views/message.erb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/views/message.erb b/views/message.erb
index b0f32a8..181f532 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -9,10 +9,12 @@
 thTo:/th
 td colspan=3%= h strip_email_domain(message['_source']['to']) %/td
   /tr
+  % unless message['_source']['cc'] == nil or message['_source']['cc'] == '' 
%
   tr
 thCc:/th
 td colspan=3%= h strip_email_domain(message['_source']['cc']) %/td
   /tr
+  % end %
   tr
 thSubject:/th
 td colspan=3strong%= h message['_source']['subject'] 
%/strong/td



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: b8a7be58d4285a54798a946acd48df547fabc7cf
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:13:52 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:13:52 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=b8a7be58

compact the headers table a bit

---
 views/message.erb | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/views/message.erb b/views/message.erb
index c3ee987..b0f32a8 100644
--- a/views/message.erb
+++ b/views/message.erb
@@ -3,34 +3,32 @@
 table class=table table-condensed ag-header-table
   tr
 th class=ag-header-name-colFrom:/th
-td%= h strip_email_domain(message['_source']['from']) %/td
+td colspan=3%= h strip_email_domain(message['_source']['from']) 
%/td
   /tr
   tr
 thTo:/th
-td%= h strip_email_domain(message['_source']['to']) %/td
+td colspan=3%= h strip_email_domain(message['_source']['to']) %/td
   /tr
   tr
 thCc:/th
-td%= h strip_email_domain(message['_source']['cc']) %/td
+td colspan=3%= h strip_email_domain(message['_source']['cc']) %/td
   /tr
   tr
 thSubject:/th
-tdstrong%= h message['_source']['subject'] %/strong/td
+td colspan=3strong%= h message['_source']['subject'] 
%/strong/td
   /tr
   tr
 thDate:/th
 td%= date_format message['_source']['date'] %/td
+th class=ag-header-name-colMessage-Id:/th
+td%= message['_source']['raw_message_id'] %/td
   /tr
   % unless parent == nil %
   tr
 thIn Reply to:/th
-tda href=%= parent['_id'] %%= parent['_source']['subject'] %/a 
by %= parent['_source']['from'] %/td
+td colspan=3a href=%= parent['_id'] %%= 
parent['_source']['subject'] %/a by %= parent['_source']['from'] %/td
   /tr
   % end %
-  tr
-thMessage-Id:/th
-td%= message['_source']['raw_message_id'] %/td
-  /tr
 /table
 !-- Message-Id: %= message['_source']['raw_message_id'] % --
 



[gentoo-commits] proj/ag-web:master commit in: /

2015-02-21 Thread Alex Legler
commit: 8aaf89df9fbe64113864059d45c0c36a29d3b77b
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:30:40 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:30:40 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=8aaf89df

less redirection magic

---
 ag-web.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ag-web.rb b/ag-web.rb
index 182d269..63d194f 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -107,7 +107,7 @@ get '/:list/threads/:year-:month/:page?' do
 max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil
 
 if result['hits']['total'] == 0
-  redirect to(/%s/messages/%s-%s?no_threads=1 % [params[:list], 
params[:year], params[:month]])
+  redirect /%s/messages/%s-%s?no_threads=1 % [params[:list], 
params[:year], params[:month]]
   return
 end
 



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-21 Thread Alex Legler
commit: 62e98a914e6110b50f1c88a5af1a23d3c0f6fcd6
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 00:04:16 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 00:04:16 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=62e98a91

more pagination tuning

---
 views/pagination.erb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/views/pagination.erb b/views/pagination.erb
index 68d1a6b..af43309 100644
--- a/views/pagination.erb
+++ b/views/pagination.erb
@@ -13,14 +13,14 @@
 % end %
 /li
 % min = [1, current_page - 3].max ; max = [max_pages, current_page + 
3].min %
-% if min  10 %
+% if min  3 %
   lia href=11/a/li
   li class=disableda href=#…/a/li
 % end %
 % (min..max).each do |page| %
 li % if page == current_page %%= 'class=active' %% end %a 
href=%= page %%= page %/a/li
 % end %
-% if (max_pages - max)  10 %
+% if (max_pages - max)  3 %
 li class=disableda href=#…/a/li
 lia href=%= max_pages %%= max_pages %/a/li
 % end %



[gentoo-commits] proj/ag-web:master commit in: lib/, public/css/, views/, /

2015-02-22 Thread Alex Legler
commit: b0086f9f9cb9be97d0cf2715330f57075ea843c0
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 20:06:43 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 20:06:43 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=b0086f9f

Move full archives list to a separate page

---
 ag-web.rb  |  6 +
 lib/helpers.rb |  1 -
 lib/index.rb   | 20 ++
 public/css/main.css| 16 ++-
 views/index.erb| 60 +-
 views/indexentry.erb   | 32 ++
 views/layout.erb   | 15 ---
 views/{index.erb = lists.erb} |  0
 8 files changed, 102 insertions(+), 48 deletions(-)

diff --git a/ag-web.rb b/ag-web.rb
index 8855dd7..071246d 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -161,6 +161,12 @@ get '/:list/message/:msgid' do
   end
 end
 
+get '/lists' do
+  @nav = :lists
+  erb :lists
+end
+
 get '/' do
+  @nav = :index
   erb :index
 end

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 405975b..88b8f59 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -1,4 +1,3 @@
-require 'date'
 require 'rinku'
 require 'erb'
 

diff --git a/lib/index.rb b/lib/index.rb
index de3d4f0..3cc7537 100644
--- a/lib/index.rb
+++ b/lib/index.rb
@@ -24,6 +24,26 @@ def threads_in_month(list, year, month, page)
   )
 end
 
+def most_recent(list, n)
+  result = $es.search(
+index: 'ml-' + list,
+size: n,
+body: {
+  sort: {
+date: 'desc',
+  }
+}
+  )
+
+  if result['hits']['total'] == 0
+return []
+  else
+return result['hits']['hits']
+  end
+rescue = e
+  []
+end
+
 def messages_in_month(list, year, month, page)
   $es.search(
 index: 'ml-' + list,

diff --git a/public/css/main.css b/public/css/main.css
index bd52860..38d482b 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -6,11 +6,13 @@
 }
 
 @media (min-width: 768px) {
-  .ag-message-table {
+  .ag-message-table,
+  .ag-mostrecent-table {
 width: 100%;
 table-layout: fixed;
   }
 
+  .ag-mostrecent-table td,
   .ag-message-table td {
 text-overflow: ellipsis;
 max-height: 1.2em;
@@ -25,6 +27,18 @@
   .ag-message-table-from {
 width: 18%;
   }
+
+  .ag-mostrecent-table-author {
+width: 30%;
+  }
+
+  .ag-mostrecent-header {
+margin-top: 5px;
+  }
+
+  .ag-index-actions {
+margin-top: 2em;
+  }
 }
 
 .ag-quote {

diff --git a/views/index.erb b/views/index.erb
index c2cee2c..0ca71c9 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -1,47 +1,23 @@
 h1 class=first-headerGentoo Mailing List Archives/h1
 
-h2Current Mailing Lists/h2
+p class=lead
+  Here you can find the archives of our most important mailing lists.
+/p
+p
+  For a complete list of available archives, see the a href=/lists 
class=btn btn-primary btn-xsi class=fa fa-fw fa-archive/i All 
Archives/a section.
+/p
 
-div class=row
-  div class=col-xs-12 col-md-6
-div class=list-group
-  % $config['active_lists'].each do |list| %
-a href=%= h list %/ class=list-group-item
-  span class=fa fa-fw fa-archive/span
-  %= h list %
-  span class=badge%= MessageCountCache.instance[list] %/span
-/a
-  % end %
-/div
-  /div
-  div class=col-xs-12 col-md-6
-div class=alert alert-info role=alert
-  strongHow to Participate/strongbr
-  Please see our a href=https://www.gentoo.org/main/en/lists.xml; 
class=alert-linkMailing List information page/a for more information on
-  how you can subscribe and participate in the discussions.
-/div
-  /div
-/div
+hr
 
-h2Frozen Archives/h2
+%= partial :indexentry, locals: { list: 'gentoo-dev', blurb: 
'ttgentoo-dev/tt is the main technical development mailing list of Gentoo.' 
} %
+%= partial :indexentry, locals: { list: 'gentoo-project', blurb: 
'ttgentoo-project/tt contains non-technical discussion and propositions for 
the Gentoo Council .' } %
+%= partial :indexentry, locals: { list: 'gentoo-announce', blurb: 'Important 
news for all Gentoo stakeholders.' } %
+%= partial :indexentry, locals: { list: 'gentoo-user', blurb: 'Our main 
support and Gentoo-related talk mailing list, ttgentoo-user/tt.' } %
+%= partial :indexentry, locals: { list: 'gentoo-commits', blurb: 'Commits. 
Lots of commits.' } %
+%= partial :indexentry, locals: { list: 'gentoo-dev-announce', blurb: 
'ttgentoo-dev-announce/tt conveys  important changes to all developers and 
interested users.' } %
 
-div class=row
-  div class=col-xs-12 col-md-6
-div class=list-group
-  % $config['frozen_lists'].each do |list| %
-a href=%= h list %/ class=list-group-item
-  span class=fa fa-fw fa-archive/span
-  %= h list %
-  span class=badge%= MessageCountCache.instance[list] %/span
-/a
-  % end %
-/div
-  /div
-  div class=col-xs-12 col-md-6
-div class=alert alert-warning

[gentoo-commits] proj/ag:master commit in: lib/

2015-02-22 Thread Alex Legler
commit: 5b1feb7c720a04b5409a2da76fb6b95b6ee83955
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 23:01:10 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 23:01:10 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=5b1feb7c

Save message filename in the index

---
 lib/storage.rb | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index fdf70b6..f4e55b6 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -55,6 +55,10 @@ module Ag::Storage
 type: 'string',
 index: 'not_analyzed'
   },
+  raw_filename: {
+type: 'string',
+index: 'not_analyzed'
+  },
   raw_parent: {
 type: 'string'
   },
@@ -157,7 +161,8 @@ module Ag::Storage
 month: (%i%02i % [message.date.year, message.date.month]).to_i, # 
this is a sortable number!
 content: content,
 attachments: attachments,
-raw_parent: raw_parent
+raw_parent: raw_parent,
+raw_filename: filename
   }
 )
   end



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-22 Thread Alex Legler
commit: 215091d5d1abeb9c38540eb0bb569851a3de1ba6
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 23:50:38 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 23:50:38 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=215091d5

Refactor id resolving method to a more generic function

---
 lib/storage.rb | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index 660b300..37083fa 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -93,8 +93,8 @@ module Ag::Storage
 content
   end
 
-  def resolve_message_id(list, message_id = nil)
-return nil if message_id == nil
+  def resolve_by_field(list, field, value)
+return nil if value == nil
 
 result = $es.search(
   index: 'ml-' + list,
@@ -102,7 +102,7 @@ module Ag::Storage
 query: {
   filtered: {
 filter: {
-  term: { raw_message_id: message_id }
+  term: { field = value }
 }
   }
 },
@@ -111,10 +111,17 @@ module Ag::Storage
 )
 
 return nil if result['hits']['total'] == 0
-
 result['hits']['hits'].first['_id']
   end
 
+  def resolve_message_id(list, message_id = nil)
+resolve_by_field(list, :raw_message_id, message_id)
+  end
+
+  def resolve_filename(list, filename)
+resolve_by_field(list, :raw_filename, filename)
+  end
+
   def store(list, message, filename)
 content = get_content(message, filename)
 



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-22 Thread Alex Legler
commit: 95040b1680f96e5391902de301cf07f3c2c6d571
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 23:50:12 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 23:50:12 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=95040b16

Fix get_content invocation for new error messages

---
 lib/storage.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index 6bbb527..660b300 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -116,7 +116,7 @@ module Ag::Storage
   end
 
   def store(list, message, filename)
-content = get_content(message)
+content = get_content(message, filename)
 
 identifier = message['X-Archives-Hash'].value
 raw_parent = Ag::Threading.get_parent_message_id(message)



[gentoo-commits] proj/ag-web:master commit in: /, views/

2015-02-22 Thread Alex Legler
commit: 43d37380314a9066b1e20255bf152b8d0ca6fc5b
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 00:11:38 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 00:11:38 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=43d37380

Redirect back to the main list page if there are no messages at all in a given 
month

---
 ag-web.rb   | 5 +
 views/listindex.erb | 6 ++
 2 files changed, 11 insertions(+)

diff --git a/ag-web.rb b/ag-web.rb
index 071246d..fd11ba4 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -130,6 +130,11 @@ get '/:list/messages/:year-:month/:page?' do
 result = messages_in_month(params[:list], params[:year], params[:month], 
current_page)
 max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil
 
+if result['hits']['total'] == 0
+  redirect /%s/?no_messages=1 % params[:list]
+  return
+end
+
 erb :listmonth, locals: { results: result, list: params[:list], 
current_page: current_page, max_pages: max_pages, mode: :messages }
   rescue = e
 $stderr.puts e.to_s

diff --git a/views/listindex.erb b/views/listindex.erb
index ecf6ab7..30a0a17 100644
--- a/views/listindex.erb
+++ b/views/listindex.erb
@@ -1,5 +1,11 @@
 h1 class=first-headerGentoo Archives: %= list %/h1
 
+% if params[:no_messages] %
+div class=alert alert-warning
+  There are no messages in the archive for the requested month.
+/div
+% end %
+
 table class=table
   tr
 thMonth/th



[gentoo-commits] proj/ag-web:master commit in: public/css/

2015-02-22 Thread Alex Legler
commit: e604862d7bd2486399a5a786c96e93dca7734fcf
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 00:23:10 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 00:23:10 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=e604862d

Try some styling fixes for HTML messages

---
 public/css/main.css | 8 
 1 file changed, 8 insertions(+)

diff --git a/public/css/main.css b/public/css/main.css
index 38d482b..c6ffc94 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -65,6 +65,14 @@
   clear: both;
 }
 
+.ag-message-content pre {
+  border: none;
+}
+
+.ag-message-content blockquote {
+  font-size: inherit;
+}
+
 .ag-header-name-col {
   width: 10em;
 }



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-22 Thread Alex Legler
commit: 2ebbd8d3908a6095aa4a1049b8c3e02b4ca979a6
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 23:11:34 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 23:11:34 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=2ebbd8d3

also rename parameter name

---
 lib/storage.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index b4873d8..6bbb527 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -93,8 +93,8 @@ module Ag::Storage
 content
   end
 
-  def resolve_message_id(list, parent_message_id = nil)
-return nil if parent_message_id == nil
+  def resolve_message_id(list, message_id = nil)
+return nil if message_id == nil
 
 result = $es.search(
   index: 'ml-' + list,
@@ -102,7 +102,7 @@ module Ag::Storage
 query: {
   filtered: {
 filter: {
-  term: { raw_message_id: parent_message_id }
+  term: { raw_message_id: message_id }
 }
   }
 },



[gentoo-commits] proj/ag:master commit in: /, lib/

2015-02-22 Thread Alex Legler
commit: 3aeff5af03460eea82b31c493c6bfa635f80cf72
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 00:05:05 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 00:05:05 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=3aeff5af

Implement --info

---
 ag | 23 ++-
 lib/storage.rb | 18 ++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/ag b/ag
index be04609..29ee0f2 100755
--- a/ag
+++ b/ag
@@ -42,6 +42,12 @@ op = OptionParser.new do |opts|
 $options.action = :do_delete
   end
 
+  opts.on('--info', 'Display message details. Needs --file, --msgid, or 
--hash') do
+abort 'Can only select one action' if $options.action != nil
+
+$options.action = :do_info
+  end
+
   opts.on('--reindex', 'Reindex message. Needs --file') do
 abort 'Can only select one action' if $options.action != nil
 
@@ -144,7 +150,22 @@ def do_reindex
 end
 
 def do_info
-  abort 'Come back later.'
+  id = Ag::Utils.resolve_id
+
+  begin
+message = Ag::Storage.get($options.name, id)
+
+raise 'No such message' unless message
+
+require 'pp'
+str = Message #{id}
+$stderr.puts str
+$stderr.puts '-' * str.length
+
+pp message['_source']
+  rescue = e
+$stderr.puts Cannot display message: #{e}
+  end
 end
 
 ###

diff --git a/lib/storage.rb b/lib/storage.rb
index 37083fa..b4a518e 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -220,4 +220,22 @@ module Ag::Storage
 
 result['hits']['total']
   end
+  def get(list, id)
+result = $es.search(
+  index: 'ml-' + list,
+  size: 1,
+  body: {
+query: {
+  filtered: {
+filter: {
+  term: { _id: id }
+}
+  }
+}
+  }
+)
+
+return nil if result['hits']['total'] == 0
+result['hits']['hits'].first
+  end
 end
\ No newline at end of file



[gentoo-commits] proj/ag:master commit in: /, lib/

2015-02-22 Thread Alex Legler
commit: d3a8004768e26095748003e7932ea500b26eaa6a
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 00:05:20 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 00:05:20 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=d3a80047

Implement --delete

TODO: Actually delete the message

---
 ag | 8 +++-
 lib/storage.rb | 5 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ag b/ag
index 29ee0f2..dbb1584 100755
--- a/ag
+++ b/ag
@@ -142,7 +142,13 @@ def do_incremental
 end
 
 def do_delete
-  abort 'Come back later.'
+  id = Ag::Utils.resolve_id
+
+  begin
+Ag::Storage.delete($options.name, id)
+  rescue = e
+$stderr.puts Cannot delete message: #{e}
+  end
 end
 
 def do_reindex

diff --git a/lib/storage.rb b/lib/storage.rb
index b4a518e..f255633 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -220,6 +220,11 @@ module Ag::Storage
 
 result['hits']['total']
   end
+
+  def delete(list, id)
+$es.delete(index: 'ml-' + list, type: 'message', id: id)
+  end
+
   def get(list, id)
 result = $es.search(
   index: 'ml-' + list,



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-22 Thread Alex Legler
commit: ccfb2c3d3f4f78a21dd5f15a36450b89da8b8329
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 00:04:43 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 00:04:43 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=ccfb2c3d

Add id resolving helper

---
 lib/utils.rb | 12 
 1 file changed, 12 insertions(+)

diff --git a/lib/utils.rb b/lib/utils.rb
index 3714614..aaa04c7 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -14,5 +14,17 @@ module Ag
 'Encoding could not be reliably detected. Contents not available.'
   end
 end
+
+def resolve_id
+  id = $options.dir
+  case $options.argmode
+  when :msgid
+id = Ag::Storage.resolve_message_id($options.name, $options.dir)
+  when :file
+id = Ag::Storage.resolve_filename($options.name, $options.dir)
+  end
+
+  id
+end
   end
 end
\ No newline at end of file



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-22 Thread Alex Legler
commit: 38b11468dafd19db7793525152710ce824f24ccc
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sun Feb 22 23:05:43 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sun Feb 22 23:05:43 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=38b11468

Give message-id to hash function an appropriate name

---
 lib/storage.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index f4e55b6..b4873d8 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -93,7 +93,7 @@ module Ag::Storage
 content
   end
 
-  def get_parent_message(list, parent_message_id = nil)
+  def resolve_message_id(list, parent_message_id = nil)
 return nil if parent_message_id == nil
 
 result = $es.search(
@@ -195,7 +195,7 @@ module Ag::Storage
 )
 
 result['hits']['hits'].each do |hit|
-  msg = get_parent_message(list, hit['_source']['raw_parent'])
+  msg = resolve_message_id(list, hit['_source']['raw_parent'])
 
   unless msg == nil
 $es.update(



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-23 Thread Alex Legler
commit: d42179d8d444cc35698e06d2d7520e6f7b383f17
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 23:54:59 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 23:55:20 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=d42179d8

Fall back to charlock_holmes; also add stub encoding extraction from the 
message for later on

---
 lib/rendering.rb | 22 --
 lib/utils.rb |  4 ++--
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/lib/rendering.rb b/lib/rendering.rb
index 3e77414..7649fcf 100644
--- a/lib/rendering.rb
+++ b/lib/rendering.rb
@@ -8,33 +8,43 @@ module Ag::Rendering
 content_type = mime_split(mail.parts.first.content_type)
 
 if content_type == 'text/plain' or content_type == 'text/html'
-  to_content(content_type, mail.parts.first.decoded)
+  to_content(content_type, mail.parts.first.decoded, 
get_encoding(mail.parts.first))
 else
   # Nested multipart?
   if mail.parts.first.multipart?
 content_type = 
mime_split(mail.parts.first.parts.first.content_type)
 
 if content_type == 'text/plain' or content_type == 'text/html'
-  to_content(content_type, mail.parts.first.parts.first.decoded)
+  to_content(content_type, mail.parts.first.parts.first.decoded, 
get_encoding(mail.parts.first.parts.first))
 else
   raise Cannot find body: #{mail.message_id}
 end
   # Specialty: Gnus/Emacs signed emails with no explicit multipart type
   elsif mime_split(mail.content_type) == 'multipart/signed'
-to_content('text/plain', mail.parts.first.decoded)
+to_content('text/plain', mail.parts.first.decoded, 
get_encoding(mail.parts.first))
   end
 end
   else
 # No Content-Type, assume plain text (git-send-email)
 if mail.content_type == nil
-  to_content('text/plain', mail.body.decoded)
+  to_content('text/plain', mail.body.decoded, get_encoding(mail))
 else
-  to_content(mime_split(mail.content_type), mail.body.decoded)
+  to_content(mime_split(mail.content_type), mail.body.decoded, 
get_encoding(mail))
 end
   end
 end
 
-def self.to_content(content_type, content)
+def self.get_encoding(part)
+  if part.content_type_parameters
+part.content_type_parameters['charset']
+  else
+nil
+  end
+end
+
+def self.to_content(content_type, content, charset = nil)
+  #content = content.force_encoding(charset) if charset
+
   if content_type == 'text/plain'
 escaped_content = CGI::escapeHTML(content)
 escaped_content.lines.map do |line|

diff --git a/lib/utils.rb b/lib/utils.rb
index f8d546e..38349e0 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -8,13 +8,13 @@ module Ag
   module Utils
 
 module_function
-def fix_encoding(str)
+def fix_encoding2(str)
   s = str.encode('UTF-8', 'UTF-8', invalid: :replace, replace: '')
   s = s.unpack('C*').pack('U*') unless s.valid_encoding?
   s
 end
 
-def fix_encoding_old(str, fail_hard = false)
+def fix_encoding(str, fail_hard = false)
   detection = CharlockHolmes::EncodingDetector.detect(str)
   CharlockHolmes::Converter.convert(str, detection[:encoding], 'UTF-8')
 rescue = e



[gentoo-commits] proj/ag-web:master commit in: lib/

2015-02-23 Thread Alex Legler
commit: 52d5af6a47a6532575a3d3eef04bc4f7f3dbc7e4
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 23:43:57 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 23:43:57 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=52d5af6a

Better email escaping regex

---
 lib/helpers.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 5b4d2e3..6844e6d 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -45,7 +45,7 @@ helpers do
   # This method strips domains from header fields.
   def strip_email_headers(ary)
 [ary].flatten.map do |email|
-  email.gsub(/@(.*?)(|$)/) do |s|
+  email.gsub(/@(\S*?)(|$)/) do |s|
 if $1 == 'gentoo.org'
   @g.o#{$2}
 elsif $1 == 'lists.gentoo.org'



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-23 Thread Alex Legler
commit: 14cafac14c4d411591c846a0f8d5914fa9972414
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 23:53:59 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 23:53:59 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=14cafac1

Properly escape displaynames

---
 views/listmonth.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/listmonth.erb b/views/listmonth.erb
index 76a2244..9f137f0 100644
--- a/views/listmonth.erb
+++ b/views/listmonth.erb
@@ -22,7 +22,7 @@
 % results['hits']['hits'].each do |message| %
   tr
 tda href=../../message/%= message['_id'] %%= h 
message['_source']['subject'] %/a/td
-td%= h message['_source']['from_realname'] %/td
+td%= h 
strip_email_headers(message['_source']['from_realname']).first %/td
 tdspan class=ag-date%= date_format message['_source']['date'] 
%/span/td
   /tr
 % end %



[gentoo-commits] proj/ag:master commit in: /

2015-02-23 Thread Alex Legler
commit: 0420c776374c7b7bcc44533792de0ca977787819
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 23:54:13 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 23:55:20 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=0420c776

Properly shut up encoding errors

---
 ag | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ag b/ag
index 6574dca..c5056ff 100755
--- a/ag
+++ b/ag
@@ -2,7 +2,7 @@
 # Ag -- archiving all the 'golden' flamewars on -dev
 # Alex Legler a...@gentoo.org
 
-VERBOSE=nil
+$VERBOSE=nil
 
 require 'bundler/setup'
 require 'mail'



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-23 Thread Alex Legler
commit: c279eb2a9cf679731d643904c07d35bbc41d2dc7
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Mon Feb 23 23:54:34 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Mon Feb 23 23:55:20 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=c279eb2a

Fix displayname extraction

---
 lib/utils.rb | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/utils.rb b/lib/utils.rb
index b37437b..f8d546e 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -54,14 +54,10 @@ module Ag
 end
 
 def get_sender_displayname(message)
-  if message[:from].is_a? Mail::StructuredField
-fix_encoding(message[:from].addrs.first.to_s).strip
-  else
-if message[:from].respond_to? :addrs and display_name = 
message[:from].addrs.first.display_name
-  fix_encoding(display_name).strip
-else
-  fix_encoding(message[:from].to_s).strip
-end
+  begin
+fix_encoding(message[:from].addrs.first.display_name).strip
+  rescue NoMethodError
+fix_encoding(message[:from].to_s).strip
   end
 rescue ArgumentError
   ''



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-26 Thread Alex Legler
commit: 81b24a7edfad968f499ec025fe9e179a33eebd41
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Thu Feb 26 13:12:23 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Thu Feb 26 13:12:23 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=81b24a7e

Use protocol-relative URI for the favicon

Fixes bug 541424 by chithanh

---
 views/layout.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/layout.erb b/views/layout.erb
index 9a25690..fef26fa 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -9,7 +9,7 @@
 link 
href=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/bootstrap.min.css;
 rel=stylesheet media=screen
 link 
href=https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/tyrian.min.css;
 rel=stylesheet media=screen
 link href=/css/main.css rel=stylesheet media=screen
-link rel=icon href=http://www.gentoo.org/favicon.ico; 
type=image/x-icon
+link rel=icon href=//www.gentoo.org/favicon.ico type=image/x-icon
   /head
   body
 header



[gentoo-commits] proj/ag-web:master commit in: /

2015-02-21 Thread Alex Legler
commit: 7bc2d5aa2fe90fa41f17a7693aed647870f5f633
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 15:50:19 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 15:50:19 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=7bc2d5aa

Internal Server Error is 500, not 503

---
 ag-web.rb | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ag-web.rb b/ag-web.rb
index 850d1db..d07a18a 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -44,7 +44,7 @@ get '/:list/report/:msgid' do
 erb :report, locals: { message: result_data, list: params[:list] }
   rescue Exception = e
 $stderr.puts e.to_s
-status 503
+status 500
   end
 end
 
@@ -79,7 +79,7 @@ post '/report' do
 erb :reportsent, locals: { message: result_data, list: params[:list], msg: 
msg }
   rescue Exception = e
 $stderr.puts e.to_s
-status 503
+status 500
   end
 end
 
@@ -95,7 +95,7 @@ get '/:list/' do
 erb :listindex, locals: { results: result, list: params[:list], 
current_monthint: current_monthint }
   rescue = e
 $stderr.puts e.to_s
-status 503
+status 500
   end
 end
 
@@ -111,7 +111,7 @@ get '/:list/threads/:year-:month/:page?' do
 erb :listmonth, locals: { results: result, list: params[:list], 
current_page: current_page, max_pages: max_pages, mode: :threads }
   rescue = e
 $stderr.puts e.to_s
-status 503
+status 500
   end
 end
 
@@ -127,7 +127,7 @@ get '/:list/messages/:year-:month/:page?' do
 erb :listmonth, locals: { results: result, list: params[:list], 
current_page: current_page, max_pages: max_pages, mode: :messages }
   rescue = e
 $stderr.puts e.to_s
-status 503
+status 500
   end
 end
 
@@ -151,7 +151,7 @@ get '/:list/message/:msgid' do
 erb :message, locals: { message: result_data, list: params[:list], parent: 
parent_data, children: child_data }
   rescue Exception = e
 $stderr.puts e.to_s
-status 503
+status 500
   end
 end
 



[gentoo-commits] proj/ag-web:master commit in: lib/

2015-02-21 Thread Alex Legler
commit: 15851c4bc5430a7b0f7d6a8af3a8b0522d672b60
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 14:39:50 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 14:39:50 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=15851c4b

Fix syntax error on ruby 2.0

---
 lib/index.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/index.rb b/lib/index.rb
index b4ad2b7..a50ba4c 100644
--- a/lib/index.rb
+++ b/lib/index.rb
@@ -57,7 +57,7 @@ def get_month_listing(list)
 field: 'month',
 size: 0,
 order: {
-  'month2': 'desc'
+  month2: 'desc'
 }
   },
   aggs: {



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-21 Thread Alex Legler
commit: d9e1049bd00c469805779257343b049ff45ff0fe
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 21:35:37 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 21:35:37 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=d9e1049b

Sleep for a second after creating an index to hopefully fix timing issues

---
 lib/storage.rb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/storage.rb b/lib/storage.rb
index 9045a0b..da9e8ad 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -68,6 +68,9 @@ module Ag::Storage
   }
 }
   })
+
+# Give elasticsearch some time to process the new index
+sleep 1
   end
 
   def get_content(message)



[gentoo-commits] proj/ag:master commit in: /

2015-02-21 Thread Alex Legler
commit: a1b4b01141a6990c03007b69cb62e3c9ca93f245
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Sat Feb 21 18:57:21 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Sat Feb 21 18:57:21 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=a1b4b011

Allow 0-9 in list names

---
 ag | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ag b/ag
index c8371db..20fce8f 100755
--- a/ag
+++ b/ag
@@ -53,10 +53,10 @@ op = OptionParser.new do |opts|
   end
 
   opts.on('--list NAME', 'Name of the mailing list to work with') do |name|
-if name =~ /^[a-zA-Z-]+$/
+if name =~ /^[0-9a-zA-Z-]+$/
   $options.name = name
 else
-  abort 'List name can only consist of letters and hyphens.'
+  abort 'List name can only consist of letters, numbers and hyphens.'
 end
   end
 



[gentoo-commits] proj/ag:master commit in: lib/

2015-02-25 Thread Alex Legler
commit: ef30ac17210f8c5aeb9041faf1a4c34eaca5149e
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 10:31:03 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 10:31:03 2015 +
URL:http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=ef30ac17

tab fix

---
 lib/storage.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index fe50ea8..e8de874 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -247,7 +247,7 @@ module Ag::Storage
 opts = {
 :in_processes = Ag::Utils.proc_count,
 }
-   opts[:progress] = Calculating Threading (Pass #{pass}) if 
$options.progress
+opts[:progress] = Calculating Threading (Pass #{pass}) if 
$options.progress
 Parallel.each(result['hits']['hits'], opts) do |hit|
   msg = resolve_message_id(list, hit['_source']['raw_parent'])
 



[gentoo-commits] proj/ag-web:master commit in: views/

2015-02-25 Thread Alex Legler
commit: 77fb95e5f90138216f4a37fa545409695932711f
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 10:46:58 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 10:46:58 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=77fb95e5

Escape addresses on the front page

---
 views/indexentry.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/indexentry.erb b/views/indexentry.erb
index ba6a2cf..4c8edec 100644
--- a/views/indexentry.erb
+++ b/views/indexentry.erb
@@ -21,7 +21,7 @@
 % MostRecentMessagesCache.instance[list].each do |message| %
 tr
   tda href=/%= list %/message/%= message['_id'] %%= h 
message['_source']['subject'] %/a/td
-  td%= h message['_source']['from_realname'] %/td
+  td%= h 
strip_email_headers(message['_source']['from_realname']).first %/td
 /tr
 % end %
   /table



[gentoo-commits] proj/ag-web:master commit in: /, lib/, views/

2015-02-25 Thread Alex Legler
commit: 81bc7df02d522a4a43dd73fce4e95b4fec765296
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 10:44:29 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 10:44:29 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=81bc7df0

Cache most recent messages

---
 ag-web.rb|  1 +
 lib/cache.rb | 34 ++
 views/indexentry.erb |  2 +-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/ag-web.rb b/ag-web.rb
index fd11ba4..bdac32b 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -26,6 +26,7 @@ $es.transport.reload_connections!
 $config = YAML.load_file('config.yml')
 
 MessageCountCache.instance.update!
+MostRecentMessagesCache.instance.update!
 
 get '/:list/report/:msgid' do
   return unless list_check

diff --git a/lib/cache.rb b/lib/cache.rb
index c2968d1..f635114 100644
--- a/lib/cache.rb
+++ b/lib/cache.rb
@@ -32,4 +32,38 @@ class MessageCountCache
   update!
 end
   end
+end
+
+class MostRecentMessagesCache
+  include Singleton
+  CACHE_SECONDS=3600
+
+  def initialize
+update!
+  end
+
+  def update!
+@messages ||= {}
+
+@new_messages = {}
+[$config['active_lists'], $config['frozen_lists']].flatten.each do |list|
+  @new_messages[list] = most_recent(list, 5)
+end
+
+@messages = @new_messages
+@load_date = DateTime.now
+  end
+
+  def [](list)
+update?
+
+@messages[list] || []
+  end
+
+  private
+  def update?
+if ((DateTime.now - @load_date) * 60 * 60 * 24).to_i  CACHE_SECONDS
+  update!
+end
+  end
 end
\ No newline at end of file

diff --git a/views/indexentry.erb b/views/indexentry.erb
index 6028ec9..ba6a2cf 100644
--- a/views/indexentry.erb
+++ b/views/indexentry.erb
@@ -18,7 +18,7 @@
   thSubject/th
   th class=ag-mostrecent-table-authorAuthor/th
 /tr
-% most_recent(list, 5).each do |message| %
+% MostRecentMessagesCache.instance[list].each do |message| %
 tr
   tda href=/%= list %/message/%= message['_id'] %%= h 
message['_source']['subject'] %/a/td
   td%= h message['_source']['from_realname'] %/td



[gentoo-commits] proj/ag-web:master commit in: lib/

2015-02-25 Thread Alex Legler
commit: ca2e544c70ac653b65038a60cd0db49983bed0cc
Author: Alex Legler alex AT a3li DOT li
AuthorDate: Wed Feb 25 10:34:43 2015 +
Commit: Alex Legler a3li AT gentoo DOT org
CommitDate: Wed Feb 25 10:34:43 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=ca2e544c

Better email escape

---
 lib/helpers.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/helpers.rb b/lib/helpers.rb
index 6844e6d..987caeb 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -45,7 +45,7 @@ helpers do
   # This method strips domains from header fields.
   def strip_email_headers(ary)
 [ary].flatten.map do |email|
-  email.gsub(/@(\S*?)(|$)/) do |s|
+  email.gsub(/@(\S*?)('|||$)/) do |s|
 if $1 == 'gentoo.org'
   @g.o#{$2}
 elsif $1 == 'lists.gentoo.org'



  1   2   3   >