From c6aaba574fedb9884b1390d183ec734c6254bc6d Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 26 2016 12:59:49 +0000
Subject: [PATCH 1/34] Add a widget to list tickets on a fedorahosted.org trac instance


---

diff --git a/hubs/widgets/__init__.py b/hubs/widgets/__init__.py
index a365c3d..323aa70 100755
--- a/hubs/widgets/__init__.py
+++ b/hubs/widgets/__init__.py
@@ -15,6 +15,7 @@ from hubs.widgets import github_pr
 from hubs.widgets import pagureissues
 from hubs.widgets import githubissues
 from hubs.widgets import bugzilla
+from hubs.widgets import fhosted
 
 from hubs.widgets.workflow import pendingacls
 from hubs.widgets.workflow import updates2stable
@@ -39,6 +40,7 @@ registry = {
     'pagureissues': pagureissues,
     'githubissues': githubissues,
     'bugzilla': bugzilla,
+    'fedorahosted': fhosted,
 
     'workflow.pendingacls': pendingacls,
     'workflow.updates2stable': updates2stable,
diff --git a/hubs/widgets/fhosted.py b/hubs/widgets/fhosted.py
new file mode 100644
index 0000000..4f99f71
--- /dev/null
+++ b/hubs/widgets/fhosted.py
@@ -0,0 +1,56 @@
+from hubs.widgets.chrome import panel
+from hubs.hinting import hint, prefixed as _
+from hubs.widgets.base import argument
+from hubs.widgets import templating
+import hubs.validators as validators
+import requests
+
+chrome = panel("Fedorahosted: Open Tickets")
+template = templating.environment.get_template('templates/fedorahosted.html')
+position = 'right'
+
+from xmlrpclib import ServerProxy
+
+
+@argument(name="project",
+          default=None,
+          validator=validators.github_organization,
+          help="Name of the trac instance on fedorahosted.org")
+@argument(name="n_tickets",
+          default=4,
+          validator=validators.integer,
+          help="The number of tickets to display.")
+def data(session, widget, project, n_tickets=4):
+    n_tickets = int(n_tickets)
+    url = 'https://fedorahosted.org/%s/rpc' % project
+    filters = 'status=accepted&status=assigned&status=new&status=reopened'\
+        '&col=id&col=summary&col=status&col=owner&col=type&col=priority'\
+        '&col=milestone&col=changetime&order=changetime'
+    server = ServerProxy(url)
+    tickets = server.ticket.query(filters)
+    output = []
+    total_tickets = len(tickets)
+    for idx, ticket in enumerate(tickets):
+        ticket = server.ticket.get(ticket)
+        data = ticket[3]
+        data['id'] = ticket[0]
+        data['short_summary'] = data['summary'][:45]
+        output.append(data)
+        if idx + 1 >= n_tickets:
+            break
+
+    return dict(
+        project=project,
+        tickets=output,
+        total_tickets=total_tickets,
+    )
+
+
+@hint(topics=[_('trac.ticket.update'), _('trac.ticket.new')])
+def should_invalidate(message, session, widget):
+    project = widget.config.get('project', '')
+    url = 'https://fedorahosted.org/%s/' % project
+    if '.trac.ticket' in message['topic']:
+        if message['msg']['instance']['base_url'] == url:
+            return True
+    return False
diff --git a/hubs/widgets/templates/fedorahosted.html b/hubs/widgets/templates/fedorahosted.html
new file mode 100644
index 0000000..4908362
--- /dev/null
+++ b/hubs/widgets/templates/fedorahosted.html
@@ -0,0 +1,41 @@
+<a class="btn btn-success" target="_blank"
+    href="https://fedorahosted.org/{{ project }}/report/1">
+  All Issues
+</a>
+<hr/>
+
+<ul class="media-list">
+  {% for issue in tickets %}
+    <li class="media">
+      <div class="media-left">
+        <a  href="https://fedorahosted.org/{{ project }}/ticket/{{ issue['id'] }}"
+            target="_blank">
+          {{ project }}
+        <span class="label label-default">#{{ issue['id'] }}</span>
+        </a>
+      </div>
+      <div class="media-body">
+        <h4 class="media-heading">
+          <span title="{{ issue['summary'] }}">
+            {{ issue['short_summary'] }} {% if
+              issue['summary'] | length > 45 %} ... {% endif %}
+          </span>
+        </h4>
+        Opened by:
+            {{ issue['reporter'] }}
+        --
+        {% if issue['owner'] %}
+          Assigned to:
+            {{issue['owner'] }}
+        {% else %}
+          <span class="text-muted">Unassigned</span>
+        {% endif %}
+      </div>
+    </li>
+  {% endfor %}
+  {% if total_tickets > tickets | length %}
+  <li>
+    And {{ total_tickets - tickets | length }} more ...
+  </li>
+  {% endif %}
+</ul>

From 5e1c8fb716d79119f63946707807d4ed398d8512 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 26 2016 13:00:14 +0000
Subject: [PATCH 2/34] Small fix to ensure the number of meetings provided is a integer


---

diff --git a/hubs/widgets/meetings.py b/hubs/widgets/meetings.py
index 071496a..8c05744 100755
--- a/hubs/widgets/meetings.py
+++ b/hubs/widgets/meetings.py
@@ -69,6 +69,7 @@ position = 'both'
           validator=validators.integer,
           help="The number of meetings to display.")
 def data(session, widget, calendar, n_meetings=4):
+    n_meetings = int(n_meetings)
     base = 'https://apps.fedoraproject.org/calendar/api/meetings/?calendar=%s'
     url = base % calendar
     response = requests.get(url).json()

From 14e16f00448e90e243da64df7a81a5a9229ad4d7 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 26 2016 13:14:49 +0000
Subject: [PATCH 3/34] Drop the project name from the link


---

diff --git a/hubs/widgets/templates/fedorahosted.html b/hubs/widgets/templates/fedorahosted.html
index 4908362..7c855b9 100644
--- a/hubs/widgets/templates/fedorahosted.html
+++ b/hubs/widgets/templates/fedorahosted.html
@@ -10,7 +10,6 @@
       <div class="media-left">
         <a  href="https://fedorahosted.org/{{ project }}/ticket/{{ issue['id'] }}"
             target="_blank">
-          {{ project }}
         <span class="label label-default">#{{ issue['id'] }}</span>
         </a>
       </div>

From d18864c268d481d7089ddb8bb9bdd9ed9c3c0e8f Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 26 2016 13:14:59 +0000
Subject: [PATCH 4/34] Small fix to properly show the assignee of a PR in pagure


---

diff --git a/hubs/widgets/templates/pagure_pr.html b/hubs/widgets/templates/pagure_pr.html
index 5508cb7..94b2f23 100644
--- a/hubs/widgets/templates/pagure_pr.html
+++ b/hubs/widgets/templates/pagure_pr.html
@@ -25,7 +25,7 @@
           Assigned to:
           <a href="https://pagure.io/user/{{ pr['pr_assignee'] }}"
               target="_blank">
-            {{ pr['pr_assignee'] }}
+            {{ pr['pr_assignee']['name'] }}
           </a>
         {% else %}
           <span class="text-muted">Unassigned</span>

