def create(self, args): """ The create command. Creates a new site from the template at the given sitepath. """ sitepath = self.main(args) markers = ['content', 'layout', 'site.yaml'] exists = any((FS(sitepath.child(item)).exists for item in markers)) if exists and not args.overwrite: raise HydeException( "The given site path [%s] already contains a hyde site." " Use -f to overwrite." % sitepath) layout = Layout.find_layout(args.layout) self.logger.info("Creating site at [%s] with layout [%s]" % (sitepath, layout)) if not layout or not layout.exists: raise HydeException( "The given layout is invalid. Please check if you have the" " `layout` in the right place and the environment variable(%s)" " has been setup properly if you are using custom path for" " layouts" % HYDE_DATA) layout.copy_contents_to(args.sitepath) self.logger.info("Site creation complete")