aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command_init.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2012-12-12 20:15:48 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2012-12-12 20:15:48 -0300
commit0f2c04e70a0ffdd0892d6970cafbcd952d221db5 (patch)
treed36f7747c4b9cb5c5e00cae5b137d22214b1c7be /nikola/plugins/command_init.py
parentca1f5a392261a7c6b82b5ac1015427605909d8c9 (diff)
Imported Upstream version 5upstream/5
Diffstat (limited to 'nikola/plugins/command_init.py')
-rw-r--r--nikola/plugins/command_init.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/nikola/plugins/command_init.py b/nikola/plugins/command_init.py
new file mode 100644
index 0000000..a032370
--- /dev/null
+++ b/nikola/plugins/command_init.py
@@ -0,0 +1,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."