def _execute(self, options, args): """Start the watcher.""" try: from livereload.task import Task from livereload.server import start except ImportError: print('To use the auto command, you need to install the ' '"livereload" package.') return # Run an initial build so we are uptodate subprocess.call(("nikola", "build")) port = options and options.get('port') # Create a Guardfile with open("Guardfile", "wb+") as guardfile: l = ["conf.py", "themes", "templates", self.site.config['GALLERY_PATH']] for item in self.site.config['post_pages']: l.append(os.path.dirname(item[0])) for item in self.site.config['FILES_FOLDERS']: l.append(os.path.dirname(item)) guardfile.write(GUARDFILE.format(json.dumps(l))) out_folder = self.site.config['OUTPUT_FOLDER'] os.chmod("Guardfile", 0o755) start(port, out_folder, options and options.get('browser'))
def _execute(self, options, args): """Start the watcher.""" try: from livereload.server import start except ImportError: print('To use the auto command, you need to install the ' '"livereload" package.') return # Run an initial build so we are uptodate subprocess.call(("nikola", "build")) port = options and options.get('port') # Create a Guardfile with open("Guardfile", "wb+") as guardfile: l = [ "conf.py", "themes", "templates", self.site.config['GALLERY_PATH'] ] for item in self.site.config['post_pages']: l.append(os.path.dirname(item[0])) for item in self.site.config['FILES_FOLDERS']: l.append(os.path.dirname(item)) guardfile.write(GUARDFILE.format(json.dumps(l))) out_folder = self.site.config['OUTPUT_FOLDER'] os.chmod("Guardfile", 0o755) start(port, out_folder, options and options.get('browser'))
def _execute(self, options, args): """Start the watcher.""" try: from livereload.server import start except ImportError: req_missing(['livereload'], 'use the "auto" command') return # Run an initial build so we are uptodate subprocess.call(("nikola", "build")) port = options and options.get('port') # Create a Guardfile with codecs.open("Guardfile", "wb+", "utf8") as guardfile: l = ["conf.py", "themes", "templates", self.site.config['GALLERY_PATH']] for item in self.site.config['post_pages']: l.append(os.path.dirname(item[0])) for item in self.site.config['FILES_FOLDERS']: l.append(os.path.dirname(item)) data = GUARDFILE.format(json.dumps(l)) guardfile.write(data) out_folder = self.site.config['OUTPUT_FOLDER'] os.chmod("Guardfile", 0o755) start(port, out_folder, options and options.get('browser'))
def main(): args = docopt(cmd, sys.argv[2:]) port = args.get('--port') if port: port = int(port) else: port = 35729 server.start(port)
def main(): args = docopt(cmd) port = args.get('--port') if port: port = int(port) else: port = 35729 server.start(port)
def main(): args = docopt(cmd) port = args.get('--port') root = args.get('--directory') if port: port = int(port) else: port = 35729 server.start(port, root)