forked from ksdme/org-status
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to export list of org repo
Add option to export list of org repos into different formats. Closes ksdme#6
- Loading branch information
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Exporter: | ||
NAME = None | ||
OUTPUT_FILE = None | ||
|
||
def save_org_repos_to_file(self, repos): | ||
raise NotImplementedError() | ||
|
||
def use_org_list_to_check_status(self): | ||
raise NotImplementedError() | ||
|
||
|
||
def get_all_supported_exporters(): | ||
from org_status.export.gitman import GitManExporter | ||
|
||
return [GitManExporter] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import yaml | ||
|
||
from furl import furl | ||
|
||
from org_status.export.Exporter import Exporter | ||
|
||
|
||
class GitManExporter(Exporter): | ||
NAME = 'gitman' | ||
OUTPUT_FILE = f'{os.getcwd()}/gitman.yml' | ||
|
||
@classmethod | ||
def save_org_repos_to_file(cls, repos): | ||
repo_data = [] | ||
|
||
for repo in repos: | ||
name = furl(repo.repo_url).path.segments[1] | ||
repo_data.append({'name': name, | ||
'repo': repo.repo_url, | ||
'rev': 'master'}) | ||
|
||
with open(cls.OUTPUT_FILE, 'r') as yml: | ||
config_yml = yaml.load(yml) | ||
|
||
with open(cls.OUTPUT_FILE, 'w') as yml: | ||
if config_yml['sources'] is None: | ||
config_yml['sources'] = [] | ||
|
||
for repo in repo_data: | ||
config_yml['sources'].append(repo) | ||
|
||
yaml.dump(config_yml, yml, default_flow_style=False) | ||
|
||
@classmethod | ||
def use_org_list_to_check_status(cls): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
git+https://gitlab.com/gitmate/open-source/IGitt.git#egg=IGitt | ||
requests | ||
termcolor | ||
furl |