Skip to content

Commit

Permalink
Add missing copy function and add example
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Dec 6, 2014
1 parent 85189b9 commit 322c150
Show file tree
Hide file tree
Showing 23 changed files with 58 additions and 22 deletions.
9 changes: 5 additions & 4 deletions Makefile
Expand Up @@ -14,6 +14,7 @@ endif
PROJECT := Doorstop
PACKAGE := doorstop
SOURCES := Makefile setup.py $(shell find $(PACKAGE) -name '*.py')
YAML := $(shell find . -name '*.yml' -not -path '*/test/files/*')
EGG_INFO := $(subst -,_,$(PROJECT)).egg-info

# System paths
Expand Down Expand Up @@ -74,7 +75,7 @@ ALL := $(ENV)/.all

.PHONY: all
all: depends $(ALL)
$(ALL): $(SOURCES)
$(ALL): $(SOURCES) $(YAML)
$(MAKE) doc pep8 pep257
touch $(ALL) # flag to indicate all setup steps were successful

Expand Down Expand Up @@ -147,17 +148,17 @@ reqs: doorstop reqs-html reqs-md reqs-txt

.PHONY: reqs-html
reqs-html: env docs/gen/*.html
docs/gen/*.html: $(shell find . -name '*.yml' -not -path '*/test/files/*')
docs/gen/*.html: $(YAML)
$(BIN)/doorstop publish all docs/gen --html

.PHONY: reqs-md
reqs-md: env docs/gen/*.md
docs/gen/*.md: $(shell find . -name '*.yml' -not -path '*/test/files/*')
docs/gen/*.md: $(YAML)
$(BIN)/doorstop publish all docs/gen --markdown

.PHONY: reqs-txt
reqs-txt: env docs/gen/*.txt
docs/gen/*.txt: $(shell find . -name '*.yml' -not -path '*/test/files/*')
docs/gen/*.txt: $(YAML)
$(BIN)/doorstop publish all docs/gen --text

.PHONY: uml
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ001.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 1.3
level: 2.3
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ002.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 1.0
level: 2.0
links: []
normative: false
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ003.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 1.1
level: 2.1
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ004.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 1.2
level: 2.2
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ006.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 2.0
level: 3.0
links: []
normative: false
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ007.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 2.1
level: 3.1
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ008.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 2.2
level: 3.2
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ009.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 2.3
level: 3.3
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ010.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 3.0
level: 4.0
links: []
normative: false
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ011.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 3.1
level: 4.1
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ012.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 3.2
level: 4.2
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ013.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 3.3
level: 4.3
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ014.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 3.4
level: 4.4
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ015.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 3.5
level: 4.5
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ016.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 1.4
level: 2.4
links: []
normative: true
ref: ''
Expand Down
2 changes: 1 addition & 1 deletion docs/reqs/REQ017.yml
@@ -1,6 +1,6 @@
active: true
derived: false
level: 1.5
level: 2.5
links: []
normative: true
ref: ''
Expand Down
9 changes: 9 additions & 0 deletions docs/reqs/REQ018.yml
@@ -0,0 +1,9 @@
active: true
derived: false
level: 1.0
links: []
normative: false
ref: ''
reviewed: 36dc57d43cb60ffc9f05ffb055ac4994
text: |
Overview
13 changes: 13 additions & 0 deletions docs/reqs/REQ019.yml
@@ -0,0 +1,13 @@
active: true
derived: false
level: 1.1
links: []
normative: false
ref: ''
reviewed: e6e5ef2698c5bbdf432abdd2f26d4bcf
text: |
Doorstop is a requirements management tool that leverages version control to
store and manage a project's documentation traced from specification through
implementation.
![Doorstop Logo](assets/logo-black-white.png "Doorstop Logo")
1 change: 1 addition & 0 deletions docs/reqs/assets/logo-black-white.png
2 changes: 1 addition & 1 deletion doorstop/cli/test/test_all.py
Expand Up @@ -16,7 +16,7 @@
from doorstop.cli.test import SettingsTestCase

REQ_COUNT = 14
ALL_COUNT = 44
ALL_COUNT = 46


class TempTestCase(unittest.TestCase):
Expand Down
10 changes: 10 additions & 0 deletions doorstop/common.py
Expand Up @@ -2,6 +2,7 @@

import os
import shutil
from distutils import dir_util
import argparse
import logging

Expand Down Expand Up @@ -178,6 +179,15 @@ def touch(path): # pragma: no cover (integration test)
write_text('', path)


def copy(src, dst):
"""Copy a file or directory."""
if os.path.isfile(src):
delete(dst)
shutil.copy(src, dst)
elif os.path.isdir(src):
dir_util.copy_tree(src, dst)


def delete(path): # pragma: no cover (integration test)
"""Delete a file or directory with error handling."""
if os.path.isdir(path):
Expand Down
4 changes: 3 additions & 1 deletion doorstop/core/publisher.py
Expand Up @@ -54,7 +54,9 @@ def publish(obj, path, ext=None, linkify=None, index=None, **kwargs):
lines = publish_lines(obj2, ext, linkify=linkify, **kwargs)
common.write_lines(lines, path2)
if obj2.assets:
common.copy(obj2.assets, os.path.join(path2, obj2.ASSETS))
src = obj2.assets
dst = os.path.join(os.path.dirname(path2), obj2.ASSETS)
common.copy(src, dst)

# Create index
if index and count:
Expand Down

0 comments on commit 322c150

Please sign in to comment.