Skip to content

Commit

Permalink
ghi-create.py: initial organization using headers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-mbm committed Jun 28, 2015
1 parent f36d055 commit 111a878
Showing 1 changed file with 53 additions and 27 deletions.
80 changes: 53 additions & 27 deletions ghi-create.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,30 @@
#
# Na maturidade este programa estará integrado como comando do paicemana.
#
# @ alexandre-mbm ‒ Alexandre Magno ‒ [email protected]
# @alexandre-mbm ‒ Alexandre Magno ‒ [email protected]
#
############################ Variables #####################################

translators = ['alexandre-mbm', 'jgpacker', 'vgeorge']

milestone = 1 # 256 (1), 257 (2)
label = 'revisão' # tradução, revisão, movimento, conserto

label_t = 'tradução' # tradução, revisão, movimento, conserto
label_r = 'revisão' # tradução, revisão, movimento, conserto

filename = 'archive-4205.md'

repo_user = 'OSMBrasil'
repo_name = 'semanario'

from github3 import login, GitHub
from paicemana.mdanalyzer import MarkdownAnalyzer

analyzer = MarkdownAnalyzer(filename)
organizer = analyzer.getOrganizer()
organizer.distribute_for(translators)

for section in organizer.sections:
print(section.score, section.translator, section.reviser, section.name)

exit(0)
############################# Preload ######################################

from paicemana.mdanalyzer import MarkdownAnalyzer
from getpass import getpass, getuser
from github3 import login, GitHub

import sys

try:
import readline
except ImportError:
Expand All @@ -51,27 +49,55 @@
except NameError:
pass

try:
user = input('GitHub username: ')
except KeyboardInterrupt:
user = getuser()
############################# Functions ####################################

def get_github():

try:
user = input('GitHub username: ')
except KeyboardInterrupt:
user = getuser()

password = getpass('GitHub password for {0}: '.format(user))
password = getpass('GitHub password for {0}: '.format(user))

# Obviously you could also prompt for an OAuth token
if not (user and password):
print("Cowardly refusing to login without a username and password.")
sys.exit(1)
# Obviously you could also prompt for an OAuth token
if not (user and password):
print("Cowardly refusing to login without a username and password.")
sys.exit(1)

github = login(user, password)
return login(user, password)

############################# Program ######################################

analyzer = MarkdownAnalyzer(filename)
organizer = analyzer.getOrganizer()
organizer.distribute_for(translators)

for section in organizer.sections:
print(section.score, section.translator, section.reviser, section.name)

#exit(0)

github = get_github()

repo = github.repository(repo_user, repo_name)

for card in cards:
exit(0) # TODO main flow and populate function

for section in organizer.sections:
repo.create_issue(
section.name,
body=None,
assignee=section.translator,
milestone=milestone,
labels=[label_t]
)

for section in organizer.sections:
repo.create_issue(
card['section'],
section.name,
body=None,
assignee=card['translator'],
assignee=section.reviser,
milestone=milestone,
labels=[label]
labels=[label_r]
)

0 comments on commit 111a878

Please sign in to comment.