Skip to content

Commit

Permalink
feat(project_manager): Add functionality for git version control
Browse files Browse the repository at this point in the history
Working on initial setup of project manager.  Adding basic git functionality.
  • Loading branch information
Alex Meadows committed Sep 13, 2015
1 parent b39c6f5 commit 0869963
Show file tree
Hide file tree
Showing 26 changed files with 499 additions and 117 deletions.
12 changes: 12 additions & 0 deletions .idea/dataNexus.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions .idea/sonarIssues.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion datanexus/__init__.py
@@ -1,6 +1,6 @@
"""
Holding application variables used by other files here.
"""

__application__ = 'datanexus'
__author__ = 'ameadows'
__version__ = '0.0.1'
14 changes: 10 additions & 4 deletions datanexus/dataNexus.py
Expand Up @@ -4,12 +4,18 @@

__author__ = 'ameadows'

from utilities.settings_manager import SettingsManager


from datanexus.utilities.settings_manager import SettingsManager
from datanexus.gui.main_window import MainWindow
from datanexus import __version__
def main():
return True
"""
Load up background processes (TO DO) and open the primary window.
:return:
"""

MainWindow().create_main_window(__version__)

if __name__ == '__main__':
SettingsManager.first_run_test()
#SettingsManager.first_run_test()
main()
1 change: 1 addition & 0 deletions datanexus/gui/__init__.py
@@ -0,0 +1 @@
__author__ = 'ameadows'
48 changes: 48 additions & 0 deletions datanexus/gui/main_window.py
@@ -0,0 +1,48 @@
"""
Main window class for dataNexus. Acts as the main interface for the application.
"""

__author__ = 'ameadows'


import sys
import logging
from PySide.QtGui import QMainWindow, QApplication, QWidget, QLabel, QAction

from datanexus.gui.menu import Menu

class MainWindow(QMainWindow):
"""
Creates the main window for dataNexus. Also handles any functions for the main window.
"""
def __init__(self):
"""
Initializes the application and logging for the MainWindow class.
"""
self.app = QApplication(sys.argv)

def create_main_window(self, version):
"""
Creates the main application window and returns it.
:param version: The application's version number, found in the project root-level __init__.py
:return:
"""

window = QMainWindow()
window.setMinimumSize(800, 600)
window.setWindowTitle("dataNexus v" + version)

# Create the menu for main window.
menu = window.menuBar()

sub_menus = Menu(menu, window)

sub_menus.create_file_menu()
sub_menus.create_edit_menu()
sub_menus.create_about_menu()

window.show()

self.app.exec_()


59 changes: 59 additions & 0 deletions datanexus/gui/menu.py
@@ -0,0 +1,59 @@
"""
Menu handles the menu for dataNexus, including all submenus.
"""

__author__ = 'ameadows'

from PySide.QtGui import QMenu, QAction

class Menu:
"""
Creates the sub-menus for the main window's menu-bar.
"""

def __init__(self, menu, window):
"""
:param menu: The main window menu.
:param window: The main window object.
"""
self.menu = menu
self.window = window

def create_file_menu(self):
"""
Creates the sub-menu for the File menu.
:return: file_menu: File menu with revised actions.
"""
file_menu = self.menu.addMenu("File")

# Create project allows for new project creation.
create_project_action = QAction("Create Project", )

# The way to quit the application from the File menu.
exit_action = QAction("Exit", self.window)
exit_action.triggered.connect(exit)


file_menu.addAction(exit_action)

return file_menu

def create_edit_menu(self):
"""
Creates the sub-menu for the Edit menu.
:return: edit_menu: Edit menu with revised actions.
"""
edit_menu = self.menu.addMenu("Edit")

return edit_menu

def create_about_menu(self):
"""
Creates the sub-menu for the About menu.
:return: about_menu: About menu with revised actions.
"""

about_menu = self.menu.addMenu("About")

return about_menu
1 change: 1 addition & 0 deletions datanexus/project_manager/__init__.py
@@ -0,0 +1 @@
__author__ = 'ameadows'
136 changes: 136 additions & 0 deletions datanexus/project_manager/project_manager.py
@@ -0,0 +1,136 @@
"""
projectManager handles the creation, modification, and other project actions.
This will involve working with version control tools (primarily git) to create and maintain projects within dataNexus.
"""

__author__ = 'ameadows'

from os.path import join
from os import path, makedirs
import logging

from datanexus.project_manager.version_control.git_manager import GitManager

from datanexus.utilities.settings_manager import SettingsManager
from datanexus.utilities.logging_setup import console


class ProjectManager:
"""
ProjectManager handles projects.
"""

def __init__(self, project_name, project_dir, vc_type="git"):
"""
ProjectManager requires the version control type. By default, it's git. Eventually other version control
systems may be allowed, but main focus is on git.
:param vc_type Type of version control in use by the project.
:type vc_type: str
:param project_name: Name of the project.
:type project_name: str
:param project_dir: Path to where the project will live
:type project_dir: str
"""
self.log = logging.getLogger(name='ProjectManager')
self.log.addHandler(console)

workspace = SettingsManager().find_setting('Locations', 'workspace')

self.vc_type = vc_type
self.project_name = project_name
self.project_loc = join(workspace, project_dir)

# Default list of directories that are built at project creation
self.dir_list = ["table", "index", "stored_procedure", "sequence", "trigger", "view", "query"]

def create_new_project(self):
"""
Create a new dataNexus project based on the version control type (default git).
:return:
"""
# Determine if the directory is empty.
if path.isdir(project_loc):
self.log.info("Project directory is not empty!")

# Based on vc_type, create the repository.

project = GitManager().create_git_project(self.project_loc)

for folder in self.dir_list:
dir_path = path.join(self.project_loc, dir)
os.makedirs(dir_path)

#TODO: Add blank root yaml file for listing objects.



def open_project(self):
"""
Opens an existing dataNexus project, within dataNexus.
:return:
"""

"""
Open the existing project
"""

def close_project(self):
"""
Closes an existing open project.
:return:
"""

def check_project_exists(self):
"""
Checks to see if the project already exists, based on project_name. Then tests to ensure that project_dir is
empty.
:return:
"""

def import_project(self):
"""
Imports existing project into dataNexus. Will pull remote version controlled code into local.
"""

def add_project_files(self):
"""
Adds any missing files into version control.
:return:
"""

def ignore_project_files(self):
"""
Ignores selected files from version control.
:return:
"""

def commit_project_files(self):
"""
Commits files into version control.
:return:
"""

def push_project_files(self):
"""
Pushes files into remote repository.
:return:
"""

def pull_project_files(self):
"""
Pulls files from remote repository
:return:
"""

def create_project_branch(self):
"""
Creates new project branch from a selected branch.
:return:
"""

def merge_project_branch(self):
"""
Merges the current branch into a selected branch.
:return:
"""

1 change: 1 addition & 0 deletions datanexus/project_manager/version_control/__init__.py
@@ -0,0 +1 @@
__author__ = 'ameadows'

0 comments on commit 0869963

Please sign in to comment.