Skip to content

Commit

Permalink
Only work with known scaffolds.
Browse files Browse the repository at this point in the history
  • Loading branch information
mblayman committed Oct 3, 2015
1 parent d964ef8 commit 112b94a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion handroll/scaffolder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) 2015, Matt Layman

from handroll.exceptions import AbortError
from handroll.i18n import _

BUILTIN_SCAFFOLDS = {
Expand Down Expand Up @@ -36,7 +37,9 @@ def get_label(scaffold):

def make_scaffold(scaffold, site):
"""Make a site from the scaffold."""
# TODO: check that the scaffold is available.
if scaffold not in BUILTIN_SCAFFOLDS:
raise AbortError(_('There is no {scaffold} scaffold.'.format(
scaffold=scaffold)))
# TODO: check the site does not exist.
# TODO: make the site directory.
# TODO: populate the site with content from the scaffold.
8 changes: 8 additions & 0 deletions handroll/tests/test_scaffolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import mock

from handroll import scaffolder
from handroll.exceptions import AbortError
from handroll.i18n import _
from handroll.tests import TestCase

Expand All @@ -28,3 +29,10 @@ def test_displays_scaffolds(self, display_scaffold):
def test_makes_scaffold(self, make_scaffold):
scaffolder.make('default', 'site')
make_scaffold.assert_called_once_with('default', 'site')

def test_unknown_scaffold_aborts(self):
try:
scaffolder.make_scaffold('fake', 'dontcare')
self.fail()
except AbortError:
pass

0 comments on commit 112b94a

Please sign in to comment.