Skip to content

Commit

Permalink
optional template site folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jun 10, 2012
1 parent da0498b commit 4921c57
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/nikola
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ import sys

import nikola

USAGE = """To create a new site in a folder, run "nikola init foldername".
USAGE = """To create a new site in a folder, run "nikola init foldername [src]".
The destination folder must not exist.
If you pass the src argument, that folder will be used as a template for
the new site instead of Nikola's sample site.
"""


def init(dst):
"""Create a copy of demosite in the current folder."""
src = os.path.join(os.path.dirname(nikola.__file__),'data','samplesite')
if len(sys.argv) > 3:
src = sys.argv[3]
else:
src = os.path.join(os.path.dirname(nikola.__file__),'data','samplesite')
shutil.copytree(src, dst)
print "A new site with some sample data has been created at %s." % dst
print "See README.txt in that folder for more information."

if __name__ == "__main__":
if len(sys.argv)==3 and sys.argv[1] == "init":
if len(sys.argv)>=3 and sys.argv[1] == "init":
print "Doing init"
init(sys.argv[2])
else:
Expand Down

0 comments on commit 4921c57

Please sign in to comment.