Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add note to top of generated ini files

  • Loading branch information...
commit abe385cc74ad4b66380a10ac9728720fdd09c0a0 1 parent 14f8467
@kemitche kemitche authored
Showing with 25 additions and 0 deletions.
  1. +5 −0 r2/Makefile
  2. +10 −0 r2/example.ini
  3. +10 −0 r2/updateini.py
View
5 r2/Makefile
@@ -73,11 +73,16 @@ clean_i18n:
UPDATE_FILES := $(wildcard *.update)
INIFILES := $(UPDATE_FILES:.update=.ini)
+.PHONY: clean_ini
+
ini: $(INIFILES)
$(INIFILES): %.ini: %.update
./updateini.py example.ini $< > $@ || rm $@
+clean_ini:
+ rm $(INIFILES)
+
#################### Static Files
STATIC_DIR := r2/public/static
View
10 r2/example.ini
@@ -1,3 +1,13 @@
+# DO NOT EDIT THIS FILE
+# This is a base template. To apply changes to your
+# reddit instance, create a "myreddit.update" config
+# file, then run 'make ini'. 'make ini' will combine
+# this template with the myreddit.update file and create a
+# 'myreddit.ini'. ('myreddit.update' is just an example;
+# any name will do - e.g., 'foo.update' will create
+# 'foo.ini')
+
+
#
# r2 - Pylons development environment configuration
#
View
10 r2/updateini.py
@@ -4,6 +4,15 @@
from StringIO import StringIO
import sys
+HEADER = '''
+# YOU DO NOT NEED TO EDIT THIS FILE
+# This is a generated file. To update the configuration,
+# edit the *.update file of the same name, and then
+# run 'make ini'
+# Configuration settings in the *.update file will override
+# or be added to the base 'example.ini' file.
+'''
+
def main(source_ini, update_ini):
parser = Parser()
# By default, the parser is case insensitve and rewrites config
@@ -24,6 +33,7 @@ def main(source_ini, update_ini):
except MissingSectionHeaderError:
updates = "[DEFAULT]\n" + updates
parser.readfp(StringIO(updates))
+ print HEADER
parser.write(sys.stdout)
if __name__ == '__main__':
Please sign in to comment.
Something went wrong with that request. Please try again.