From b3049f8dfb1565e9e07276dd2a798d8374538cbd Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 26 2016 14:00:10 +0000
Subject: [PATCH 5/34] Show an error message upon error :)


---

diff --git a/hubs/widgets/fhosted.py b/hubs/widgets/fhosted.py
index 4f99f71..0c08928 100644
--- a/hubs/widgets/fhosted.py
+++ b/hubs/widgets/fhosted.py
@@ -26,8 +26,14 @@ def data(session, widget, project, n_tickets=4):
     filters = 'status=accepted&status=assigned&status=new&status=reopened'\
         '&col=id&col=summary&col=status&col=owner&col=type&col=priority'\
         '&col=milestone&col=changetime&order=changetime'
-    server = ServerProxy(url)
-    tickets = server.ticket.query(filters)
+    try:
+        server = ServerProxy(url)
+        tickets = server.ticket.query(filters)
+    except:
+        return dict(
+            error='Invalid or wrongly configured project'
+        )
+
     output = []
     total_tickets = len(tickets)
     for idx, ticket in enumerate(tickets):
diff --git a/hubs/widgets/templates/fedorahosted.html b/hubs/widgets/templates/fedorahosted.html
index 7c855b9..ad22b57 100644
--- a/hubs/widgets/templates/fedorahosted.html
+++ b/hubs/widgets/templates/fedorahosted.html
@@ -1,3 +1,6 @@
+{% if error %}
+<p>{{ error }}</p>
+{% else %}
 <a class="btn btn-success" target="_blank"
     href="https://fedorahosted.org/{{ project }}/report/1">
   All Issues
@@ -38,3 +41,4 @@
   </li>
   {% endif %}
 </ul>
+{% endif %}

From 770b3ad9da7edd0c62e348989ac09c514c0591ca Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 26 2016 14:09:46 +0000
Subject: [PATCH 6/34] Fix the validator used in the fedorahosted widget


---

diff --git a/hubs/validators.py b/hubs/validators.py
index 791f3fe..c0385d3 100755
--- a/hubs/validators.py
+++ b/hubs/validators.py
@@ -27,7 +27,7 @@ def username(session, value):
 
 def github_organization(session, value):
     # TODO -- implement this.
-    return True
+    return value
 
 
 def fmn_context(session, value):
@@ -39,3 +39,7 @@ def fmn_context(session, value):
 
 def pagure_repo(session, value):
     return value
