def compile(self): super(CoffeePrecompiler, self).compile() abs_dir_from = self.abs_dir_from() abs_dir_to = self.abs_dir_to() with cuisine.cuisine_sudo(): dir_ensure(abs_dir_to, mode='777', recursive=True) cuisine.sudo('sudo coffee --compile --output %(abs_dir_to)s %(abs_dir_from)s' % {'abs_dir_from': abs_dir_from, 'abs_dir_to': abs_dir_to})
def compile(self): super(CoffeePrecompiler, self).compile() abs_dir_from = self.abs_dir_from() abs_dir_to = self.abs_dir_to() with cuisine.cuisine_sudo(): dir_ensure(abs_dir_to, mode="777", recursive=True) cuisine.sudo( "sudo coffee --compile --output %(abs_dir_to)s %(abs_dir_from)s" % {"abs_dir_from": abs_dir_from, "abs_dir_to": abs_dir_to} )
def restore_latest_media(self): dump_basename = self.latest_media_dump_basename() dump_local_path = self.local_media_dump_dir.joinpath(dump_basename) dump_remote_path = path(self.django.media_root).joinpath(dump_basename) put(str(dump_local_path), str(dump_remote_path), use_sudo=True, mode=0777) with cd(self.django.media_root): sudo("tar -xvzf %s" % dump_remote_path) with cuisine_sudo(): dir_attribs(self.django.media_root, mode='777', recursive=True) with cuisine_sudo(): file_delete(dump_remote_path)
def compile(self): super(LessPrecompiler, self).compile() abs_dir_from = self.abs_dir_from() abs_dir_to = self.abs_dir_to() with cuisine.cuisine_sudo(): dir_ensure(abs_dir_to, mode='777', recursive=True) for a_file in ls_re(abs_dir_from, '.*\\.less'): cuisine.sudo('%(lessc_path)s %(dir_from)s/%(basename)s.less %(dir_to)s/%(basename)s.css' % \ { 'lessc_path': self.lessc_path(), 'dir_from': abs_dir_from, 'dir_to': abs_dir_to, 'basename': a_file[:-5] })
def compile(self): super(LessPrecompiler, self).compile() abs_dir_from = self.abs_dir_from() abs_dir_to = self.abs_dir_to() with cuisine.cuisine_sudo(): dir_ensure(abs_dir_to, mode="777", recursive=True) for a_file in ls_re(abs_dir_from, ".*\\.less"): cuisine.sudo( "%(lessc_path)s %(dir_from)s/%(basename)s.less %(dir_to)s/%(basename)s.css" % { "lessc_path": self.lessc_path(), "dir_from": abs_dir_from, "dir_to": abs_dir_to, "basename": a_file[:-5], } )
def setup(self): if not file_exists(self.lessc_path()): print("Installing Node and Less") cuisine.sudo("sudo apt-get --yes install python-software-properties") cuisine.sudo("sudo add-apt-repository ppa:chris-lea/node.js --yes") cuisine.sudo("sudo apt-get --yes update") cuisine.sudo("sudo apt-get --yes install nodejs") cuisine.run("curl http://npmjs.org/install.sh | sudo sh") with cd('~'): cuisine.run("npm install less") else: print ("Less is already installed")
def refresh_sources(self): sudo("apt-get update")
def disable_ntpd(self): sudo('service ntp stop')
def enable_ntpd(self): sudo('service ntp start')
def refresh_sources(self): sudo('apt-get update')
def stop(self): sudo("service apache2 stop")
def start(self): sudo("service apache2 start")
def restart(self): sudo("service apache2 restart")
def drop_database(self): sudo("service postgresql restart") sudo("echo DROP DATABASE %s | psql" % self.database_name, user=self.superuser_login)
def enable_ntpd(self): sudo("service ntp start")
def copy_directory_content(from_dir, to_dir): cuisine.sudo("cp -pr %s/* %s" % (from_dir, to_dir))
def disable_ntpd(self): sudo("service ntp stop")