def _create_class(self, name, superclass): """Create a skeleton PHP class.""" path = self._prepare_path_to(name) if os.path.isfile(path): raise OSError("File exists: " + path) dest = open(path, "w") dest.write(self._fill_template(name, superclass)) dest.close() print "Created file " + abbreviate(path, 65)
def put_config(self, elem): """Write a formatted serialisation of elem to a module configuration file. """ dest = open(self.module.cfg_path, "w") dest.write('<?xml version="1.0"?>\n') dest.write(etree.tostring(elem, pretty_print=True)) dest.close() print "Updated file " + abbreviate(self.module.cfg_path, 65)
def _print_feedback(self): print "Created %d files:" % (len(self._files_created),) for f in self._files_created: print abbreviate(f)