blob: a03237056ccb29ff8200d4455ea09e8fe005909a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
from optparse import OptionParser
import os
import shutil
import nikola
from nikola.plugin_categories import Command
class CommandInit(Command):
"""Create a new site."""
name = "init"
usage = """Usage: nikola init folder [options].
That will create a sample site in the specified folder.
The destination folder must not exist.
"""
def run(self, *args):
"""Create a new site."""
parser = OptionParser(usage=self.usage)
(options, args) = parser.parse_args(list(args))
target = args[0]
if target is None:
print self.usage
else:
src = os.path.join(os.path.dirname(nikola.__file__),
'data', 'samplesite')
shutil.copytree(src, target)
print "A new site with some sample data has been created at %s."\
% target
print "See README.txt in that folder for more information."
|