Commits

Jason R. Coombs committed 5a49ec7

Added wiki home generation

  • Participants
  • Parent commits 522b3ce

Comments (0)

Files changed (3)

+
+import pkg_resources
+from jaraco.develop import bitbucket
+from paver.easy import task
+
+import pmxbot.core
+import pmxbot.web.viewer
+
+
+def to_wiki(commands):
+	yield '|= Command |= Aliases |= Description |'
+	for command, doc, aliases in commands:
+		aliases = ', '.join(repr(alias.name) for alias in aliases)
+		doc = doc.replace('|', '~|')
+		yield '| {command} | {aliases} | {doc} |'.format(**vars())
+@task
+def update_wiki():
+	pmxbot.core._load_library_extensions()
+	pmxbot.web.viewer._init_config()
+	ctx = pmxbot.web.viewer.HelpPage.get_context()
+	commands = ctx['commands']
+	project = 'yougov/pmxbot'
+	title = 'Home'
+	path = 'home.wiki'
+	req = pkg_resources.require('pmxbot')
+	usage = pkg_resources.resource_stream('pmxbot', 'example usage.txt')
+	content = home_wiki % dict(
+		commands='\n'.join(to_wiki(commands)),
+		usage=usage.read(),
+		version=req[0].version,
+	)
+	# api is broken, so copy/paste
+	# bitbucket.update_wiki(project, title, path, content)
+	print("You need to update the wiki yourself: ")
+	print(content)
+
+home_wiki = """
+== Welcome ==
+{{https://bitbucket.org/yougov/pmxbot/raw/8af8328a91ce/pmxbotweb/templates/pmxbot.png|pmxbot skynet logo}}{{https://bitbucket.org/yougov/pmxbot/raw/tip/horrible-logos-pmxbot.gif|pmxbot horrible logo}}
+
+Welcome to pmxbot!
+
+== Feature List ==
+While pmxbot's feature set is always growing and changing, here's a list of the current features included as part of version %(version)s.
+
+%(commands)s
+
+== Example Session ==
+It's sometimes hard to get a sense of what pmxbot is like if you've never used it, so here's an example IRC discussion where we heavily use pmxbot.
+
+{{{
+%(usage)s
+}}}
+"""

pmxbot/__init__.py

 		channel = '#inane',
 		linkurl = 'http://bitbucket.org/yougov/pmxbot',
 		url = 'http://bitbucket.org/yougov/pmxbot',
-		),
-	],
+	)],
 	librarypaste = 'http://paste.jaraco.com',
 )
 config['logs URL'] = 'http://' + socket.getfqdn()

pmxbot/example usage.txt

+< chmullig> cperry: in cologne?
+< cperry> !m chmullig
+<@pmxbot> you're doing good work, chmullig!
+< cperry> indeed
+< chmullig> awesome
+< cperry> yeah
+< chmullig> I'm recording a little chat for the pmxbot website
+< cperry> ooooo
+< cperry> is this getting recorded?
+< chmullig> !8ball is pmxbot awesome?
+<@pmxbot> Most likely.
+< chmullig> yes, yes it is
+< cperry> good thing I didn't insult the person I was going to insult
+< cperry> because I love everyone!
+< cperry> !bless
+< chmullig> !cheer everyone
+ * pmxbot blesses the day!
+ * pmxbot cheers for everyone!
+< cperry> !curse insulting people
+ * pmxbot curses insulting people!
+< chmullig> !w Washington, DC | Cologne
+<@pmxbot> Washington D.C., DC. Currently: 70F/21C, Cloudy.    Mon: 73F/22C, Thunderstorm
+<@pmxbot> Cologne, North Rhine-Westphalia. Currently: 43F/6C, Mostly Cloudy.    Mon: 46F/7C, Chance of Rain
+< cperry> in fact, every time I think about insulting people, I just want to
+< cperry> !dance
+<@pmxbot> O-\-<
+<@pmxbot> O-|-<
+<@pmxbot> O-/-<
+< chmullig> !def dancing
+<@pmxbot> Wikipedia says: Dance (from French danser, perhaps from Frankish) is an art form that generally
+          refers to movement of the body, usually rhythmic and to music, used as a form of expression,
+          social interaction or presented in a spiritual or performance setting.
+< cperry> hmm
+< cperry> !urb dancing
+<@pmxbot> Urban Dictionary says dancing: Formal term meaning: to move with unhindered grace around an area
+          with the presence of another enjoying the same activity.  Urban term: Humping someone in public
+          Sad world isn't it.
+< cperry> ewwww
+< chmullig> !g salsa dancing classes in washington, dc
+<@pmxbot> http://www.findoutdc.com/gym/dance.shtml - Dance Lessons and Studios - Latin Salsa Merengue
+          Tango Ballroom
+< cperry> !otrail dancing
+<@pmxbot> dancing made it to oregon. Time to party with schmichael.
+< chmullig> !ylunch Washington, DC 10m
+<@pmxbot> Tonic at Quigley's Pharmacy @ 2036 G St Nw -
+          http://local.yahoo.com/info-38772621-tonic-at-quigley-s-pharmacy-washington
+< cperry> yes! my favorite!
+< chmullig> Are you teaching the germans sql on rails?
+<@pmxbot> Only 76,417 lines...
+< cperry> nah, they prefer spss
+< chmullig> thank you, pmxbot
+<@pmxbot> I'm afraid that would violate the fire code.