예제 #1
0
    def tags(self, pid=None, tid=None, dfrom=None, dto=None, inc_repos=None):
        t = Tags(index.Connector())
        projects_index = Projects()

        query_kwargs = utils.resolv_filters(projects_index, None, pid, tid,
                                            None, None, dfrom, dto, inc_repos,
                                            None, None, None, None)

        p_filter = [":".join(r.split(':')[:-1]) for r in query_kwargs['repos']]
        dfrom = query_kwargs['fromdate']
        dto = query_kwargs['todate']
        ret = [r['_source'] for r in t.get_tags(p_filter, dfrom, dto)]
        # TODO: if tid is given we can include user defined releases
        # for repo tagged with tid.
        if not pid:
            return ret
        # now append user defined releases
        ur = {}
        project = projects_index.get_projects()[pid]
        for repo in project['repos']:
            if 'releases' in repo:
                for release in repo['releases']:
                    ur[release['name']] = {
                        'name': release['name'],
                        'date': release['date'],
                        'repo': repo['name']
                    }
        for rel in ur.values():
            ret.append(rel)
        return ret
예제 #2
0
 def get_projects(self):
     projects_index = Projects()
     projects = projects_index.get_projects()
     projects = OrderedDict(
         sorted(projects.items(), key=lambda t: t[0]))
     tags = projects_index.get_tags()
     return {'projects': projects,
             'tags': tags.keys()}
예제 #3
0
 def get_status(self):
     projects_index = Projects()
     projects = projects_index.get_projects(source=['name', 'refs'])
     num_projects = len(projects)
     num_repos = len(set([
         ref['name'] for
         ref in itertools.chain(
             *[p['refs'] for p in list(projects.values())])]))
     return {'customtext': index_custom_html,
             'projects': num_projects,
             'repos': num_repos,
             'users_endpoint': conf.get('users_endpoint', False),
             'version': rx_version}
예제 #4
0
파일: projects.py 프로젝트: ohe/repoxplorer
 def projects(self, pid=None):
     projects_index = Projects()
     if pid:
         project = projects_index.get(pid)
         if not project:
             abort(404, detail="Project ID has not been found")
         return {pid: projects_index.get(pid)}
     else:
         projects = projects_index.get_projects(
             source=['name', 'description', 'logo', 'refs'])
         _projects = OrderedDict(
             sorted(projects.items(), key=lambda t: t[0]))
         return {'projects': _projects, 'tags': projects_index.get_tags()}
예제 #5
0
    def get_repos(self, pid=None, tid=None):
        projects_index = Projects()
        if pid:
            repos = projects_index.get_projects().get(pid)
        elif tid:
            repos = projects_index.get_tags().get(tid)
        else:
            abort(404,
                  detail="A tag ID or project ID must be passed as parameter")

        if repos is None:
            abort(404,
                  detail='Project ID or Tag ID has not been found')
        return repos
예제 #6
0
 def get_status(self):
     projects_index = Projects()
     projects = projects_index.get_projects(source=['name', 'refs'])
     num_projects = len(projects)
     num_repos = len(
         set([
             ref['name'] for ref in itertools.chain(
                 *[p['refs'] for p in projects.values()])
         ]))
     return {
         'customtext': index_custom_html,
         'projects': num_projects,
         'repos': num_repos,
         'users_endpoint': conf.get('users_endpoint', False),
         'version': rx_version
     }