Skip to content

Commit

Permalink
added python-veracity dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Nov 19, 2013
1 parent 0505d33 commit 936d903
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 11 deletions.
1 change: 1 addition & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<name>Doorstop</name>
<comment></comment>
<projects>
<project>python-veracity</project>
</projects>
<buildSpec>
<buildCommand>
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ all: develop
.PHONY: develop
develop: .env $(EGG_INFO)
$(EGG_INFO): $(SOURCES)
$(PIP) install pbs # TODO: https://github.com/larroy/pbs/issues/1
$(PYTHON) setup.py develop
touch $(EGG_INFO) # flag to indicate package is installed

Expand All @@ -47,7 +48,7 @@ $(PIP):
.PHONY: depends
depends: .env $(DEPENDS) $(SOURCES)
$(DEPENDS):
$(PIP) install docutils pdoc pep8 nose coverage --download-cache=$(CACHE)
$(PIP) install docutils pdoc pep8 nose coverage wheel --download-cache=$(CACHE)
$(MAKE) .pylint
touch $(DEPENDS) # flag to indicate dependencies are installed

Expand Down Expand Up @@ -133,11 +134,11 @@ clean-all: clean
# Release ####################################################################

.PHONY: dist
dist: develop
dist: develop depends
$(PYTHON) setup.py sdist
$(PYTHON) setup.py bdist_wheel

.PHONY: upload
upload: develop
upload: develop depends
$(PYTHON) setup.py register sdist upload
$(PYTHON) setup.py bdist_wheel upload
3 changes: 2 additions & 1 deletion doorstop/core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Node(object):

def __init__(self, document, parent=None, root=None):
self.document = document
self.root = root or document.root # allows non-documents to be used in tests
self.root = root or document.root # allows non-documents in tests
self.parent = parent
self.children = []
self._vcs = None
Expand Down Expand Up @@ -104,6 +104,7 @@ def from_list(docs, root=None):

@property
def vcs(self):
"""Get the working copy."""
if self._vcs is None:
self._vcs = vcs.load(self.root)
return self._vcs
Expand Down
2 changes: 1 addition & 1 deletion doorstop/core/vcs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def lock(self, path): # pragma: no cover - abstract method
raise NotImplementedError()

@abstractmethod
def save(self): # pragma: no cover - abstract method
def save(self, message=None): # pragma: no cover - abstract method
"""Unlock files, commit, and push."""
raise NotImplementedError()
2 changes: 1 addition & 1 deletion doorstop/core/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ class WorkingCopy(BaseWorkingCopy): # pragma: no cover - integration test
def lock(self, path):
logging.warning("git does not support locking: {}".format(path))

def save(self):
def save(self, message=None):
raise NotImplementedError("TODO: add git add/commit/push")
2 changes: 1 addition & 1 deletion doorstop/core/vcs/mockvcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ class WorkingCopy(BaseWorkingCopy): # pragma: no cover - integration test
def lock(self, path):
logging.info("simulated lock on: {}...".format(path))

def save(self):
def save(self, message=None):
logging.info("simulated save")
24 changes: 21 additions & 3 deletions doorstop/core/vcs/veracity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
Plug-in module to store requirements in a Veracity repository.
"""

import logging

from veracity import WorkingCopy as VeracityWorkingCopy

from doorstop.core.vcs.base import BaseWorkingCopy


Expand All @@ -12,8 +16,22 @@ class WorkingCopy(BaseWorkingCopy): # pragma: no cover - integration test

DIRECTORY = '.sgdrawer'

def __init__(self, path):
super().__init__(path)
self._wc = VeracityWorkingCopy(path)

def lock(self, path):
raise NotImplementedError("TODO: add veracity lock")
"""Pull and lock the item for editing."""
self._wc.repo.pull()
# TODO: item locking requires password input
# tracker: http://veracity-scm.com/qa/questions/2034
# item = Item(path, work=self._wc)
# item.lock()
msg = "veracity does not support scripted locking: {}".format(path)
logging.warning(msg)

def save(self):
raise NotImplementedError("TODO: add veracity commit/push")
def save(self, message=None):
"""Commit and push changes."""
message = message or input("Commit message: ") # pylint: disable=W0141
self._wc.commit(message)
self._wc.repo.push()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
long_description=open('README.rst').read(),
license='LGPL',

install_requires=["wheel", "PyYAML >= 3.10"],
install_requires=["PyYAML >= 3.10", "python-veracity >= 0.0.10"],
)

0 comments on commit 936d903

Please sign in to comment.