-
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.
feat(project_manager): Add functionality for git version control
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
Showing
26 changed files
with
499 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,6 @@ | ||
""" | ||
Holding application variables used by other files here. | ||
""" | ||
|
||
__application__ = 'datanexus' | ||
__author__ = 'ameadows' | ||
__version__ = '0.0.1' |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
__author__ = 'ameadows' |
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,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_() | ||
|
||
|
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,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 |
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 @@ | ||
__author__ = 'ameadows' |
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,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: | ||
""" | ||
|
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 @@ | ||
__author__ = 'ameadows' |
Oops, something went wrong.