Skip to content

Commit

Permalink
Complete the scaffolder command. Fixes #38
Browse files Browse the repository at this point in the history
  • Loading branch information
mblayman committed Oct 6, 2015
1 parent 10d7e94 commit 6c70c48
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ include README.md
include requirements.txt
recursive-include docs *
recursive-include handroll/locale *
recursive-include handroll/scaffolds *
prune docs/_build
5 changes: 4 additions & 1 deletion handroll/scaffolder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2015, Matt Layman

import os
import shutil

from handroll.exceptions import AbortError
from handroll.i18n import _
Expand All @@ -9,6 +10,7 @@
'default': _('A complete site to get you going'),
}
LIST_SCAFFOLDS = 1
SCAFFOLDS_PATH = os.path.join(os.path.dirname(__file__), 'scaffolds')


def make(scaffold, site):
Expand Down Expand Up @@ -45,4 +47,5 @@ def make_scaffold(scaffold, site):
if os.path.exists(site):
raise AbortError(_('{site} already exists.'.format(site=site)))
os.makedirs(site)
# TODO: populate the site with content from the scaffold.
scaffold_path = os.path.join(SCAFFOLDS_PATH, scaffold)
shutil.copytree(scaffold_path, os.path.join(site, 'source'))
Empty file.
7 changes: 7 additions & 0 deletions handroll/tests/test_scaffolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ def test_makes_site_root(self):
site = os.path.join(parent, 'site')
scaffolder.make_scaffold('default', site)
self.assertTrue(os.path.exists(site))

def test_copies_scaffold_to_source(self):
parent = tempfile.mkdtemp()
site = os.path.join(parent, 'site')
conf = os.path.join(site, 'source', 'handroll.conf')
scaffolder.make_scaffold('default', site)
self.assertTrue(os.path.exists(conf))

0 comments on commit 6c70c48

Please sign in to comment.