Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanBluth committed Apr 8, 2016
1 parent 9ad631c commit 4448ecd
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions scenarioEditor/gitlab_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def get_project_url():
username = configParser.get('contents', 'username')
url = configParser.get('contents', 'url')
return url + "/" + username + "/" + proj


def get_project_name():
configParser = ConfigParser.RawConfigParser()
Expand Down
73 changes: 73 additions & 0 deletions scenarioEditor/gitlab_utility.py.tmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import os

import gitlab
import ConfigParser
import base64

def get_config():
configParser = ConfigParser.RawConfigParser()
configFilePath = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gitlab.cnf')
configParser.read(configFilePath)
return (configParser.get('contents', 'url'), configParser.get('contents', 'token'))

def login():
config = get_config()
return gitlab.Gitlab(config[0], config[1])


def get_project_id_by_name(project_name):
git = login()
proj_id = -1
for project in git.getprojects():
if project['name'] == project_name:
proj_id = project['id']

if proj_id == -1:
raise ValueError('Invalid Project Name')
return proj_id


def create_file(project_name, branch, file, file_contents, encoding):
git = login()
proj_id = get_project_id_by_name(project_name)
if encoding == "base64":
file_contents = base64.b64encode(file_contents)
return git.createfile(proj_id, file, branch, file_contents, "Content Created", encoding)


def update_file(project_name, branch, file, file_contents, encoding):
git = login()
proj_id = get_project_id_by_name(project_name)
if encoding == "base64":
file_contents = base64.b64encode(file_contents)
return git.updatefile(proj_id, file, branch, file_contents, "Content Updated", encoding)


def delete_file(file, branch):
git = login()
project_name = get_project_name()
proj_id = get_project_id_by_name(project_name)
return git.deletefile(proj_id, file, branch, 'Content Deleted')


def get_project_url():
configParser = ConfigParser.RawConfigParser()
configFilePath = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gitlab.cnf')
configParser.read(configFilePath)
proj = configParser.get('contents', 'project')
username = configParser.get('contents', 'username')
url = configParser.get('contents', 'url')
return url + "/" + username + "/" + proj

def get_project_name():
configParser = ConfigParser.RawConfigParser()
configFilePath = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gitlab.cnf')
configParser.read(configFilePath)
return configParser.get('contents', 'project')


def create_branch_if_not_exists(name):
git = login()
branches = git.getbranches(get_project_id_by_name(get_project_name()))
if name not in branches:
git.createbranch(get_project_id_by_name(get_project_name()), name, "master")
6 changes: 3 additions & 3 deletions templates/sweetheartsquad/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</div>
<div class="container-fluid">
<div class="row row-centered">
<div class="col-md-1 col-centered center-text"><a class="h4 dark-grey" href="https://sweetheartsquad.itch.io/party-darling">Party Darling</a></div>
<div class="col-md-1 col-centered center-text"><a class="h4 dark-grey" href="{% url 'sweetheartsquad.views.stengine' %}">S-Tengine 2</a></div>
<div class="col-md-1 col-centered center-text"><a class="h4 dark-grey" href="https://sweetheartsquad.itch.io/party-darling">Party, Darling?</a></div>
<div class="col-md-1 col-centered center-text"><a class="h4 dark-grey" href="{% url 'sweetheartsquad.views.stengine' %}">S&#8209;Tengine 2</a></div>
<div class="col-md-1 col-centered center-text"><a class="h4 dark-grey" href="http://sweetheartsquad.itch.io/">Games</a></div>
</div>
</div>
Expand All @@ -27,7 +27,7 @@
<div class="container">
<h1 class="center">SweetHeart Squad</h1>
<h4 class="center">
We are a gaggle of game makers from Ottawa working a custom engine and a plethora of playable titles. We’re all fourth-year students studying Interactive Multimedia and Design at Carleton University.
We are a gaggle of game makers from Ottawa working on a custom engine and a plethora of playable titles. We’re all fourth-year students studying Interactive Multimedia and Design at Carleton University.
</h4>
<div id="team">
<div class="container">
Expand Down

0 comments on commit 4448ecd

Please sign in to comment.