+
+def fedorahosted_project(session, value):
+    # TODO -- implement this.
+    return value
diff --git a/hubs/widgets/fhosted.py b/hubs/widgets/fhosted.py
index 0c08928..6a54827 100644
--- a/hubs/widgets/fhosted.py
+++ b/hubs/widgets/fhosted.py
@@ -14,7 +14,7 @@ from xmlrpclib import ServerProxy
 
 @argument(name="project",
           default=None,
-          validator=validators.github_organization,
+          validator=validators.fedorahosted_project,
           help="Name of the trac instance on fedorahosted.org")
 @argument(name="n_tickets",
           default=4,

From dc7707ff3033bcb2ec321d164b51716a9513a269 Mon Sep 17 00:00:00 2001
From: Eric Barbour <emb4gu@virginia.edu>
Date: Jul 26 2016 15:13:59 +0000
Subject: [PATCH 7/34] Naive implementation of User Members widget


---

diff --git a/hubs/widgets/__init__.py b/hubs/widgets/__init__.py
index 323aa70..6423e3e 100755
--- a/hubs/widgets/__init__.py
+++ b/hubs/widgets/__init__.py
@@ -16,6 +16,7 @@ from hubs.widgets import pagureissues
 from hubs.widgets import githubissues
 from hubs.widgets import bugzilla
 from hubs.widgets import fhosted
+from hubs.widgets import memberships
 
 from hubs.widgets.workflow import pendingacls
 from hubs.widgets.workflow import updates2stable
@@ -41,6 +42,7 @@ registry = {
     'githubissues': githubissues,
     'bugzilla': bugzilla,
     'fedorahosted': fhosted,
+    'memberships': memberships,
 
     'workflow.pendingacls': pendingacls,
     'workflow.updates2stable': updates2stable,
diff --git a/hubs/widgets/memberships.py b/hubs/widgets/memberships.py
new file mode 100644
index 0000000..8389657
--- /dev/null
+++ b/hubs/widgets/memberships.py
@@ -0,0 +1,29 @@
+import hubs.models
+from hubs.hinting import hint, prefixed as _
+import hubs.validators as validators
+from hubs.widgets.base import argument
+from hubs.widgets.chrome import panel
+from hubs.widgets import templating
+
+chrome = panel('Hubs')
+template = templating.environment.get_template('templates/memberships.html')
+position = 'both'
+
+
+@argument(name="username",
+          default=None,
+          validator=validators.username,
+          help="A FAS username.")
+def data(session, widget, username, **kwargs):
+    user = hubs.models.User.by_username(session, username)
+    memberships = [m.__json__(session) for m in user.memberships
+                   if m.name != user.username and not m.user_hub]
+    return dict(memberships=memberships)
+
+
+@hint(topics=[_('hubs.hub.update')])
+def should_invalidate(message, session, widget):
+    if message['topic'].endswith('hubs.hub.update'):
+        if message['msg']['hub']['name'] == widget.hub.name:
+            return True
+    return False
diff --git a/hubs/widgets/templates/memberships.html b/hubs/widgets/templates/memberships.html
new file mode 100644
index 0000000..482d616
--- /dev/null
+++ b/hubs/widgets/templates/memberships.html
@@ -0,0 +1,18 @@
+{% for member in memberships %}
+<div class="card-block">
+  <img class="col-md-3 img-responsive membership-avatar" src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
+  <a href="/{{member.name}}">{{ member.name }}</a>
+  {% if g.auth.username in member.owners %}
+    <p class="text-muted">Owner</p>
+  {% else %}
+    <p>Member</p>
+  {% endif %}
+</div>
+{% endfor %}
+
+<style>
+ .membership-avatar {
+   height: 4em;
+   width: 6em;
+ }
+</style>

From 4737208e61400c0b0eb48a23ab19fc2d1c74f6c6 Mon Sep 17 00:00:00 2001
From: Eric Barbour <ebarbour@redhat.com>
Date: Jul 26 2016 15:13:59 +0000
Subject: [PATCH 8/34] Configure user membership for user and groups


* Add ellipsize of member/membership list

---

diff --git a/hubs/widgets/memberships.py b/hubs/widgets/memberships.py
index 8389657..48d8fea 100644
--- a/hubs/widgets/memberships.py
+++ b/hubs/widgets/memberships.py
@@ -5,20 +5,30 @@ from hubs.widgets.base import argument
 from hubs.widgets.chrome import panel
 from hubs.widgets import templating
 
+ELLIPSIS_LIMIT = 3
 chrome = panel('Hubs')
 template = templating.environment.get_template('templates/memberships.html')
 position = 'both'
 
 
-@argument(name="username",
-          default=None,
-          validator=validators.username,
-          help="A FAS username.")
-def data(session, widget, username, **kwargs):
-    user = hubs.models.User.by_username(session, username)
-    memberships = [m.__json__(session) for m in user.memberships
-                   if m.name != user.username and not m.user_hub]
-    return dict(memberships=memberships)
+def data(session, widget, **kwargs):
+    hub = widget.hub
+    members = []
+    if hub.user_hub:
+        user = hubs.models.User.by_username(session, hub.name)
+        members = [m.__json__(session) for m in user.memberships
+                   if m.name != user.username]
+    else:
+        members_name = []
+        for member in widget.hub.members:
+            if member.username in members_name:
+                continue
+            members_name.append(member.username)
+            members.append(member.__json__(session))
+
+    oldest_members = sorted(members,
+                            key=lambda m: m.get('created_on'))[:ELLIPSIS_LIMIT]
+    return dict(memberships=list(members), oldest_members=list(oldest_members))
 
 
 @hint(topics=[_('hubs.hub.update')])
diff --git a/hubs/widgets/templates/memberships.html b/hubs/widgets/templates/memberships.html
index 482d616..b489188 100644
--- a/hubs/widgets/templates/memberships.html
+++ b/hubs/widgets/templates/memberships.html
@@ -1,18 +1,69 @@
-{% for member in memberships %}
 <div class="card-block">
-  <img class="col-md-3 img-responsive membership-avatar" src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
-  <a href="/{{member.name}}">{{ member.name }}</a>
-  {% if g.auth.username in member.owners %}
-    <p class="text-muted">Owner</p>
+  {% if memberships|length > oldest_members|length %}
+  {% for member in oldest_members %}
+  <div class="card-block">
+    <img class="img-responsive membership-avatar col-md-3" src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
+    <a href="/{{member.name}}">{{ member.name }}</a>
+    {% if g.auth.username in member.owners %}
+      <p class="text-muted">Owner</p>
+    {% else %}
+      <p>Member</p>
+    {% endif %}
+  </div>
+  {% endfor %}
+  <a href="#" class="btn btn-default" data-toggle="modal" data-target="#membersModal">View All</a>
   {% else %}
-    <p>Member</p>
-  {% endif %}
+  {% for member in memberships %}
+  <div class="card-block">
+    <img class="img-responsive membership-avatar col-md-3" src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
+    <a href="/{{member.name}}">{{ member.name }}</a>
+    {% if g.auth.username in member.owners %}
+      <p class="text-muted">Owner</p>
+    {% else %}
+      <p>Member</p>
+    {% endif %}
+  </div>
+  {% endfor %}
+  {%endif%}
+</div>
+
+<!-- View all modal -->
+<div class="modal fade" id="membersModal" tabindex="-1" role="dialog" aria-labelledby="membersModal" aria-hidden="true">
+  <div class="modal-dialog">
+    <div class="modal-content">
+      <div class="modal-header">
+        <h4 class="modal-title" id="myModalLabel">All Memberships</h4>
+      </div>
+      <div id="owners" class="modal-body">
+        {% for member in memberships %}
+        <div class="card-block">
+          <img class="img-responsive membership-avatar col-md-3" src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
+          <a href="/{{member.name}}">{{ member.name }}</a>
+          {% if g.auth.username in member.owners %}
+          <p class="text-muted">Owner</p>
+          {% else %}
+          <p>Member</p>
+          {% endif %}
+        </div>
+        {% endfor %}
+      </div>
+      <div class="modal-footer clearfix">
+        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+      </div>
+    </div>
+  </div>
 </div>
-{% endfor %}
 
 <style>
  .membership-avatar {
    height: 4em;
    width: 6em;
  }
+ .modal-header {
+   border-bottom: 0;
+ }
+
+ #owners {
+   padding: 10px;
+ }
 </style>

From 260fd583d6ef6102e439b12a5b7dda4a026808b6 Mon Sep 17 00:00:00 2001
From: Eric Barbour <ebarbour@redhat.com>
Date: Jul 26 2016 15:13:59 +0000
Subject: [PATCH 9/34] Display memberships in modal as two columns


---

diff --git a/hubs/widgets/templates/memberships.html b/hubs/widgets/templates/memberships.html
index b489188..534aa95 100644
--- a/hubs/widgets/templates/memberships.html
+++ b/hubs/widgets/templates/memberships.html
@@ -35,24 +35,31 @@
         <h4 class="modal-title" id="myModalLabel">All Memberships</h4>
       </div>
       <div id="owners" class="modal-body">
-        {% for member in memberships %}
         <div class="card-block">
-          <img class="img-responsive membership-avatar col-md-3" src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
-          <a href="/{{member.name}}">{{ member.name }}</a>
-          {% if g.auth.username in member.owners %}
-          <p class="text-muted">Owner</p>
-          {% else %}
-          <p>Member</p>
-          {% endif %}
+          <div class="row">
+            {% for member in memberships %}
+            <div class="col-sm-6">
+              <img class="img-responsive membership-avatar col-sm-3"
+                src="{{ member.avatar }}" alt="Hub avatar for {{ member.name }}">
+              <a href="/{{member.name}}">{{ member.name }}</a>
+              {% if g.auth.username in member.owners %}
+              <p class="text-muted">Owner</p>
+              {% else %}
+              <p>Member</p>
+              {% endif %}
+            </div>
+            {% if (loop.index % 2) == 0 %}
+              </div>
+              <div class="row">
+            {% endif %}
+          {% endfor %}
+        </div>
+        <div class="modal-footer clearfix">
+          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
         </div>
-        {% endfor %}
-      </div>
-      <div class="modal-footer clearfix">
-        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
       </div>
     </div>
   </div>
-</div>
 
 <style>
  .membership-avatar {

From 8bd8e68e11368cccb35fb2942b866e4750f2b13b Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:50:06 +0000
Subject: [PATCH 10/34] removing img-wrap from team hubs header (will be plain grey to match fedora bootstrap)


---

diff --git a/hubs/static/css/style.css b/hubs/static/css/style.css
index 1ffc8bb..1160e28 100644
--- a/hubs/static/css/style.css
+++ b/hubs/static/css/style.css
@@ -57,16 +57,18 @@
       .header .dropdown.edit {
         top: 140px !important;
       }
-      .header h3.team {
+      .header h2.team {
         top: 170px !important;
       }
     }
 
     .header {
-      color: #ffffff;
-      background-color: #3c6eb4;
+      color: #373a3c;
+      background: #f3f3f3 none repeat scroll 0 0;
       width: 100%;
       font-family: 'Open Sans', sans-serif;
+      min-height: 100px;
+      border-bottom: 1px solid #ddd;
     }
 
     /*.header .dropdown.edit {
@@ -76,23 +78,6 @@
       z-index: 2;
     }*/
 
-    .header .img-wrap {
-      max-height: 100px;
-      overflow: hidden;
-      position: relative;
-    }
-
-    .header .img-wrap img {
-      width: 100%;
-      text-align: center;
-    }
-
-    .header h3.team {
-      position: absolute;
-      top: 120px;
-      left: 45%;
-    }
-
     .header img.avatar {
         width: 70px;
         float: left;
@@ -101,7 +86,7 @@
         border: 5px solid #fff;
     }
 
-    .header h3 {
+    .header h2 {
         font-weight: 700;
     }
 
diff --git a/hubs/templates/hubs.html b/hubs/templates/hubs.html
index c4e6b92..d9592ef 100644
--- a/hubs/templates/hubs.html
+++ b/hubs/templates/hubs.html
@@ -6,15 +6,12 @@
   {% if hub.user_hub %}
     <div class="padded center-block medium-wide">
       <img src="{{ hub.avatar }}" class="avatar" />
-      <h3>{{ hub.name }}</h3>
+      <h2>{{ hub.name }}</h2>
       <h5>{{ hub.summary }}</h5>
       <div class="clearfix"></div>
     </div>
     {% else %}
-    <div class="img-wrap">
-      <img src="{{ hub.header_img }}" />
-    </div>
-    <h3 class="team">{{ hub.name }}</h3>
+    <h2 class="team">{{ hub.name }}</h2>
   {% endif %}
 </div>
 

From 1f97beda194fe0b19d55d3dcf5cad0d3604f9f81 Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:50:07 +0000
Subject: [PATCH 11/34] wrangling header for user/team hubs to better match Fedora bootstrap


---

diff --git a/hubs/static/css/style.css b/hubs/static/css/style.css
index 1160e28..f0f0b6a 100644
--- a/hubs/static/css/style.css
+++ b/hubs/static/css/style.css
@@ -62,7 +62,7 @@
       }
     }
 
-    .header {
+    header {
       color: #373a3c;
       background: #f3f3f3 none repeat scroll 0 0;
       width: 100%;
@@ -78,7 +78,7 @@
       z-index: 2;
     }*/
 
-    .header img.avatar {
+    header img.avatar {
         width: 70px;
         float: left;
         margin: 0 15px;
@@ -86,15 +86,15 @@
         border: 5px solid #fff;
     }
 
-    .header h2 {
-        font-weight: 700;
+    header h2 {
+        font-weight: 500;
     }
 
-    .header a, .header a:hover, .header a:focus {
+    header a, header a:hover, .header a:focus {
       color: #ffffff;
     }
 
-    .header span.edit {
+    header span.edit {
       margin: 5px 5px 0 0;
     }
     .row {
diff --git a/hubs/templates/hubs.html b/hubs/templates/hubs.html
index d9592ef..c7106fc 100644
--- a/hubs/templates/hubs.html
+++ b/hubs/templates/hubs.html
@@ -2,18 +2,21 @@
 
 {% block title %}{{ hub.name }}{% endblock %}
 {% block content %}
-<div class="header">
-  {% if hub.user_hub %}
-    <div class="padded center-block medium-wide">
-      <img src="{{ hub.avatar }}" class="avatar" />
-      <h2>{{ hub.name }}</h2>
-      <h5>{{ hub.summary }}</h5>
-      <div class="clearfix"></div>
-    </div>
-    {% else %}
-    <h2 class="team">{{ hub.name }}</h2>
-  {% endif %}
-</div>
+
+  <header class="p-t-2">
+    <div class="container">
+      {% if hub.user_hub %}
+	    <img src="{{ hub.avatar }}" class="avatar" />
+		<h2 class="user m-b-0">{{ hub.name }}</h2>
+		<h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
+	    <div class="clearfix"></div>
+      {% else %}
+      <h2 class="team">{{ hub.name }}</h2>
+      <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
+	  {% endif %}
+  	</div>
+  </header>
+
 
 {%- with messages = get_flashed_messages(with_categories=true) -%}
   {%- if category, messages -%}

From 0347c76a2a3b9c6b6e6fe169efdcb8764a362726 Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:50:07 +0000
Subject: [PATCH 12/34] first cut at vertical nav bar


---

diff --git a/hubs/static/css/style.css b/hubs/static/css/style.css
index f0f0b6a..09d6be9 100644
--- a/hubs/static/css/style.css
+++ b/hubs/static/css/style.css
@@ -265,6 +265,28 @@ font-size: 32pt;
 .navbar-nav > li.idle-2years  > a { color: #BBB; }
 .navbar-nav > li.idle-5years  > a { color: #CCC; }
 
+.nav {
+  background-color: #fcfcfc;
+  padding: 1.5rem;
+  position: absolute;
+  z-index: 3;
+  min-height: 200px; 
+  float: left;
+}
+
+/* navbar fedora-bootstrap overrides to make it vertical */
+
+.navbar-nav .nav-item {
+    float: none;
+}
+
+.navbar-nav .nav-item + .nav-item, .navbar-nav .nav-link + .nav-link {
+    box-shadow: none;
+    margin-left: 0px !important;
+}
+
+/* end fedora-bootstrap nav overrides */
+
 .media-object {
     max-width: 92px;
     max-height: 92px;
diff --git a/hubs/templates/hubs.html b/hubs/templates/hubs.html
index c7106fc..f384e37 100644
--- a/hubs/templates/hubs.html
+++ b/hubs/templates/hubs.html
@@ -78,8 +78,8 @@
       </div>
   {% endif %}
 
-
   <div class="row">
+	  
     <div class="col-md-{{ hub.left_width }}">
       <!--
         First, before the proper widgets.. a cobweb built-in widget.
diff --git a/hubs/templates/master.html b/hubs/templates/master.html
index 4fd92e5..22eb10b 100644
--- a/hubs/templates/master.html
+++ b/hubs/templates/master.html
@@ -54,16 +54,18 @@
 </div>
 <div class="bodycontent">
 
-  <nav class="navbar navbar-light navbar-underline p-t-0 p-b-0">
+  
+<div class="col-md-2">
+	  <nav class="navbar navbar-light p-t-2 p-b-0">
         <button type="button" class="navbar-toggler hidden-sm-up"
             data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
           <span class="sr-only">Toggle navigation</span>
           <span class="oi" data-glyph="menu"></span>
         </button>
 
-      <!-- Collect the nav links, forms, and other content for toggling -->
-      <div class="collapse navbar-toggleable-xs" id="bs-example-navbar-collapse-1">
-        <ul class="nav navbar-nav nav-underline">
+<!-- Collect the nav links, forms, and other content for toggling -->
+  <div class="collapse navbar-toggleable-xs" id="bs-example-navbar-collapse-1">
+        <ul class="nav navbar-nav">
           {% if g.auth.logged_in %}
           <li class="p-x-1 nav-item {% if request.path.endswith('/' + g.auth.user.username + '/') %}active{% endif %}">
             <a class="nav-link" href="/{{g.auth.user.username}}">me</a></li>
@@ -72,11 +74,15 @@
           <a class="nav-link" href="/{{hub.name}}">{{hub.name}}</a></li>
           {% endfor %}
           <!-- At the end of the list, tack on a link to all groups -->
-          <li class="p-x-1 nav-item"><a class="nav-link" href="/groups">all</a></li>
+
+ <li class="p-x-1 nav-item"><a class="nav-link" href="/groups">all</a></li>
           {% endif %}
         </ul>
-      </div><!-- /.navbar-collapse -->
+  </div><!-- /.navbar-collapse -->
   </nav>
+  
+</div>  
+  
 {% block content %}{% endblock %}
 
 </div> <!--end bodycontent-->

From 42b376a1ffc3738641ac3022917c2f62817a8de4 Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:50:07 +0000
Subject: [PATCH 13/34] some padding / alignment adjustments so things line up with vertical nav


---

diff --git a/hubs/static/css/style.css b/hubs/static/css/style.css
index 09d6be9..f8636d6 100644
--- a/hubs/static/css/style.css
+++ b/hubs/static/css/style.css
@@ -77,17 +77,23 @@
       right: 0;
       z-index: 2;
     }*/
+    
+    /* line up header with cards below */
+    header .container {
+	padding-left: 1.75rem !important;
+	}
 
     header img.avatar {
         width: 70px;
         float: left;
-        margin: 0 15px;
+        margin-right: 15px;
         display: inline;
         border: 5px solid #fff;
     }
 
     header h2 {
         font-weight: 500;
+        padding-top: .5rem;
     }
 
     header a, header a:hover, .header a:focus {
@@ -98,7 +104,7 @@
       margin: 5px 5px 0 0;
     }
     .row {
-      padding: 5px;
+      padding-top: 5px;
       margin: auto 0px;
     }
     .padded {
@@ -133,6 +139,7 @@
       padding: 5px;
       /* TODO -- lots more nice styling here... */
     }
+
     .panel {
       visibility: hidden;
       max-height: 0px;
@@ -381,3 +388,19 @@ font-size: 32pt;
   height: 2em;
   width: 2em;
 }
+
+
+/** fedora bootstrap overrides **/
+
+/** tightening up card headers - they are too fat imho **/
+.card-header {
+  padding: 0.3rem 0.5rem;
+}
+
+
+/** too much padding over the user's subheader, was attached to .m-b-1 with 
+ * !important so difficult to override **/
+
+header h5.m-b-1 {
+  margin-top: 0.5rem!important;
+}
diff --git a/hubs/templates/hubs.html b/hubs/templates/hubs.html
index f384e37..99418cb 100644
--- a/hubs/templates/hubs.html
+++ b/hubs/templates/hubs.html
@@ -5,16 +5,55 @@
 
   <header class="p-t-2">
     <div class="container">
-      {% if hub.user_hub %}
-	    <img src="{{ hub.avatar }}" class="avatar" />
-		<h2 class="user m-b-0">{{ hub.name }}</h2>
-		<h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
-	    <div class="clearfix"></div>
-      {% else %}
-      <h2 class="team">{{ hub.name }}</h2>
-      <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
-	  {% endif %}
+		
+	  <!-- Left side of header -->
+	  <div class="col-md-8">
+        {% if hub.user_hub %}
+	      <img src="{{ hub.avatar }}" class="avatar" />
+		  <h2 class="user m-b-0">{{ hub.name }}</h2>
+		  <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
+	      <div class="clearfix"></div>
+        {% else %}
+        <h2 class="team">{{ hub.name }}</h2>
+        <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
+	    {% endif %}
+	  </div>
+
+      <!-- right side of header -->
+      <div class="col-md-4 header-right">
+{% if g.auth.logged_in and hub.is_admin(g.auth.user) %}
+        {% if not edit %}
+          <div class="dropdown edit pull-xs-right showpointer">
+            <span class="dropdown-toggle edit-this-page" type="button"
+                  id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true"
+                  aria-expanded="true">
+              <span class="oi" data-glyph="pencil"></span> edit this page
+            </span>
+            <div class="dropdown-menu" aria-labelledby="dropdownMenu2">
+              <a class="dropdown-item" href="#">Customize Header</a>
+              <div class="dropdown-divider"></div>
+              <a class="dropdown-item"
+                  href="{{ url_for('hub_edit', name=hub.name) }}">
+                Configure Hub
+              </a>
+              {% if not hub.user_hub %}
+              <div class="dropdown-divider"></div>
+              <a class="dropdown-item" href="#">Manage Members</a>
+              <div class="dropdown-divider"></div>
+              <a class="dropdown-item" href="#">Archive Hub</a>
+              {% endif %}
+            </div>
+          </div>
+        {% else %}
+          <div id="save_edits_btn" class="pull-xs-right">
+            <span class="oi" data-glyph="data-transfer-download"></span>
+            Save changes
+          </div>
+        {% endif %}
+  {% endif %}
+  </div>
   	</div>
+
   </header>
 
 
@@ -45,39 +84,7 @@
 {%- endwith -%}
 
 <div class="container">
-  {% if g.auth.logged_in and hub.is_admin(g.auth.user) %}
-      <div class="row">
-        {% if not edit %}
-          <div class="dropdown edit pull-xs-right showpointer">
-            <span class="dropdown-toggle edit-this-page" type="button"
-                  id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true"
-                  aria-expanded="true">
-              <span class="oi" data-glyph="pencil"></span> edit this page
-            </span>
-            <div class="dropdown-menu" aria-labelledby="dropdownMenu2">
-              <a class="dropdown-item" href="#">Customize Header</a>
-              <div class="dropdown-divider"></div>
-              <a class="dropdown-item"
-                  href="{{ url_for('hub_edit', name=hub.name) }}">
-                Configure Hub
-              </a>
-              {% if not hub.user_hub %}
-              <div class="dropdown-divider"></div>
-              <a class="dropdown-item" href="#">Manage Members</a>
-              <div class="dropdown-divider"></div>
-              <a class="dropdown-item" href="#">Archive Hub</a>
-              {% endif %}
-            </div>
-          </div>
-        {% else %}
-          <div id="save_edits_btn" class="pull-xs-right">
-            <span class="oi" data-glyph="data-transfer-download"></span>
-            Save changes
-          </div>
-        {% endif %}
-      </div>
-  {% endif %}
-
+  
   <div class="row">
 	  
     <div class="col-md-{{ hub.left_width }}">

From cce099478f812c08375f6d0a3f96a4b5c776702e Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:50:07 +0000
Subject: [PATCH 14/34] fixing up groups.html to not be broken-looking + to be compatible with vert bookmarks bar


---

diff --git a/hubs/static/css/style.css b/hubs/static/css/style.css
index f8636d6..a588609 100644
--- a/hubs/static/css/style.css
+++ b/hubs/static/css/style.css
@@ -400,7 +400,6 @@ font-size: 32pt;
 
 /** too much padding over the user's subheader, was attached to .m-b-1 with 
  * !important so difficult to override **/
-
 header h5.m-b-1 {
   margin-top: 0.5rem!important;
 }
diff --git a/hubs/templates/groups.html b/hubs/templates/groups.html
index 0d3bc20..f13070c 100644
--- a/hubs/templates/groups.html
+++ b/hubs/templates/groups.html
@@ -3,12 +3,16 @@
 {% block title %}Groups{% endblock %}
 {% block content %}
 
-<div class="header">
-  <div class="img-wrap">
-    <img src="#" />
-  </div>
-  <h3 class="team">Groups</h3>
-</div>
+<header class="p-t-2">
+	<div class="container">
+    <div class="col-md-8">
+      <h2 class="team m-b-0">Groups</h2>
+  		<h5 class="m-t-1 m-b-1">Summary of available team hubs</h5>
+    </div>
+    <div class="col-md-4 header-right">
+		</div>
+</header>
+
 <div class="container">
   <div class="row">
   </div>

From 33188da39f06bf5ff7f8825f64d88a1b7e7fb0b5 Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:51:03 +0000
Subject: [PATCH 15/34] making body background white


---

diff --git a/hubs/static/css/style.css b/hubs/static/css/style.css
index a588609..30e246b 100644
--- a/hubs/static/css/style.css
+++ b/hubs/static/css/style.css
@@ -1,7 +1,7 @@
 @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic);
 
    body {
-      background-color: #d1d3d4;
+      background-color: #fff;
     }
 
     /*.super-header {

From bac5cbd6789d1e218752e302695ea6137b27b126 Mon Sep 17 00:00:00 2001
From: Máirín Duffy <duffy@redhat.com>
Date: Jul 26 2016 20:51:08 +0000
Subject: [PATCH 16/34] minor indentation fix


---

diff --git a/hubs/templates/groups.html b/hubs/templates/groups.html
index f13070c..4040938 100644
--- a/hubs/templates/groups.html
+++ b/hubs/templates/groups.html
@@ -7,10 +7,10 @@
 	<div class="container">
     <div class="col-md-8">
       <h2 class="team m-b-0">Groups</h2>
-  		<h5 class="m-t-1 m-b-1">Summary of available team hubs</h5>
+      <h5 class="m-t-1 m-b-1">Summary of available team hubs</h5>
     </div>
     <div class="col-md-4 header-right">
-		</div>
+    </div>
 </header>
 
 <div class="container">
diff --git a/hubs/templates/hubs.html b/hubs/templates/hubs.html
index 99418cb..f52d617 100644
--- a/hubs/templates/hubs.html
+++ b/hubs/templates/hubs.html
@@ -5,23 +5,23 @@
 
   <header class="p-t-2">
     <div class="container">
-		
-	  <!-- Left side of header -->
-	  <div class="col-md-8">
+
+    <!-- Left side of header -->
+    <div class="col-md-8">
         {% if hub.user_hub %}
-	      <img src="{{ hub.avatar }}" class="avatar" />
-		  <h2 class="user m-b-0">{{ hub.name }}</h2>
-		  <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
-	      <div class="clearfix"></div>
+        <img src="{{ hub.avatar }}" class="avatar" />
+      <h2 class="user m-b-0">{{ hub.name }}</h2>
+      <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
+        <div class="clearfix"></div>
         {% else %}
         <h2 class="team">{{ hub.name }}</h2>
         <h5 class="m-t-1 m-b-1">{{ hub.summary }}</h5>
-	    {% endif %}
-	  </div>
+      {% endif %}
+    </div>
 
       <!-- right side of header -->
       <div class="col-md-4 header-right">
-{% if g.auth.logged_in and hub.is_admin(g.auth.user) %}
+      {% if g.auth.logged_in and hub.is_admin(g.auth.user) %}
         {% if not edit %}
           <div class="dropdown edit pull-xs-right showpointer">
             <span class="dropdown-toggle edit-this-page" type="button"
@@ -50,9 +50,9 @@
             Save changes
           </div>
         {% endif %}
-  {% endif %}
-  </div>
-  	</div>
+      {% endif %}
+      </div>
+    </div>
 
   </header>
 
@@ -86,7 +86,7 @@
 <div class="container">
   
   <div class="row">
-	  
+ 
     <div class="col-md-{{ hub.left_width }}">
       <!--
         First, before the proper widgets.. a cobweb built-in widget.
diff --git a/hubs/templates/master.html b/hubs/templates/master.html
index 22eb10b..f093304 100644
--- a/hubs/templates/master.html
+++ b/hubs/templates/master.html
@@ -56,7 +56,7 @@
 
   
 <div class="col-md-2">
-	  <nav class="navbar navbar-light p-t-2 p-b-0">
+    <nav class="navbar navbar-light p-t-2 p-b-0">
         <button type="button" class="navbar-toggler hidden-sm-up"
             data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
           <span class="sr-only">Toggle navigation</span>

From f9afac5239d1238ba794b0e2cd3c8af95d0f518c Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Jul 28 2016 12:18:13 +0000
Subject: [PATCH 17/34] Adjust the validators so they return the value validated


---

diff --git a/hubs/validators.py b/hubs/validators.py
index c0385d3..fd4066c 100755
--- a/hubs/validators.py
+++ b/hubs/validators.py
@@ -1,6 +1,7 @@
 import kitchen.text.converters
 
 import hubs.models
+import httplib
 
 
 def required(session, value):
@@ -22,7 +23,9 @@ def link(session, value):
 
 
 def username(session, value):
-    return hubs.models.User.by_username(session, value) is not None
+    if hubs.models.User.by_username(session, value) is not None:
+        return value
+    raise ValueError('Invalid username')
 
 
 def github_organization(session, value):
@@ -32,14 +35,25 @@ def github_organization(session, value):
 
 def fmn_context(session, value):
     # TODO get this from the fedmsg config.
-    return value in [
-        'irc', 'email', 'android', 'desktop', 'hubs',
-    ]
+    if value in [
+        'irc', 'email', 'android', 'desktop', 'hubs',]:
+        return value
+    raise ValueError('Invalid FMN context')
 
 
 def pagure_repo(session, value):
-    return value
+    conn = httplib.HTTPSConnection("pagure.io")
+    conn.request("GET", "/%s" % value)
+    response = conn.getresponse()
+    if response.status == 200:
+        return value
+    raise ValueError('Invalid pagure repo')
+
 
 def fedorahosted_project(session, value):
-    # TODO -- implement this.
-    return value
+    conn = httplib.HTTPSConnection("fedorahosted.org")
+    conn.request("GET", "/%s" % value)
+    response = conn.getresponse()
+    if response.status == 200:
+        return value
+    raise ValueError('Invalid fedorahosted project')

From c1bbe004f00d5381c37c12855606bb22b4dd005b Mon Sep 17 00:00:00 2001
From: Eric Barbour <ebarbour@redhat.com>
Date: Jul 28 2016 15:55:49 +0000
Subject: [PATCH 18/34] Avoid empty nav bar if visiting hub logged out


Move check for g.auth.logged_in to surround all of the nav bar

---

diff --git a/hubs/templates/master.html b/hubs/templates/master.html
index f093304..83f7608 100644
--- a/hubs/templates/master.html
+++ b/hubs/templates/master.html
@@ -53,36 +53,33 @@
   </div>
 </div>
 <div class="bodycontent">
-
-  
-<div class="col-md-2">
+  <div class="col-md-2">
     <nav class="navbar navbar-light p-t-2 p-b-0">
-        <button type="button" class="navbar-toggler hidden-sm-up"
-            data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
-          <span class="sr-only">Toggle navigation</span>
-          <span class="oi" data-glyph="menu"></span>
-        </button>
+      <button type="button" class="navbar-toggler hidden-sm-up"
+        data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+        <span class="sr-only">Toggle navigation</span>
+        <span class="oi" data-glyph="menu"></span>
+      </button>
 
-<!-- Collect the nav links, forms, and other content for toggling -->
-  <div class="collapse navbar-toggleable-xs" id="bs-example-navbar-collapse-1">
+      <!-- Collect the nav links, forms, and other content for toggling -->
+      {% if g.auth.logged_in %}
+      <div class="collapse navbar-toggleable-xs" id="bs-example-navbar-collapse-1">
         <ul class="nav navbar-nav">
-          {% if g.auth.logged_in %}
           <li class="p-x-1 nav-item {% if request.path.endswith('/' + g.auth.user.username + '/') %}active{% endif %}">
             <a class="nav-link" href="/{{g.auth.user.username}}">me</a></li>
           {% for hub in g.auth.user.bookmarks %}
           <li class='p-x-1 nav-item idle-{{hub.activity_class}}{% if request.path.endswith('/' + hub.name + '/') %} active{% endif %}'>
-          <a class="nav-link" href="/{{hub.name}}">{{hub.name}}</a></li>
+            <a class="nav-link" href="/{{hub.name}}">{{hub.name}}</a></li>
           {% endfor %}
           <!-- At the end of the list, tack on a link to all groups -->
 
- <li class="p-x-1 nav-item"><a class="nav-link" href="/groups">all</a></li>
-          {% endif %}
+            <li class="p-x-1 nav-item"><a class="nav-link" href="/groups">all</a></li>
         </ul>
-  </div><!-- /.navbar-collapse -->
-  </nav>
-  
-</div>  
-  
+      </div><!-- /.navbar-collapse -->
+      {% endif %}
+    </nav>
+  </div>
+
 {% block content %}{% endblock %}
 
 </div> <!--end bodycontent-->

From b42ccf06b92dd6cf6bb932953d585c9a7d9971d3 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 19/34] creating a automated setup test env script


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
new file mode 100644
index 0000000..d0c83fa
--- /dev/null
+++ b/setup_test_env.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+######
+# Warning this file uses sudo to install dependencies use at your own risk
+#####
+
+# Install dependencies
+sudo yum install gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
+
+# setup python virtualenv
+sudo yum install python-virtualenvwrapper postgresql postgresql-devel
+
+# have bash find mkvirutalenv
+source ~/.bashrc
+
+# Create hubs env
+mkvirtualenv hubs
+
+# activate hubs
+workon hubs
+
+# install python deps
+pip install -r requirements.txt
+pip install -r test-requirements.txt
+
+

From 6ebd0d14558f9fd4648e0a15ba9cfaa24d1f70cb Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 20/34] minimize user interaction, upgrade python packages if they are already installed, also temp fix for html5lib fiasco


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
index d0c83fa..312c017 100644
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -5,10 +5,10 @@
 #####
 
 # Install dependencies
-sudo yum install gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
+sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
 
 # setup python virtualenv
-sudo yum install python-virtualenvwrapper postgresql postgresql-devel
+sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 
 # have bash find mkvirutalenv
 source ~/.bashrc
@@ -20,7 +20,8 @@ mkvirtualenv hubs
 workon hubs
 
 # install python deps
-pip install -r requirements.txt
-pip install -r test-requirements.txt
-
+pip install --upgrade -r requirements.txt
+pip install --upgrade -r test-requirements.txt
 
+# TEMPORARY: html5lib update is causing other apps to crash
+pip install html5lib==0.9999999

From 04eacc82ea576eefa8cd52fd0a4837ada5446071 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 21/34] removing the hubs env to make sure we have a clean env


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
index 312c017..fed2ad4 100644
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -13,6 +13,9 @@ sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 # have bash find mkvirutalenv
 source ~/.bashrc
 
+# remove the hubs env
+rmvirtualenv hubs
+
 # Create hubs env
 mkvirtualenv hubs
 

From 9c85314e2bdcddb32da2ab491c2085509fc5a2c8 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 22/34] seperating fedora and python dependency install


---

diff --git a/setup_python_test_env.sh b/setup_python_test_env.sh
new file mode 100644
index 0000000..4681c75
--- /dev/null
+++ b/setup_python_test_env.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+# have bash find mkvirutalenv
+source ~/.bashrc
+
+# remove the hubs env
+rmvirtualenv hubs
+
+# Create hubs env
+mkvirtualenv hubs
+
+# activate hubs
+workon hubs
+
+# install python deps
+pip install --upgrade -r requirements.txt
+pip install --upgrade -r test-requirements.txt
+
+# TEMPORARY: html5lib update is causing other apps to crash
+pip install html5lib==0.9999999
diff --git a/setup_test_env.sh b/setup_test_env.sh
index fed2ad4..bee1732 100644
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 ######
 # Warning this file uses sudo to install dependencies use at your own risk
@@ -10,21 +10,4 @@ sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-r
 # setup python virtualenv
 sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 
-# have bash find mkvirutalenv
-source ~/.bashrc
-
-# remove the hubs env
-rmvirtualenv hubs
-
-# Create hubs env
-mkvirtualenv hubs
-
-# activate hubs
-workon hubs
-
-# install python deps
-pip install --upgrade -r requirements.txt
-pip install --upgrade -r test-requirements.txt
-
-# TEMPORARY: html5lib update is causing other apps to crash
-pip install html5lib==0.9999999
+sh ./setup_python_test_env.sh

From e906478c1527d8eae54fb1541d805904fe0ede54 Mon Sep 17 00:00:00 2001
From: Eric Barbour <ebarbour@redhat.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 23/34] Make test scripts executable and source hubs


---

diff --git a/runtest.sh b/runtest.sh
index ad0de9c..87fd265 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -1,3 +1,6 @@
 #!/bin/bash
+
+. ~/.virtualenvs/hubs/bin/activate || /bin/bash ./setup_python_test_env.sh
+
 HUBS_CONFIG=`pwd`/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
     --with-coverage --cover-erase --cover-package=hubs $*
diff --git a/setup_python_test_env.sh b/setup_python_test_env.sh
old mode 100644
new mode 100755
diff --git a/setup_test_env.sh b/setup_test_env.sh
old mode 100644
new mode 100755

From d704ba98150d29184424d1a56b3d00a2fd758df2 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 24/34] adding centos 7 specific dependency, adding jenkins python venv script


---

diff --git a/jenkins_python_env_setup.sh b/jenkins_python_env_setup.sh
new file mode 100644
index 0000000..5b47bde
--- /dev/null
+++ b/jenkins_python_env_setup.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+######
+# Warning this file uses sudo to create a directory use at your own risk
+#####
+
+sudo mkdir /var/lib/jenkins/.virtualenvs/
+cd /var/lib/jenkins/.virtualenvs/
+virtualenv hubs
+
+
+# In jenkins build add the following lines
+
+# pip install -r requirements.txt
+# pip install -r test-requirements.txt
+# sh ./runtest.sh
diff --git a/setup_test_env.sh b/setup_test_env.sh
index bee1732..d105522 100755
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -7,6 +7,11 @@
 # Install dependencies
 sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
 
+# Centos 7 specific
+# sudo yum install -y epel-release
+# sudo yum update -y
+# sudo yum install -y python-pip
+
 # setup python virtualenv
 sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
 

From a9e9c3ac2b947c5999fd7847360354ce9c11fc75 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 25/34] Adding fedora check to install specific packages for centos


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
index d105522..668a853 100755
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -7,10 +7,12 @@
 # Install dependencies
 sudo yum install -y gcc gcc-c++ sqlite-devel libffi-devel openssl-devel redhat-rpm-config
 
-# Centos 7 specific
-# sudo yum install -y epel-release
-# sudo yum update -y
-# sudo yum install -y python-pip
+if ! grep -q "Fedora" /etc/os-release ; then
+    # Epel 7 specific
+    sudo yum install -y epel-release
+    sudo yum update -y
+    sudo yum install -y python-pip
+fi
 
 # setup python virtualenv
 sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel

From 9d359e142d14ca5664407f53a86864a60a1bdee1 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 26/34] adding jenkins runtest


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
new file mode 100644
index 0000000..8cc7529
--- /dev/null
+++ b/runtest_jenkins.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH
+./runtest.sh

From a50e042bb2f0470b2e946959ec1c1ffde96d2547 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 27/34] adding jenkins specific venv setup


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 8cc7529..6575431 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -1,4 +1,13 @@
 #!/bin/bash
 
 PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH
+
+if [ ! -d "venv" ]; then
+        virtualenv venv
+fi
+. venv/bin/activate
+pip install -r requirements.txt
+pip install -r test-requirements.txt
+pip install html5lib==0.9999999
+
 ./runtest.sh

From 3792bec6a1a8f8b7ea16070d3e048662797e968c Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 28/34] update setuptools on epel7


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 6575431..02d9ee8 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -8,6 +8,12 @@ fi
 . venv/bin/activate
 pip install -r requirements.txt
 pip install -r test-requirements.txt
+
+# update setuptools on epel 7
+if ! grep -q "Fedora" /etc/os-release ; then
+    pip install --upgrade setuptools
+fi
+
 pip install html5lib==0.9999999
 
 ./runtest.sh

From 9939519d44416d12a97d6b187dcdf0a322117e0d Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 29/34] manually running test


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 02d9ee8..1b38436 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -16,4 +16,5 @@ fi
 
 pip install html5lib==0.9999999
 
-./runtest.sh
+HUBS_CONFIG=`pwd`/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
+    --with-coverage --cover-erase --cover-package=hubs $*
\ No newline at end of file

From 4e841d666fb2b52744cdfde418d77facb2d901e7 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 30/34] working on getting jenkins to pass build in centos


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 1b38436..0594f6e 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -6,15 +6,21 @@ if [ ! -d "venv" ]; then
         virtualenv venv
 fi
 . venv/bin/activate
-pip install -r requirements.txt
-pip install -r test-requirements.txt
 
-# update setuptools on epel 7
+# epel 7 specific python setup
 if ! grep -q "Fedora" /etc/os-release ; then
     pip install --upgrade setuptools
+    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
+    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
+	cp -r /usr/lib/python2.7/site-packages/Pygments-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
 fi
 
+
+pip install -r requirements.txt
+pip install -r test-requirements.txt
+
+
 pip install html5lib==0.9999999
 
 HUBS_CONFIG=`pwd`/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
-    --with-coverage --cover-erase --cover-package=hubs $*
\ No newline at end of file
+    --cover-package=hubs $*
\ No newline at end of file
diff --git a/setup_test_env.sh b/setup_test_env.sh
index 668a853..39a7212 100755
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -11,7 +11,7 @@ if ! grep -q "Fedora" /etc/os-release ; then
     # Epel 7 specific
     sudo yum install -y epel-release
     sudo yum update -y
-    sudo yum install -y python-pip
+    sudo yum install -y python-pip python-pygments-markdown-lexer
 fi
 
 # setup python virtualenv

From d9d5c0e764dd05fe3acc9ff45f8d45ba08c69c1c Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 31/34] adding coverage dep for unittest


---

diff --git a/test-requirements.txt b/test-requirements.txt
index c1358b7..cb1dca7 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,3 +2,4 @@ nose
 vcrpy
 mock
 yanc
+coverage
\ No newline at end of file

From ea8163c11a8551c16e495d2070ccefce0e2e0fe1 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 32/34] removing unused file, forgot to cp the pygments lib


---

diff --git a/jenkins_python_env_setup.sh b/jenkins_python_env_setup.sh
deleted file mode 100644
index 5b47bde..0000000
--- a/jenkins_python_env_setup.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-######
-# Warning this file uses sudo to create a directory use at your own risk
-#####
-
-sudo mkdir /var/lib/jenkins/.virtualenvs/
-cd /var/lib/jenkins/.virtualenvs/
-virtualenv hubs
-
-
-# In jenkins build add the following lines
-
-# pip install -r requirements.txt
-# pip install -r test-requirements.txt
-# sh ./runtest.sh
diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 0594f6e..290438b 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -3,7 +3,7 @@
 PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH
 
 if [ ! -d "venv" ]; then
-        virtualenv venv
+    virtualenv venv
 fi
 . venv/bin/activate
 
@@ -12,7 +12,8 @@ if ! grep -q "Fedora" /etc/os-release ; then
     pip install --upgrade setuptools
     cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
     cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
-	cp -r /usr/lib/python2.7/site-packages/Pygments-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
+    cp -r /usr/lib/python2.7/site-packages/Pygments-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
+    cp -r /usr/lib/python2.7/site-packages/pygments/ /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
 fi
 
 

From c887c0923f9db9c20766691c60533e25f9e07d72 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 33/34] cleaning up and removing hardlink to use relative links


---

diff --git a/runtest_jenkins.sh b/runtest_jenkins.sh
index 290438b..0092438 100644
--- a/runtest_jenkins.sh
+++ b/runtest_jenkins.sh
@@ -9,19 +9,16 @@ fi
 
 # epel 7 specific python setup
 if ! grep -q "Fedora" /etc/os-release ; then
-    pip install --upgrade setuptools
-    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
-    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
-    cp -r /usr/lib/python2.7/site-packages/Pygments-*-py2.7.egg-info /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
-    cp -r /usr/lib/python2.7/site-packages/pygments/ /var/lib/jenkins/workspace/fedora-hubs/venv/lib/python2.7/site-packages/
+    pip install --upgrade setuptools==18.5
+    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer $WORKSPACE/venv/lib/python2.7/site-packages/
+    cp -r /usr/lib/python2.7/site-packages/pygments_markdown_lexer-*-py2.7.egg-info $WORKSPACE/venv/lib/python2.7/site-packages/
 fi
 
-
 pip install -r requirements.txt
 pip install -r test-requirements.txt
 
-
+# Temporary: html5lib is breaking stability in some libraries
 pip install html5lib==0.9999999
 
-HUBS_CONFIG=`pwd`/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
+HUBS_CONFIG=$WORKSPACE/hubs/tests/hubs_test.cfg PYTHONPATH=. ./nosetests \
     --cover-package=hubs $*
\ No newline at end of file

From 40becc770fb3a2aec68399545eff045f3bde2948 Mon Sep 17 00:00:00 2001
From: skrzepto <shims506@gmail.com>
Date: Aug 01 2016 14:32:43 +0000
Subject: [PATCH 34/34] removing the python setup in the fedora dep setup


---

diff --git a/setup_test_env.sh b/setup_test_env.sh
index 39a7212..d1d5305 100755
--- a/setup_test_env.sh
+++ b/setup_test_env.sh
@@ -15,6 +15,4 @@ if ! grep -q "Fedora" /etc/os-release ; then
 fi
 
 # setup python virtualenv
-sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
-
-sh ./setup_python_test_env.sh
+sudo yum install -y python-virtualenvwrapper postgresql postgresql-devel
\ No newline at end of file

