return buf.getvalue()
+ def output_ruby(self, show_comments = True, encoding = "utf-8"):
+ """
+ Return variables as a shell script.
+ """
+
+ buf = codecs.lookup(encoding)[3](StringIO())
+ buf.writelines(["# " + line + os.linesep for line in self._header()])
+
+ for (category_id, (category, variables)) in self._variables.iteritems():
+ for variable in variables.values():
+ (id, name, value, comments) = self._sanitize_variable(category_id, variable)
+ if show_comments:
+ buf.write(os.linesep)
+ if name is not None:
+ buf.write("# " + name + os.linesep)
+ if comments is not None:
+ buf.writelines(["# " + line + os.linesep for line in comments])
+ # bash does not have the concept of NULL
+ if value is not None:
+ buf.write("$" + id.lower() + "=" + value + os.linesep)
+
+ return buf.getvalue()
+
+
+
def output_php(self, encoding = "utf-8"):
"""