From 700a153bda9138adf418ae978fc1dd449d8e11f4 Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Sun, 12 Sep 2010 23:18:29 +0300 Subject: svnignore->gitignore Add media dir with static data taken from the server Add scripts dir with the cron job and the python scripts Correct the templates dir --- .gitignore | 8 +++ .svnignore | 8 --- adduser.py | 83 --------------------- gravatar.py | 8 --- media/favicon.ico | Bin 0 -> 1406 bytes media/icons/back.gif | Bin 0 -> 216 bytes media/icons/blank.gif | Bin 0 -> 148 bytes media/icons/image2.gif | Bin 0 -> 309 bytes media/images/gbot-s.gif | Bin 0 -> 2223 bytes media/images/gentoo.gif | Bin 0 -> 4789 bytes media/images/gridtest.gif | Bin 0 -> 3199 bytes media/images/gtop-s.jpg | Bin 0 -> 3157 bytes media/images/larry_the_cow.jpg | Bin 0 -> 1191 bytes media/images/opml.png | Bin 0 -> 298 bytes media/images/rss20.png | Bin 0 -> 313 bytes media/images/tux.png | Bin 0 -> 9191 bytes media/planet.css | 160 +++++++++++++++++++++++++++++++++++++++++ media/robots.txt | 1 + scripts/adduser.py | 83 +++++++++++++++++++++ scripts/gravatar.py | 8 +++ scripts/update-venus | 33 +++++++++ templates/config.ini | 2 +- 22 files changed, 294 insertions(+), 100 deletions(-) create mode 100644 .gitignore delete mode 100644 .svnignore delete mode 100644 adduser.py delete mode 100644 gravatar.py create mode 100644 media/favicon.ico create mode 100644 media/icons/back.gif create mode 100644 media/icons/blank.gif create mode 100644 media/icons/image2.gif create mode 100644 media/images/gbot-s.gif create mode 100644 media/images/gentoo.gif create mode 100644 media/images/gridtest.gif create mode 100644 media/images/gtop-s.jpg create mode 100644 media/images/larry_the_cow.jpg create mode 100644 media/images/opml.png create mode 100644 media/images/rss20.png create mode 100644 media/images/tux.png create mode 100644 media/planet.css create mode 100644 media/robots.txt create mode 100644 scripts/adduser.py create mode 100644 scripts/gravatar.py create mode 100644 scripts/update-venus diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..db4eb50 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.py +*.py.orig +*.pyc +cache +*.log +compat_logging +*.swp +*.tmplc diff --git a/.svnignore b/.svnignore deleted file mode 100644 index db4eb50..0000000 --- a/.svnignore +++ /dev/null @@ -1,8 +0,0 @@ -*.py -*.py.orig -*.pyc -cache -*.log -compat_logging -*.swp -*.tmplc diff --git a/adduser.py b/adduser.py deleted file mode 100644 index 0a4f8c2..0000000 --- a/adduser.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python - -# A simple help script to create a new planet/universe config for a new user -# Run it inside the planet/ topdir -# WARNING: Always check the changes that are made by this script before commiting -# Many thanks to Arfrever Frehtes Taifersar Arahesis (arfrever@gentoo.org) for his suggestions - -# Author: Theo Chatzimichos -# Feel free to contact me via IRC or email - -import sys -import hashlib - -# the following makes it python3 compatible -if sys.version_info[0] == 2: - input = raw_input - -def check_mail(email): - # http://commandline.org.uk/python/email-syntax-check/ - - # Ditch nonsense email addresses. - - GENERIC_DOMAINS = "aero", "asia", "biz", "cat", "com", "coop", \ - "edu", "gov", "info", "int", "jobs", "mil", "mobi", "museum", \ - "name", "net", "org", "pro", "tel", "travel" - - # Checks for a syntactically invalid email address. - # Email address must be 7 characters in total. - if len(email) < 7: - return False # Address too short - - # Split up email address into parts. - try: - localpart, domainname = email.rsplit('@', 1) - host, toplevel = domainname.rsplit('.', 1) - except ValueError: - return False # Address does not have enough parts - - # Check for Country code or Generic Domain. - if len(toplevel) != 2 and toplevel not in domains: - return False # Not a domain name. - - for i in '-_.%+.': - localpart = localpart.replace(i, "") - for i in '-_.': - host = host.replace(i, "") - - if localpart.isalnum() and host.isalnum(): - return True # Email address is fine. - else: - return False # Email has funny characters - -def create_gravatar(email): - h = hashlib.md5() - h.update(email) - return h.hexdigest() - -def create_config(feed,path,nickname,realname,gravatar): - if feed: - f = open('configs/%s/%s' % (path,nickname), 'w') - f.write('[%s]\nusername = %s\nname = %s\ngravatar = %s' % (feed,nickname,realname,gravatar)) - f.close() - print('%s config created successfully' % path) - else: - print('No %s config will be created' % path) - -def main(): - realname = input('Real Name: ') - nickname = input('Nickname: ') - email = input('Email: ') - if check_mail(email): - gravatar = create_gravatar(email) - print('Gravatar hash: %s' % gravatar) - else: - print('Not a valid email address\n') - sys.exit(0) - planet = input('Planet Feed: ') - create_config(planet,'planet',nickname,realname,gravatar) - universe = input('Universe Feed: ') - create_config(universe,'universe',nickname,realname,gravatar) - -if __name__ == '__main__': - main() diff --git a/gravatar.py b/gravatar.py deleted file mode 100644 index 940be1f..0000000 --- a/gravatar.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -import hashlib -import sys - -h = hashlib.md5() -h.update(sys.argv[1]) -print h.hexdigest() diff --git a/media/favicon.ico b/media/favicon.ico new file mode 100644 index 0000000..e26ba88 Binary files /dev/null and b/media/favicon.ico differ diff --git a/media/icons/back.gif b/media/icons/back.gif new file mode 100644 index 0000000..a694ae1 Binary files /dev/null and b/media/icons/back.gif differ diff --git a/media/icons/blank.gif b/media/icons/blank.gif new file mode 100644 index 0000000..0ccf01e Binary files /dev/null and b/media/icons/blank.gif differ diff --git a/media/icons/image2.gif b/media/icons/image2.gif new file mode 100644 index 0000000..751faee Binary files /dev/null and b/media/icons/image2.gif differ diff --git a/media/images/gbot-s.gif b/media/images/gbot-s.gif new file mode 100644 index 0000000..9dc9ed3 Binary files /dev/null and b/media/images/gbot-s.gif differ diff --git a/media/images/gentoo.gif b/media/images/gentoo.gif new file mode 100644 index 0000000..9153b82 Binary files /dev/null and b/media/images/gentoo.gif differ diff --git a/media/images/gridtest.gif b/media/images/gridtest.gif new file mode 100644 index 0000000..6dd05dc Binary files /dev/null and b/media/images/gridtest.gif differ diff --git a/media/images/gtop-s.jpg b/media/images/gtop-s.jpg new file mode 100644 index 0000000..191c375 Binary files /dev/null and b/media/images/gtop-s.jpg differ diff --git a/media/images/larry_the_cow.jpg b/media/images/larry_the_cow.jpg new file mode 100644 index 0000000..3d2b2e5 Binary files /dev/null and b/media/images/larry_the_cow.jpg differ diff --git a/media/images/opml.png b/media/images/opml.png new file mode 100644 index 0000000..109bfc8 Binary files /dev/null and b/media/images/opml.png differ diff --git a/media/images/rss20.png b/media/images/rss20.png new file mode 100644 index 0000000..acdba30 Binary files /dev/null and b/media/images/rss20.png differ diff --git a/media/images/tux.png b/media/images/tux.png new file mode 100644 index 0000000..96506b6 Binary files /dev/null and b/media/images/tux.png differ diff --git a/media/planet.css b/media/planet.css new file mode 100644 index 0000000..9db6227 --- /dev/null +++ b/media/planet.css @@ -0,0 +1,160 @@ +body { + background-color: #000000; + color: black; + font-family: Verdana, Arial, Helvetica; + font-size: 0.9em; + margin: 0px 0px 0px 0px; +} + + +a.highlight:link { color: #00ff00; text-decoration: none; } +a.highlight:visited { color: #00ff00; text-decoration: none; } +a.highlight:hover { color: #00ff00; text-decoration: underline; } +a.highlight:active { color: #00ff00; text-decoration: underline; } + +a.menulink:link { color: #a0a0d0; text-decoration: none; } +a.menulink:visited { color: #a0a0d0; text-decoration: none; } +a.menulink:hover { color: #00ff00; text-decoration: underline; } +a.menulink:active { color: #00ff00; text-decoration: underline; } + +a.altlink:link { color: #7a5ada; text-decoration: none; } +a.altlink:visited { color: #5a3aba; text-decoration: none; } +a.altlink:hover { color: #7a5ada; text-decoration: underline; } +a.altlink:active { color: #7a5ada; text-decoration: underline; } + +td.logobox { + background-color: #45347B; + padding-bottom: 5px; + vertical-align: top; +} + +td.linkbar { + background-color: #000000; + padding-bottom: 10px; + vertical-align: bottom; +} + +td.leftmenu { + vertical-align: top; + background-color: #DDDAEC; +} + +div.dateheading { + background-color: rgb(122, 90, 218); + color: #FFFFFF; + font-size: 1.6em; + font-weight: bold; + padding: 3px 3px 3px 5px; +} + +div.entryheading { + background-color: #EFEFEF; +} + +span.entryheading { + font-weight: bold; + padding-left: 15px; +} + +div.entrycontent { + padding-left: 15px; + padding-bottom: 10px; + min-height: 85px; +} + +div.entrycontent pre { + overflow: auto; +} + +div.personheading { + background-color: #DEE3E7; +} + +span.personheading { + font-size: 1.4em; + font-weight: bold; + padding-left: 8px; +} + +span.commentlink { + font-style: italic; +} + +.menu { + font-size: 0.9em; + font-weight: bold; + font-family: Verdana, Arial, Helvetica; + color: #c0c0f0; + padding-left: 1.0em; + padding-right: 1.0em; + padding-top: 0.5em; +} + +.altmenu { + font-size: 0.8em; + font-weight: bold; + font-family: Verdana, Arial, Helvetica; + color: #000000; + padding-left: 2.0em; + padding-right: 1.0em; +} + +td.footer { + font-size: 0.7em; + font-family: Verdana, Arial, Helvetica; + padding-top: 0.2em; + padding-bottom: 0.2em; + padding-left: 1.0em; + margin-left: 1.0em; + color: #ffffff; + font-weight: bold; + width: 100%; + text-align: right; + background-color: #7A5ADA; +} + +td.content { + padding: 1.0em 1.0em 0em 1.0em; + font-family: Verdana, Arial, Helvetica; + font-size: 0.9em; + width: 100%; + vertical-align: top; + background-color: #FFFFFF; +} + +pre { + padding: 0.5em; + font-family: Lucida Console, Courier; + color: #000000; + font-size: 0.9em; +} + +img { + border: 0px; + max-width: 500px; +} + +div#intro { + clear: both; + display: block; + height: 70px; +} + +div#intro img { + padding-right: 10px; + float: left; + vertical-align: top; +} + +div#intro p { + margin: 0; + padding-top: 20px; +} + +pre { + border-left: 2px double grey; +} + +blockquote { + overflow: auto; +} diff --git a/media/robots.txt b/media/robots.txt new file mode 100644 index 0000000..7d329b1 --- /dev/null +++ b/media/robots.txt @@ -0,0 +1 @@ +User-agent: * diff --git a/scripts/adduser.py b/scripts/adduser.py new file mode 100644 index 0000000..0a4f8c2 --- /dev/null +++ b/scripts/adduser.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python + +# A simple help script to create a new planet/universe config for a new user +# Run it inside the planet/ topdir +# WARNING: Always check the changes that are made by this script before commiting +# Many thanks to Arfrever Frehtes Taifersar Arahesis (arfrever@gentoo.org) for his suggestions + +# Author: Theo Chatzimichos +# Feel free to contact me via IRC or email + +import sys +import hashlib + +# the following makes it python3 compatible +if sys.version_info[0] == 2: + input = raw_input + +def check_mail(email): + # http://commandline.org.uk/python/email-syntax-check/ + + # Ditch nonsense email addresses. + + GENERIC_DOMAINS = "aero", "asia", "biz", "cat", "com", "coop", \ + "edu", "gov", "info", "int", "jobs", "mil", "mobi", "museum", \ + "name", "net", "org", "pro", "tel", "travel" + + # Checks for a syntactically invalid email address. + # Email address must be 7 characters in total. + if len(email) < 7: + return False # Address too short + + # Split up email address into parts. + try: + localpart, domainname = email.rsplit('@', 1) + host, toplevel = domainname.rsplit('.', 1) + except ValueError: + return False # Address does not have enough parts + + # Check for Country code or Generic Domain. + if len(toplevel) != 2 and toplevel not in domains: + return False # Not a domain name. + + for i in '-_.%+.': + localpart = localpart.replace(i, "") + for i in '-_.': + host = host.replace(i, "") + + if localpart.isalnum() and host.isalnum(): + return True # Email address is fine. + else: + return False # Email has funny characters + +def create_gravatar(email): + h = hashlib.md5() + h.update(email) + return h.hexdigest() + +def create_config(feed,path,nickname,realname,gravatar): + if feed: + f = open('configs/%s/%s' % (path,nickname), 'w') + f.write('[%s]\nusername = %s\nname = %s\ngravatar = %s' % (feed,nickname,realname,gravatar)) + f.close() + print('%s config created successfully' % path) + else: + print('No %s config will be created' % path) + +def main(): + realname = input('Real Name: ') + nickname = input('Nickname: ') + email = input('Email: ') + if check_mail(email): + gravatar = create_gravatar(email) + print('Gravatar hash: %s' % gravatar) + else: + print('Not a valid email address\n') + sys.exit(0) + planet = input('Planet Feed: ') + create_config(planet,'planet',nickname,realname,gravatar) + universe = input('Universe Feed: ') + create_config(universe,'universe',nickname,realname,gravatar) + +if __name__ == '__main__': + main() diff --git a/scripts/gravatar.py b/scripts/gravatar.py new file mode 100644 index 0000000..940be1f --- /dev/null +++ b/scripts/gravatar.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +import hashlib +import sys + +h = hashlib.md5() +h.update(sys.argv[1]) +print h.hexdigest() diff --git a/scripts/update-venus b/scripts/update-venus new file mode 100644 index 0000000..7c0c02e --- /dev/null +++ b/scripts/update-venus @@ -0,0 +1,33 @@ +#!/bin/bash +DATE=$(date +%F) +LOG_DATE=$(date +%F-%R) +BASE_DIR="/var/www/planet.gentoo.org/" +RESTRICT="" +VENUS_DIR="/usr/lib/python2.6/site-packages/venus/" + +cd ${BASE_DIR} + +# Get latest SVN changes +git pull ${BASE_DIR}/planet-gentoo/configs/ >/dev/null 2>&1 +git pull ${BASE_DIR}/planet-gentoo/templates/ >/dev/null 2>&1 + +# Run Venus +for x in planet universe; do + if [[ ! -z $RESTRICT ]]; then + for y in $RESTRICT; do + rm ${BASE_DIR}configs/${x}/${y} + done + fi + cat ${BASE_DIR}planet-gentoo/configs/base/venus.${x} ${BASE_DIR}planet-gentoo/configs/${x}/* > ${BASE_DIR}generated_configs/venus.${x}.ini + python ${VENUS_DIR}planet.py ${BASE_DIR}configs/venus.${x}.ini > ${BASE_DIR}logs/${x}/${LOG_DATE}.log 2>&1 +done + +# Delete old logs +find ${BASE_DIR}logs -type f -mtime +30 -delete + +# Archive posts +cp ${BASE_DIR}htdocs/index.html \ + ${BASE_DIR}htdocs/archives/${DATE}.html +cp ${BASE_DIR}htdocs/universe/index.html \ + ${BASE_DIR}htdocs/universe/archives/${DATE}.html + diff --git a/templates/config.ini b/templates/config.ini index 7e87097..3c38348 100644 --- a/templates/config.ini +++ b/templates/config.ini @@ -8,4 +8,4 @@ template_files: index.html.tmpl template_directories: - /var/www/planet.gentoo.org/venus/themes/common/ + /var/www/planet.gentoo.org/planet-gentoo/templates -- cgit v1.2.3