<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Biodegradable Geek</title>
	
	<link>http://biodegradablegeek.com</link>
	<description />
	<pubDate>Sun, 16 Nov 2008 08:29:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/BiodegradableGeek" type="application/rss+xml" /><item>
		<title>RescueTime’s 22 Gigabyte notifier.debuglog Log File</title>
		<link>http://feeds.feedburner.com/~r/BiodegradableGeek/~3/454705051/</link>
		<comments>http://biodegradablegeek.com/2008/11/rescuetimes-22-gigabyte-notifierdebuglog-log-file/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 08:25:46 +0000</pubDate>
		<dc:creator>Isam</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[bugs]]></category>

		<category><![CDATA[nuisance]]></category>

		<category><![CDATA[open source]]></category>

		<category><![CDATA[rescuetime]]></category>

		<guid isPermaLink="false">http://biodegradablegeek.com/?p=285</guid>
		<description><![CDATA[I did find it weird that I kept running out of disk space recently. That hasn&#8217;t happened in years, and most of my big files go on another HD. On top of that box has been way more sluggish even taking into account the fact that it&#8217;s ~4 years old and I always have 5-6 [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "RescueTime&#8217;s 22 Gigabyte notifier.debuglog Log File", url: "http://biodegradablegeek.com/2008/11/rescuetimes-22-gigabyte-notifierdebuglog-log-file/" });</script>]]></description>
			<content:encoded><![CDATA[<p>I did find it weird that I kept running out of disk space recently. That hasn&#8217;t happened in years, and most of my big files go on another HD. On top of that box has been way more sluggish even taking into account the fact that it&#8217;s ~4 years old and I always have 5-6 desktops filled to the brim.</p>
<p>I finally found the culprit. RescueTime&#8217;s (unofficial) Linux client keeps a log of <strong>every single window that has gotten focus, EVER.</strong> I figured this would be cleared when the notifications were sent out, but apparently it&#8217;s not. My failed/ dir is nearly empty, so I know the notifications are getting sent out. The file is ~/.rescuetime/tmp/notifier.debuglog</p>
<p>It might be because the client only clears the log when you open or close it? That sucks, because I don&#8217;t shutdown. Aside from the 2-3 2 minute kernel-update reboots (yeah yeah I could just init level down to preserve my uptime), I literally haven&#8217;t kept my PC off since 2006.</p>
<p>I don&#8217;t mind the disk space, but how the hell are you opening, seeking and writing to a 22gig+ file literally every single time focus is switched? I swear to the Gods I was one CC digit away from ordering a Mac.</p>
<p style="text-align: center;"><img class="size-full wp-image-286 aligncenter" title="notifier debug log rescue time picture" src="http://biodegradablegeek.com/wp-content/uploads/2008/11/notifierdebuglog.png" alt="notifier debug log rescue time picture" width="500" height="243" /></p>
<p>RescueTime is a great service/app, but I&#8217;ll keep it off until this is fixed or they release an official client. No offense to the guys working on the Linux client (&lt;3), especially considering it&#8217;s probably their pet project, and I&#8217;ve had no other problems with it thus far.Hell, maybe the debug log could of easily been turned off.</p>
<p>I&#8217;m using version 90 (newest release as of 11/16). This may have already been fixed in trunk. I&#8217;ll check/submit a bug report&#8230; eventually.</p>
<p>https://launchpad.net/rescuetime-linux-uploader</p>
<p><a href="http://sharethis.com/item?&wp=2.6.1&amp;publisher=0f1bbcee-5646-4c3b-a5fa-23322de412ee&amp;title=RescueTime%26%238217%3Bs+22+Gigabyte+notifier.debuglog+Log+File&amp;url=http%3A%2F%2Fbiodegradablegeek.com%2F2008%2F11%2Frescuetimes-22-gigabyte-notifierdebuglog-log-file%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/BiodegradableGeek/~4/454705051" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://biodegradablegeek.com/2008/11/rescuetimes-22-gigabyte-notifierdebuglog-log-file/feed/</wfw:commentRss>
		<feedburner:origLink>http://biodegradablegeek.com/2008/11/rescuetimes-22-gigabyte-notifierdebuglog-log-file/</feedburner:origLink></item>
		<item>
		<title>Learning to read and grok other people’s code</title>
		<link>http://feeds.feedburner.com/~r/BiodegradableGeek/~3/453656103/</link>
		<comments>http://biodegradablegeek.com/2008/11/learning-to-read-and-grok-other-peoples-code/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 04:21:08 +0000</pubDate>
		<dc:creator>Isam</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Misc]]></category>

		<category><![CDATA[productivity]]></category>

		<category><![CDATA[habits]]></category>

		<category><![CDATA[motivation]]></category>

		<category><![CDATA[open source]]></category>

		<category><![CDATA[oss]]></category>

		<category><![CDATA[persistence]]></category>

		<category><![CDATA[reading code]]></category>

		<guid isPermaLink="false">http://biodegradablegeek.com/?p=269</guid>
		<description><![CDATA[One reason many people don&#8217;t contribute to open source apps is because they find it daunting to look through somebody elses code. Some might even think that it&#8217;s just simpler to write something from scratch than to study someone&#8217;s work. This isn&#8217;t true, and reading foreign code is something get used to and excel at [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Learning to read and grok other people&#8217;s code", url: "http://biodegradablegeek.com/2008/11/learning-to-read-and-grok-other-peoples-code/" });</script>]]></description>
			<content:encoded><![CDATA[<p>One reason many people don&#8217;t contribute to open source apps is because they find it daunting to look through somebody elses code. Some might even think that it&#8217;s just simpler to write something from scratch than to study someone&#8217;s work. This isn&#8217;t true, and reading foreign code is something get used to and excel at over time. It&#8217;s a necessary skill for every programmer, and has many benefits.</p>
<p>A huge benefit is the massive amount of information you learn and get accustomed to in a short period of time. There&#8217;s no way to download O&#8217;reilly PDFs into your brain just yet, but groking source code written by those much more experienced than you is one of the fastest ways to see and practice everything you&#8217;re been learning in theory (books, sites, classes).</p>
<p>It&#8217;s certainly overwhelming to jump head first into a huge app trying to understand every line. I think it&#8217;s common for people to open up some code, read it for a few minutes and then never touch it again because they don&#8217;t understand it. This was the case with me when I began programming. Here are some ways i used to justify putting off the need to read third party code.</p>
<p>Their code style didn&#8217;t suit my taste, i.e., they add the opening curly bracket under the function definition, and I would find myself changing their brackets and formatting more than I spent time actually looking at the logic.</p>
<p>I told myself I would learn much more by re-inventing the wheel, or have more control over my app if I built it from scratch. This is only partial true, but the cons outweight the pros. Reinventing the wheel means diviating from writing program logic and having to learn something that might not even remotely be related to the project I intended to start or finish. Here&#8217;s an example that used to be common.</p>
<p><span id="more-269"></span></p>
<p>I would happily hack away and then realize that I need a string library (<strong>I &lt;3 C</strong>). At this point I could have downloaded one, and continued hacking at my app. But instead I would start a new project aimed at writing an efficient string library. Before I knew it, I&#8217;m hours into my string lib and totally abandoned my main project. I usually  anyway. The funny thing is that sometimes I&#8217;ll just give up and use a third party lib, but most of the time I just ended up scrapping both projects. What a waste of time.</p>
<p>Everyone has their own way of learning other people&#8217;s code. I found that what works best for me is to download an app and just browse the source indifferently. It&#8217;s not good, it&#8217;s not bad, it&#8217;s not ugly or inefficient or godly. I just try to get a basic idea of where everything is, what plugins are being used, etc. Layout stuff is in this general area, settings here, plugins are all in there, etc. This step is probably useless and I only do it as a guilt-free way to avoid working for 10 minutes. Or, maybe it does help.</p>
<p>Then I begin by setting up the environment. Put in my DB settings, make sure I have all the requirements installed, etc. Logs are your best lead at this point. I usually open up a fullscreen console and tail -f the log file(s), then watch them like a hawk every time you shift a pixel in the code. It&#8217;s not as tedious as it sounds.</p>
<p>Another thing that helps is knowing the language/framework the code is written in. You should know at least how to read the language - though if you&#8217;re dedicated, I&#8217;m sure you can muddle through with a crash course/reference sheet. By knowing the lang/framework, you can find or create some functions to help you debug and examine objects (even just <strong>raise object.inspect</strong> is great) in detail. You can also examine other aspects of the code. One thing I do early on is <strong>rake routes &gt; ROUTES</strong>. This saves all the routes to a file which I can glance at if necessary. And <em>rake routes</em> takes forever on my ancient machine.</p>
<p>After this, the code is compiled/started and I&#8217;m <em>ready</em> when I can interact with it live. Now I begin actually reading the code. If I have a specific update I want to make, be it adding a new feature, fixing a bug, or seeing how something works, I work backwards from the live app tracing everything going on around the component I&#8217;d like to edit/update.</p>
<p>This is not easy, not quick, and very error prone when you&#8217;re making updates. Things breaking == You learning, and all you need to do is <strong>be persistent</strong>. It&#8217;s like reading a calculus book. Nothing will make sense until you turn over the page and see how the problems and answers are laid out, and begin doing them on your own. It&#8217;s a great feeling when 2-3 days later you realize that you have a pretty good view of the app&#8217;s design (unless it&#8217;s something like the Kernel).</p>
<p>No matter how cryptic the code looks, don&#8217;t be turned off. Is there some sort of force that will completely stop you from understanding what the logic says? Can other people look at this code and instantly tell you what it&#8217;s doing? (well, they can form a great guess if they have the experience). It&#8217;s time consuming but the concepts apply to other things in life. You can understand how to change your oil without knowing how the engine works, or how to make simple CSS/HTML changes to a layout to change the background or font size without knowing every single CSS tag and technique.</p>
<p><strong>define:persistent: </strong><em>Refusing to give up, especially when faced with opposition or difficulty; continuing firmly or steadily</em></p>
<p>Most of my favorite quotes are about it. It&#8217;s unfortunate my memory isn&#8217;t very persistent.</p>
<p style="text-align: center;"><img class="size-full wp-image-271 aligncenter" title="Persistence is the key to money, fame, power and sex." src="http://biodegradablegeek.com/wp-content/uploads/2008/11/persistenceposter.jpg" alt="persistence poster" width="400" height="336" /></p>
<p style="text-align: center;">
<h2 style="text-align: left;"><span style="color: #ff6600;">Do you have any special techniques/advice for learning to read third party code?</span></h2>
<p><a href="http://sharethis.com/item?&wp=2.6.1&amp;publisher=0f1bbcee-5646-4c3b-a5fa-23322de412ee&amp;title=Learning+to+read+and+grok+other+people%26%238217%3Bs+code&amp;url=http%3A%2F%2Fbiodegradablegeek.com%2F2008%2F11%2Flearning-to-read-and-grok-other-peoples-code%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/BiodegradableGeek/~4/453656103" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://biodegradablegeek.com/2008/11/learning-to-read-and-grok-other-peoples-code/feed/</wfw:commentRss>
		<feedburner:origLink>http://biodegradablegeek.com/2008/11/learning-to-read-and-grok-other-peoples-code/</feedburner:origLink></item>
		<item>
		<title>Mephisto for the Masses - Installation howto</title>
		<link>http://feeds.feedburner.com/~r/BiodegradableGeek/~3/428044494/</link>
		<comments>http://biodegradablegeek.com/2008/10/mephisto-for-the-masses-installation-howto/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 01:14:00 +0000</pubDate>
		<dc:creator>Isam</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Workarounds]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[blog]]></category>

		<category><![CDATA[blogging platform]]></category>

		<category><![CDATA[broken]]></category>

		<category><![CDATA[deploying]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[fixing]]></category>

		<category><![CDATA[help]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[installation]]></category>

		<category><![CDATA[installer]]></category>

		<category><![CDATA[installing]]></category>

		<category><![CDATA[irc]]></category>

		<category><![CDATA[logs]]></category>

		<category><![CDATA[mefisto]]></category>

		<category><![CDATA[mephisot]]></category>

		<category><![CDATA[mephisto]]></category>

		<category><![CDATA[mephsto]]></category>

		<category><![CDATA[mod_rails]]></category>

		<category><![CDATA[phusion passanger]]></category>

		<category><![CDATA[problems]]></category>

		<category><![CDATA[redcloth-3.0.4]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[set up]]></category>

		<category><![CDATA[setting up]]></category>

		<guid isPermaLink="false">http://biodegradablegeek.com/?p=257</guid>
		<description><![CDATA[I&#8217;ve recently taken a fancy to Mephisto, a blogging-platform written in Rails. I have nothing against Wordpress, but being in Ruby and using Liquid for themes, Mephisto is far easier (and more fun) to tweak and configure, especially when I want to migrate my sites away from the &#8220;blog look&#8221; and make them more dynamic. [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Mephisto for the Masses - Installation howto", url: "http://biodegradablegeek.com/2008/10/mephisto-for-the-masses-installation-howto/" });</script>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently taken a fancy to Mephisto, a blogging-platform written in Rails. I have nothing against Wordpress, but being in Ruby and using Liquid for themes, Mephisto is far easier (and more fun) to tweak and configure, especially when I want to migrate my sites away from the &#8220;blog look&#8221; and make them more dynamic. </p>
<p>It&#8217;s unfortunate development isn&#8217;t as active as say, Typo (also a Rails app, but I haven&#8217;t tried it), but I find that Mephisto at its current level makes a simple and <strong>fast</strong> starting point for most of my projects. </p>
<p>The point of this post is to address numerous problems with the installation. These are present in the tarball release of 0.8 Drax, and in trunk (as of 10/21). </p>
<h3>Git The Code</h3>
<p>Get the files, either the <a href="http://github.com/technoweenie/mephisto/tree/master">compressed archive</a> or from edge (recommended).</p>

<div class="wp_syntax"><div class="code"><pre class="text">git clone git://github.com/technoweenie/mephisto.git</pre></div></div>

<h3>Pre-installation</h3>
<p>You&#8217;ll need to freeze rails 2.0.2, and have the latest tzinfo gem installed:</p>

<div class="wp_syntax"><div class="code"><pre class="text">gem install tzinfo 
cd mephisto/ 
rake rails:freeze:edge RELEASE=2.0.2</pre></div></div>

<p>The file it downloads should be named rails_2.0.2.zip and NOT rails_edge.zip. </p>
<p>Copy the &#8220;new&#8221; boot.rb into the config/ folder, overwriting the existing one:</p>

<div class="wp_syntax"><div class="code"><pre class="text">cp vendor/rails/railties/environments/boot.rb config/boot.rb</pre></div></div>

<p>Now rename the database sample file in config/ to database.yml and edit it to fit your own DB settings. You&#8217;ll probably only be using production.</p>
<h3>Bootstrapping</h3>
<p>Now bootstrap:</p>

<div class="wp_syntax"><div class="code"><pre class="text">rake db:bootstrap RAILS_ENV=production</pre></div></div>

<p>If it works, GREAT. But you&#8217;ll probably get an error or two. If you&#8217;re getting the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="text">Error message:
  undefined method `initialize_schema_information' for module  
  `ActiveRecord::ConnectionAdapters::SchemaStatements'
Exception class:
  NameError</pre></div></div>

<p>You forgot to copy over boot.rb from vendor/rails/ - scroll up. If you&#8217;re getting an error that redcloth is missing (<em>no such file to load—RedCloth-3.0.4/lib/redcloth</em>), even though it&#8217;s in vendor/, it&#8217;s because the path to RedCloth is relative in <strong>config/environment.rb</strong>. Change it from:</p>

<div class="wp_syntax"><div class="code"><pre class="rails"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'../vendor/RedCloth-3.0.4/lib/redcloth'</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>.<span style="color:#9900CC;">const_defined</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:RedCloth</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="rails"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#996600;">'../vendor/RedCloth-3.0.4/lib/redcloth'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>.<span style="color:#9900CC;">const_defined</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:RedCloth</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<h3>Running</h3>
<p>After the bootstrap, you may either start the server (ruby script/server, thin, mongrel, etc), or go with <a href="http://www.modrails.com/">mod_rails (Phusion Passanger)</a>. I recommend the latter - Passenger is amazing, and the error screen is pretty. </p>
<p>Just point your Apache2 vhost to Mephisto&#8217;s PUBLIC/ dir. Here&#8217;s an example:</p>

<div class="wp_syntax"><div class="code"><pre class="text">&lt;VirtualHost *:80&gt;
   ServerAdmin mrEman@domain.com
   ServerName domain.com
   ServerAlias www.domain.com
&nbsp;
   # DocumentRoot must be rails_app/public/
   DocumentRoot /home/kiwi/www/domain.com/public/public
   Railsenv production
&nbsp;
   DirectoryIndex index.html index.htm index.php
   ErrorLog /home/blue/www/domain.com/log/error.log
   CustomLog /home/blue/www/domain.com/log/access.log combined
&lt;/VirtualHost&gt;</pre></div></div>

<p>Restart Apache2, and you&#8217;re done. The site should work right away. If you get the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="text">No such file or directory - /tmp/mysql.sock</pre></div></div>

<p>It&#8217;s because the socket file resides somewhere else on your (host&#8217;s) distro. Just find (man find, locate, etc) and add a symlink to it. Here&#8217;s an example (Debian):</p>

<div class="wp_syntax"><div class="code"><pre class="text">ln -s /var/run/mysqld/mysqld.sock mysql.sock</pre></div></div>

<p>If you&#8217;re getting an error that gems you know you have aren&#8217;t found, like:</p>

<div class="wp_syntax"><div class="code"><pre class="text">no such file to load -- tzinfo (MissingSourceFile)</pre></div></div>

<p>it is due to the fact that Gems are not located anywhere Ruby checks. You&#8217;ll have to explicity pass Ruby -rubygems or require &#8216;rubygems&#8217; &#8212; what a nuisance. Open config/environment.rb and add the latter line:</p>

<div class="wp_syntax"><div class="code"><pre class="text"># requires vendor-loaded redcloth
require 'rubygems'</pre></div></div>

<p>This will be global. Now either restart the server you ran (i.e., thin), or tell mod_rails to restart the app. To do so, just create a file named &#8220;restart.txt&#8221; in the tmp/ folder of the RAILS app:</p>

<div class="wp_syntax"><div class="code"><pre class="text">cd mephisto_root/
touch tmp/restart.txt</pre></div></div>

<p>and refresh the page. Passenger will restart the app and restart.txt will vanish. </p>
<p>The default login for the /admin page is <strong>admin/test</strong>. <em>Wasn&#8217;t that a blast? </em></p>
<p><a href="http://sharethis.com/item?&wp=2.6.1&amp;publisher=0f1bbcee-5646-4c3b-a5fa-23322de412ee&amp;title=Mephisto+for+the+Masses+-+Installation+howto&amp;url=http%3A%2F%2Fbiodegradablegeek.com%2F2008%2F10%2Fmephisto-for-the-masses-installation-howto%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/BiodegradableGeek/~4/428044494" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://biodegradablegeek.com/2008/10/mephisto-for-the-masses-installation-howto/feed/</wfw:commentRss>
		<feedburner:origLink>http://biodegradablegeek.com/2008/10/mephisto-for-the-masses-installation-howto/</feedburner:origLink></item>
		<item>
		<title>Script to Quickly Setup WebApp Environment and Domain</title>
		<link>http://feeds.feedburner.com/~r/BiodegradableGeek/~3/418252507/</link>
		<comments>http://biodegradablegeek.com/2008/10/script-to-quickly-setup-webapp-environment-and-domain/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 03:10:32 +0000</pubDate>
		<dc:creator>Isam</dc:creator>
		
		<category><![CDATA[Automation]]></category>

		<category><![CDATA[Code example]]></category>

		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Snippets]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[apicore]]></category>

		<category><![CDATA[automattic]]></category>

		<category><![CDATA[batching]]></category>

		<category><![CDATA[clip share]]></category>

		<category><![CDATA[clipshare]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[deployment]]></category>

		<category><![CDATA[highline]]></category>

		<category><![CDATA[installer]]></category>

		<category><![CDATA[joomal]]></category>

		<category><![CDATA[joomla]]></category>

		<category><![CDATA[linode API]]></category>

		<category><![CDATA[phpmotion]]></category>

		<category><![CDATA[rio]]></category>

		<category><![CDATA[ruby bindings]]></category>

		<category><![CDATA[ruby-io]]></category>

		<category><![CDATA[scrips]]></category>

		<category><![CDATA[scripting]]></category>

		<category><![CDATA[scripts]]></category>

		<category><![CDATA[warez]]></category>

		<category><![CDATA[word press]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[wp]]></category>

		<category><![CDATA[yagbu]]></category>

		<guid isPermaLink="false">http://biodegradablegeek.com/?p=240</guid>
		<description><![CDATA[Just sharing a script I wrote to quickly deploy Wordpress (and eventually a few other webapps) sites, which somebody might find useful. This uses Linode&#8217;s API* to add the domain name to the DNS server along with some subdomains. If you&#8217;re using another server, (Slicehost, your own, etc), you can alter the dns class to [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Script to Quickly Setup WebApp Environment and Domain", url: "http://biodegradablegeek.com/2008/10/script-to-quickly-setup-webapp-environment-and-domain/" });</script>]]></description>
			<content:encoded><![CDATA[<p>Just sharing a script I wrote to quickly deploy Wordpress (and eventually a few other webapps) sites, which somebody might find useful. This uses <a href="http://linode.com">Linode</a>&#8217;s API* to add the domain name to the DNS server along with some subdomains. If you&#8217;re using another server, (Slicehost, your own, etc), you can alter the dns class to use that API, or just ignore the DNS stuff completely; Its optional.</p>
<p>This will be updated periodically as I refactor and add support for more apps (notably Joomla and Clipshare - though this would violate their terms unless you have the unlimited license). This was written primarily because I couldn&#8217;t stand setting up another vhost and Wordpress installation. There are plenty of existing deployers but I plan on adding very specific features and tweaking this for in-house work. I also wanted to try Rio (Ruby-IO). GPL license. Go nuts.</p>
<p><em>* As of 10/11, the apicore.rb file on the site has some syntactic errors in the domainResourceSave method. I sent an email out to the author about it. Problems aren&#8217;t major. You can get <a href="http://biodegradablegeek.com/wp-content/uploads/2008/10/apicore.rb" target="_new">my apicore.rb here</a>.</em></p>
<p>This won&#8217;t run unless you create the appropriate folder structure in /etc/mksite/. I&#8217;ll get going on this in a bit. See the code below:</p>
<p><span id="more-240"></span></p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby </span>
&nbsp;
<span style="color:#008000; font-style:italic;">########################################################</span>
<span style="color:#008000; font-style:italic;"># Isam M. </span>
<span style="color:#008000; font-style:italic;"># http://biodegradablegeek.com</span>
<span style="color:#008000; font-style:italic;"># MKSITE.RB (0.2) Last updated Oct 19th, 2008</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;"># mksite makes it quicker to setup sites and web</span>
<span style="color:#008000; font-style:italic;"># apps by doing most of the tedious work.</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;">#                     UNSTABLE</span>
<span style="color:#008000; font-style:italic;">#           Run it in your imagination,</span>
<span style="color:#008000; font-style:italic;">#              not on your system!</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;">######################################################## </span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rio'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'yaml'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'mysql'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'highline/import'</span>
HighLine.<span style="color:#9900CC;">track_eof</span> = <span style="color:#0000FF; font-weight:bold;">false</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">begin</span>
  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'apicore'</span>
<span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">LoadError</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;NOTICE: Unable to load apicore.rb - domains will not be added automatically&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
Apache_sites = <span style="color:#996600;">'/etc/apache2/sites-available/'</span>
Subdomains = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">''</span>, <span style="color:#996600;">'www'</span>, <span style="color:#996600;">'mail'</span>, <span style="color:#996600;">'blog'</span>, <span style="color:#996600;">&quot;dev#{(rand*10).floor}&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
Testing = <span style="color:#0000FF; font-weight:bold;">false</span>
Homedir = ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'HOME'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
Username = ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'USER'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
Applications = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Skeleton</span>, <span style="color:#ff3333; font-weight:bold;">:Clipshare</span>, <span style="color:#ff3333; font-weight:bold;">:Joomla</span>, <span style="color:#ff3333; font-weight:bold;">:PHPMotion</span>, <span style="color:#996600;">'PmWiki (N/A)'</span>, <span style="color:#ff3333; font-weight:bold;">:Wordpress</span><span style="color:#006600; font-weight:bold;">&#93;</span>
<span style="color:#ff6633; font-weight:bold;">$config</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
<span style="color:#ff6633; font-weight:bold;">$log</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> say<span style="color:#006600; font-weight:bold;">&#40;</span>txt<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">super</span> txt
<span style="color:#008000; font-style:italic;">#  $log &amp;lt;&amp;lt; txt if $log</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># flash('message', :notice || :error) to output msg</span>
<span style="color:#9966CC; font-weight:bold;">def</span> flash<span style="color:#006600; font-weight:bold;">&#40;</span>msg, message_type = <span style="color:#ff3333; font-weight:bold;">:notice</span><span style="color:#006600; font-weight:bold;">&#41;</span>
 <span style="color:#9966CC; font-weight:bold;">if</span> message_type.<span style="color:#9900CC;">eql</span>? <span style="color:#ff3333; font-weight:bold;">:notice</span>
    say<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;INFORMATION: #{msg}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">elsif</span> message_type.<span style="color:#9900CC;">eql</span>? <span style="color:#ff3333; font-weight:bold;">:emphasize</span>
    say<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;***************************************************&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    say<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;NOTICE: #{msg}<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    say<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;***************************************************&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">elsif</span> message_type.<span style="color:#9900CC;">eql</span>? <span style="color:#ff3333; font-weight:bold;">:error</span>
    STDERR.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;FATAL ERROR: #{msg}<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># DZone 2111</span>
<span style="color:#9966CC; font-weight:bold;">def</span> genAlpha<span style="color:#006600; font-weight:bold;">&#40;</span>size=<span style="color:#006666;">64</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  s=<span style="color:#996600;">''</span>
  size.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
    s <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">&amp;</span>lt; <span style="color:#006600; font-weight:bold;">&#40;</span>i = <span style="color:#CC00FF; font-weight:bold;">Kernel</span>.<span style="color:#CC0066; font-weight:bold;">rand</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">62</span><span style="color:#006600; font-weight:bold;">&#41;</span>; i <span style="color:#006600; font-weight:bold;">+</span>= <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>i <span style="color:#006600; font-weight:bold;">&amp;</span>lt; <span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#006666;">48</span> : <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>i <span style="color:#006600; font-weight:bold;">&amp;</span>lt; <span style="color:#006666;">36</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#006666;">55</span> : <span style="color:#006666;">61</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chr</span>
  <span style="color:#006600; font-weight:bold;">&#125;</span>
  s
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">defined</span>? ApiCore
  <span style="color:#9966CC; font-weight:bold;">class</span> DNSAPI <span style="color:#006600; font-weight:bold;">&amp;</span>lt; ApiCore
    <span style="color:#008000; font-style:italic;"># This depends on the Linode API Ruby bindings (apicore.rb)</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>key, debug=<span style="color:#0000FF; font-weight:bold;">false</span>, batching=<span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">super</span>
      <span style="color:#0066ff; font-weight:bold;">@batching</span>=<span style="color:#0000FF; font-weight:bold;">false</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># Add domain. Return ID on success, nil on failure</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> addDomain domain
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> !domain
      params = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:DomainID</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#006666;">0</span>
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Domain</span><span style="color:#006600; font-weight:bold;">&#93;</span> = domain
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Type</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">'master'</span>
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Status</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#006666;">1</span>
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:SOA_Email</span><span style="color:#006600; font-weight:bold;">&#93;</span> = getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'email'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Enter SOA email for the domain: &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      domainSave params
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> addDomainResource<span style="color:#006600; font-weight:bold;">&#40;</span>domain, resource, target, record_type = <span style="color:#996600;">'A'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>did = getDomainIdByName domain<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
      params = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:ResourceID</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#006666;">0</span>
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:DomainID</span><span style="color:#006600; font-weight:bold;">&#93;</span> = did
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Name</span><span style="color:#006600; font-weight:bold;">&#93;</span> = resource
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Type</span><span style="color:#006600; font-weight:bold;">&#93;</span> = record_type
      params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Target</span><span style="color:#006600; font-weight:bold;">&#93;</span> = target
      domainResourceSave params
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> getDomainIdByName domain
      domainList.<span style="color:#9900CC;">find</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>dom<span style="color:#006600; font-weight:bold;">|</span>
        <span style="color:#0000FF; font-weight:bold;">return</span> dom<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;DOMAINID&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">if</span> dom<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;DOMAIN&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">downcase</span> == domain.<span style="color:#9900CC;">downcase</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">else</span>
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'ApiCore not loaded. Skipping DNS stuff'</span>, <span style="color:#ff3333; font-weight:bold;">:notice</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> App
  <span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">&amp;</span>lt; <span style="color:#0000FF; font-weight:bold;">self</span>; attr_reader <span style="color:#ff3333; font-weight:bold;">:message</span>, <span style="color:#ff3333; font-weight:bold;">:name</span>, <span style="color:#ff3333; font-weight:bold;">:version</span>, <span style="color:#ff3333; font-weight:bold;">:description</span>, <span style="color:#ff3333; font-weight:bold;">:vhost</span>; <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#0066ff; font-weight:bold;">@message</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#0066ff; font-weight:bold;">@name</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#0066ff; font-weight:bold;">@version</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#0066ff; font-weight:bold;">@description</span> = <span style="color:#996600;">'Just Another Web App'</span>
  <span style="color:#0066ff; font-weight:bold;">@vhost</span> = <span style="color:#996600;">'generic'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>rootdir, domain, db<span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Initializing application (dir=#{rootdir}, domain=#{domain})&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@rootdir</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>rootdir<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">-1</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">chr</span>.<span style="color:#9900CC;">eql</span>? <span style="color:#996600;">'/'</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? rootdir.<span style="color:#CC0066; font-weight:bold;">chop</span> : rootdir
    <span style="color:#0066ff; font-weight:bold;">@domain</span> = domain
    <span style="color:#0066ff; font-weight:bold;">@db</span> = db <span style="color:#008000; font-style:italic;"># hash of database info </span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># System stuff</span>
    <span style="color:#008000; font-style:italic;">#if Testing</span>
      <span style="color:#008000; font-style:italic;">#@templates = '/home/kiwi/Code/mksite/templates'</span>
      <span style="color:#008000; font-style:italic;">#@configs = '/home/kiwi/Code/mksite/configs'</span>
      <span style="color:#008000; font-style:italic;">#@vhosts = '/home/kiwi/Code/mksite/vhosts'</span>
    <span style="color:#008000; font-style:italic;">#else</span>
      <span style="color:#0066ff; font-weight:bold;">@templates</span> = <span style="color:#996600;">'/etc/mksite/templates'</span>
      <span style="color:#0066ff; font-weight:bold;">@configs</span> = <span style="color:#996600;">'/etc/mksite/configs'</span>
      <span style="color:#0066ff; font-weight:bold;">@vhosts</span> = <span style="color:#996600;">'/etc/mksite/vhosts'</span>
    <span style="color:#008000; font-style:italic;">#end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># This generally does not need to be overriden.</span>
  <span style="color:#008000; font-style:italic;"># It does 'generic shit' like creating the rootdir</span>
  <span style="color:#008000; font-style:italic;"># and setting permissions</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> envSetup
    <span style="color:#9966CC; font-weight:bold;">if</span> !rio<span style="color:#006600; font-weight:bold;">&#40;</span>@rootdir<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">exist</span>?
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Creating directory #{@rootdir}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span>@rootdir<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">mkpath</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    rio<span style="color:#006600; font-weight:bold;">&#40;</span>@rootdir<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chdir</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>root<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#008000; font-style:italic;"># Copy the generic public/private/log apache</span>
      <span style="color:#008000; font-style:italic;"># structure to rootdir</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Changing working dir to #{@rootdir}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Working inside '#{root.to_s}'&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span>@templates,<span style="color:#996600;">'skeleton.www'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>df<span style="color:#006600; font-weight:bold;">|</span>
        <span style="color:#008000; font-style:italic;"># Overwrite existing files? .. yes.</span>
        <span style="color:#008000; font-style:italic;">#while rio(root, df).exist? do</span>
        df <span style="color:#006600; font-weight:bold;">&amp;</span>gt; root
        <span style="color:#008000; font-style:italic;">#flash(&quot;Copied #{df.to_s} to #{root.to_s}&quot;)</span>
      <span style="color:#006600; font-weight:bold;">&#125;</span> 
&nbsp;
      <span style="color:#008000; font-style:italic;"># Set permissions (a+w on logs, etc)</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Setting permissions...'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'666 ./log/*.log'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'./log/access.log'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">00666</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'./log/error.log'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">00666</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'700 ./private'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'./private/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">00700</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#008000; font-style:italic;"># envSetup()</span>
    <span style="color:#008000; font-style:italic;"># databaseSetup()</span>
    <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">'OVERRIDE ME'</span>
    <span style="color:#008000; font-style:italic;">#flash(&quot;setup() template function invoked. 'OVERRIDE ME'&quot;, :log)</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> databaseSetup
    <span style="color:#008000; font-style:italic;"># Create database if it doesn't already exist</span>
    <span style="color:#008000; font-style:italic;"># This usually doesn't need to be overriden</span>
    <span style="color:#008000; font-style:italic;">#Mysql.server_connect(@db['name'])</span>
    <span style="color:#008000; font-style:italic;">#  flash('Checking database connection... ')</span>
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      dbo = Mysql.<span style="color:#9900CC;">real_connect</span><span style="color:#006600; font-weight:bold;">&#40;</span>@db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'pass'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Creating database '#{@db['name']}'&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;
      res = dbo.<span style="color:#9900CC;">query</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;CREATE DATABASE IF NOT EXISTS #{@db['name']};&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Database server returned #{res}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> res
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">Mysql::Error</span> <span style="color:#006600; font-weight:bold;">=&amp;gt;</span> err
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Unable to connect to access/create database'</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Error returned (#{err.errno}) = '#{err.error}'&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span>
    <span style="color:#9966CC; font-weight:bold;">ensure</span>
      dbo.<span style="color:#9900CC;">close</span> <span style="color:#9966CC; font-weight:bold;">if</span> dbo
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> dnsSetup
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> !<span style="color:#9966CC; font-weight:bold;">defined</span>? ApiCore
&nbsp;
    <span style="color:#008000; font-style:italic;"># Setup DNS - currently uses Linode API</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Setting up DNS for '#{@domain}'&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;This requires a Linode API key<span style="color:#000099;">\n</span>Login to linode.com and find it under 'My Profile'&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    dns = <span style="color:#0000FF; font-weight:bold;">nil</span>
    api_key = getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'apikey'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC0066; font-weight:bold;">loop</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      api_key = ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Paste your Linode API key (or <span style="color:#000099;">\'</span>skip<span style="color:#000099;">\'</span>): '</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> api_key.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#006600; font-weight:bold;">||</span> api_key.<span style="color:#9900CC;">empty</span>?
      <span style="color:#9966CC; font-weight:bold;">break</span> <span style="color:#9966CC; font-weight:bold;">if</span> api_key.<span style="color:#9900CC;">downcase</span>.<span style="color:#9900CC;">eql</span>? <span style="color:#996600;">'skip'</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Check API key</span>
      <span style="color:#9966CC; font-weight:bold;">begin</span>
        dns = DNSAPI.<span style="color:#9900CC;">new</span> api_key
        dns.<span style="color:#9900CC;">domainList</span>
        <span style="color:#9966CC; font-weight:bold;">break</span>
      <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">RuntimeError</span>
        flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;API key invalid (or service down?). Learn to paste and try again.<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        api_key = <span style="color:#0000FF; font-weight:bold;">nil</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">unless</span> api_key.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#9966CC; font-weight:bold;">or</span> api_key.<span style="color:#9900CC;">downcase</span>.<span style="color:#9900CC;">eql</span>? <span style="color:#996600;">'skip'</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Adding master domain '#{@domain}'&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">begin</span>
        <span style="color:#9966CC; font-weight:bold;">begin</span>
          dns.<span style="color:#9900CC;">addDomain</span><span style="color:#006600; font-weight:bold;">&#40;</span>@domain<span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">RuntimeError</span>
          flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Unable to add domain (exists already?). Attempting to add subdomains...'</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        server = getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'server'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span>
                   ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Enter IP subdomains should point to (or 'skip'): &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>q<span style="color:#006600; font-weight:bold;">|</span> q.<span style="color:#9900CC;">default</span> = <span style="color:#996600;">'skip'</span> <span style="color:#006600; font-weight:bold;">&#125;</span> 
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">unless</span> server.<span style="color:#9900CC;">downcase</span>.<span style="color:#9900CC;">eql</span>? <span style="color:#996600;">'skip'</span>
          Subdomains.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>sub<span style="color:#006600; font-weight:bold;">|</span>
            flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Adding subdomain '#{sub}.#{@domain}' (points to #{server})&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
            flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Could not add subdomain'</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> !dns.<span style="color:#9900CC;">addDomainResource</span><span style="color:#006600; font-weight:bold;">&#40;</span>@domain, <span style="color:#CC0066; font-weight:bold;">sub</span>, server<span style="color:#006600; font-weight:bold;">&#41;</span>
          <span style="color:#9966CC; font-weight:bold;">end</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
     <span style="color:#9966CC; font-weight:bold;">rescue</span>
       <span style="color:#CC0066; font-weight:bold;">raise</span>
       flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Unable to add domain/subdomain. Skipping&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> serverSetup
    <span style="color:#008000; font-style:italic;"># Set Apache vhost</span>
    vhost_file = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#9966CC; font-weight:bold;">defined</span>? <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#9900CC;">vhost</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#9900CC;">vhost</span> : <span style="color:#996600;">'generic'</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Generating vhost file (#{@vhosts}/#{vhost_file}) for Apache 2.x&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    vhost = <span style="color:#996600;">''</span>
    email = getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'email'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Enter a valid email for tech support: &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    rio<span style="color:#006600; font-weight:bold;">&#40;</span>@vhosts, vhost_file<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;</span>gt; vhost
    vhost.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_DOMAIN_'</span>, <span style="color:#0066ff; font-weight:bold;">@domain</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    vhost.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_EMAIL_'</span>, email<span style="color:#006600; font-weight:bold;">&#41;</span>
    vhost.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_ROOT_'</span>, <span style="color:#996600;">&quot;#{@rootdir}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    vhost.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_PUBLIC_'</span>, <span style="color:#996600;">&quot;#{@rootdir}/public&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;">#rio(Testing ? '/tmp/' : Apache_sites, @domain).puts(vhost)</span>
    rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'/tmp/'</span>, <span style="color:#0066ff; font-weight:bold;">@domain</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>vhost<span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Your enemies should not read this</span>
    rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'/tmp/'</span>, <span style="color:#0066ff; font-weight:bold;">@domain</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">00600</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;vhost file has been generated as /tmp/#{@domain}<span style="color:#000099;">\n</span>
          It is YOUR responsibility to move this to #{Apache_sites}<span style="color:#000099;">\n</span>
          Site will not work until you 'a2ensite &amp;amp;&amp;amp; apache2ctl restart'&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> postInstall<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Finished!&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Skeleton <span style="color:#006600; font-weight:bold;">&amp;</span>lt; App
  <span style="color:#0066ff; font-weight:bold;">@name</span> = <span style="color:#996600;">'Skeleton'</span>
  <span style="color:#0066ff; font-weight:bold;">@description</span> = <span style="color:#996600;">'Generic WWW directory structure'</span>
  <span style="color:#0066ff; font-weight:bold;">@message</span> = <span style="color:#996600;">''</span>
  <span style="color:#0066ff; font-weight:bold;">@vhost</span> = <span style="color:#996600;">'generic'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">envSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">dnsSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">serverSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Wordpress <span style="color:#006600; font-weight:bold;">&amp;</span>lt; App
  <span style="color:#0066ff; font-weight:bold;">@name</span> = <span style="color:#996600;">'Wordpress'</span>
  <span style="color:#0066ff; font-weight:bold;">@version</span> = <span style="color:#996600;">'2.6.2'</span>
  <span style="color:#0066ff; font-weight:bold;">@description</span> = <span style="color:#996600;">'A popular blogging platform'</span>
  <span style="color:#0066ff; font-weight:bold;">@message</span> = <span style="color:#996600;">'Trying to make monies on the Internets?'</span>
  <span style="color:#0066ff; font-weight:bold;">@vhost</span> = <span style="color:#996600;">'generic'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#008000; font-style:italic;"># This sets up the initial environment / permissions</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">envSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Copy the wordpress skeleton directory to the new dir</span>
    wproot = rio<span style="color:#006600; font-weight:bold;">&#40;</span>@rootdir,<span style="color:#996600;">'public'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Wordpress root will be #{wproot}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Copying Wordpress data over... (may take awhile)'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    rio<span style="color:#006600; font-weight:bold;">&#40;</span>@templates,<span style="color:#996600;">'wordpress'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>df<span style="color:#006600; font-weight:bold;">|</span> df <span style="color:#006600; font-weight:bold;">&amp;</span>gt; wproot <span style="color:#006600; font-weight:bold;">&#125;</span> 
&nbsp;
    rio<span style="color:#006600; font-weight:bold;">&#40;</span>wproot<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chdir</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'wp-config-sample.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">rm</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#008000; font-style:italic;"># Generate and output wp config</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Generating wp-config.php based on your DB settings...'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      wpcfg = rio<span style="color:#006600; font-weight:bold;">&#40;</span>@configs, <span style="color:#996600;">'wordpress.cfg'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> !wpcfg.<span style="color:#9900CC;">exist</span>? <span style="color:#006600; font-weight:bold;">||</span> !wpcfg.<span style="color:#9900CC;">readable</span>?
        flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Wordpress config template missing or unreadable, quitting&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">2</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Copy the config into a string, do things with it and then write it to disk</span>
      config = <span style="color:#996600;">''</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span>@configs, <span style="color:#996600;">'wordpress.cfg'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;</span>gt; config
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Warning: config file '#{@configs}/wordpress.cfg' is empty&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> config.<span style="color:#9900CC;">empty</span>?
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_HOST_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_USER_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_PASS_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'pass'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_NAME_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'name'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_SECRET_'</span>, genAlpha<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Writing #{wpcfg} data&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'wp-config.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">w</span>!.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>config<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># Setup the database</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">databaseSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Add DNS info</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">dnsSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Setup the server/vhost</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">serverSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Clipshare <span style="color:#006600; font-weight:bold;">&amp;</span>lt; App
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">'Clipshare support is currently not available. sowwie'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Joomla <span style="color:#006600; font-weight:bold;">&amp;</span>lt; App
  <span style="color:#0066ff; font-weight:bold;">@name</span> = <span style="color:#996600;">'Joomla'</span>
  <span style="color:#0066ff; font-weight:bold;">@version</span> = <span style="color:#996600;">'1.5.7'</span>
  <span style="color:#0066ff; font-weight:bold;">@description</span> = <span style="color:#996600;">'A widely used Content Management System'</span>
  <span style="color:#0066ff; font-weight:bold;">@message</span> = <span style="color:#996600;">''</span>
  <span style="color:#0066ff; font-weight:bold;">@vhost</span> = <span style="color:#996600;">'generic'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#008000; font-style:italic;"># This sets up the initial environment / permissions</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">envSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Copy the wordpress skeleton directory to the new dir</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Copying Joomla data over... (may take awhile)'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    jooroot = rio<span style="color:#006600; font-weight:bold;">&#40;</span>@rootdir,<span style="color:#996600;">'public'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Joomla root will be #{jooroot}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    rio<span style="color:#006600; font-weight:bold;">&#40;</span>@templates,<span style="color:#996600;">'joomla-1.5.7'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>df<span style="color:#006600; font-weight:bold;">|</span> df <span style="color:#006600; font-weight:bold;">&amp;</span>gt; jooroot <span style="color:#006600; font-weight:bold;">&#125;</span> 
&nbsp;
    rio<span style="color:#006600; font-weight:bold;">&#40;</span>jooroot<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chdir</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Removing stock Joomla config...'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'configuration.php-dist'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">rm</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Generate and output joomla config</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Generating configuration.php based on provided settings...'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      joocfg = rio<span style="color:#006600; font-weight:bold;">&#40;</span>@configs, <span style="color:#996600;">'joomla.cfg'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> !joocfg.<span style="color:#9900CC;">exist</span>? <span style="color:#006600; font-weight:bold;">||</span> !joocfg.<span style="color:#9900CC;">readable</span>?
        flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Joomla config template missing or unreadable, quitting&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">2</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Copy the config into a string, do things with it and then write it to disk</span>
      config = <span style="color:#996600;">''</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span>@configs, <span style="color:#996600;">'joomla.cfg'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;</span>gt; config
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Warning: config file '#{@configs}/joomla.cfg' is empty&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> config.<span style="color:#9900CC;">empty</span>?
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_HOST_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_USER_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_PASS_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'pass'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'_MKS_DB_NAME_'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0066ff; font-weight:bold;">@db</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'name'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      config.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_DOMAIN_'</span>, <span style="color:#0066ff; font-weight:bold;">@domain</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      config.<span style="color:#CC0066; font-weight:bold;">gsub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'_MKS_SECRET_'</span>, genAlpha<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Writing ./configuration.php&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'configuration.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">w</span>!.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>config<span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Making configuration.php world writable (0666)&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'configuration.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">chmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0666</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># Setup the database</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">databaseSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Add DNS info</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">dnsSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    <span style="color:#008000; font-style:italic;"># Setup the server/vhost</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">serverSetup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> postInstall<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Joomla is ready to be setup using the web interface'</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Go to #{@domain} where the Joomla! web based installer will
           guide you through the rest of the installation&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Here's the database information:<span style="color:#000099;">\n</span>
           USERNAME: #{@db['user']}<span style="color:#000099;">\n</span>
           DB HOST : #{@db['host']}<span style="color:#000099;">\n</span>
           DB NAME : #{@db['name']}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>Admin panel is located @ #{@domain}/administrator &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;You can log into Admin using the username 'admin' along with the
    password that was generated or you chose during the web based install.&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">super</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> PHPMotion <span style="color:#006600; font-weight:bold;">&amp;</span>lt; App
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">'PHPMotion support is currently not available. sowwie'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Log
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>filename=<span style="color:#996600;">&quot;/tmp/#{Username}_mksite.log&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@log</span> = rio<span style="color:#006600; font-weight:bold;">&#40;</span>filename<span style="color:#006600; font-weight:bold;">&#41;</span>
    n=<span style="color:#006666;">0</span>; <span style="color:#0066ff; font-weight:bold;">@log</span> = rio<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{filename}.#{n+=1}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">while</span> <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#9900CC;">exist</span>?
    <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;# GENERATED BY MKS - BEGAN @ #{Time.now.to_i}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#9900CC;">chmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">00600</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Log file generated (important): #{@log.to_s} (no worries, set to 600)&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0066ff; font-weight:bold;">@log</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># append to log</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;">#super &amp;lt;&amp;lt;(data)</span>
    <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#CC0066; font-weight:bold;">puts</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;">#@log &amp;lt;&amp;lt; data &amp;lt;&amp;lt; &quot;\n&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> loadConfig<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  cfgpath = <span style="color:#996600;">&quot;#{ENV['HOME']}/.mksite&quot;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#CC00FF; font-weight:bold;">YAML</span>.<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span>rio<span style="color:#006600; font-weight:bold;">&#40;</span>cfgpath<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> rio<span style="color:#006600; font-weight:bold;">&#40;</span>cfgpath<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">exist</span>?
  <span style="color:#0000FF; font-weight:bold;">nil</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> getVal<span style="color:#006600; font-weight:bold;">&#40;</span>key, default=<span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#ff6633; font-weight:bold;">$config</span><span style="color:#006600; font-weight:bold;">&#91;</span>key<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#ff6633; font-weight:bold;">$config</span> <span style="color:#9966CC; font-weight:bold;">and</span> <span style="color:#9966CC; font-weight:bold;">defined</span>? <span style="color:#ff6633; font-weight:bold;">$config</span><span style="color:#006600; font-weight:bold;">&#91;</span>key<span style="color:#006600; font-weight:bold;">&#93;</span>
  default
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> main
  <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#996600;">'root'</span>==ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'USER'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>$config = loadConfig<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'~/.mksite config loaded'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">else</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'~/.mksite not found. It<span style="color:#000099;">\'</span>s fine, I<span style="color:#000099;">\'</span>ll annoy you with questions.'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#ff6633; font-weight:bold;">$config</span>.<span style="color:#9900CC;">inspect</span> <span style="color:#9966CC; font-weight:bold;">if</span> Testing
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Press ^C (CTRL+C) at any time quit'</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;"># Let's ask neutral questions about the new site.</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> Testing
    rootdir = <span style="color:#996600;">'/tmp/sandbox9/'</span>
    domain = <span style="color:#996600;">'domain.cxm'</span>
  <span style="color:#9966CC; font-weight:bold;">else</span>
    domain = ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Enter site<span style="color:#000099;">\'</span>s domain name (no http:// or www): '</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#{ |d| d.validate = !! /^www\.|^http:\/\// }</span>
    rootdir = ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Root site directory (leave blank for default): '</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>q<span style="color:#006600; font-weight:bold;">|</span>
      q.<span style="color:#9900CC;">default</span> = <span style="color:#996600;">&quot;/home/#{Username}/www/#{domain}/&quot;</span>
      q.<span style="color:#9900CC;">validate</span> = <span style="color:#006600; font-weight:bold;">/</span>^\<span style="color:#006600; font-weight:bold;">/</span>home\<span style="color:#006600; font-weight:bold;">/</span><span style="color:#008000; font-style:italic;">#{Username}\//</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Domain has been set to <span style="color:#000099;">\&quot;</span>#{domain}<span style="color:#000099;">\&quot;</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;">#$log = Log.new(&quot;/tmp/mks_#{domain}.log&quot;) </span>
&nbsp;
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Site will reside in <span style="color:#000099;">\&quot;</span>#{rootdir}<span style="color:#000099;">\&quot;</span>, and the index/script&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot; files (index.php, .htaccess etc) will go in <span style="color:#000099;">\&quot;</span>#{rootdir}/public/<span style="color:#000099;">\&quot;</span><span style="color:#000099;">\n</span><span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Ask the user what app she wants to install and specific questions about that app</span>
  app = <span style="color:#0000FF; font-weight:bold;">nil</span>
  choose <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>menu<span style="color:#006600; font-weight:bold;">|</span>
    menu.<span style="color:#9900CC;">prompt</span> = <span style="color:#996600;">'Choose the software for your new site: '</span>
    Applications.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>app<span style="color:#006600; font-weight:bold;">|</span>
      menu.<span style="color:#9900CC;">choice</span> app <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>a<span style="color:#006600; font-weight:bold;">|</span>
        app = a
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;You chose #{app}. #{Kernel.const_get(app).message}<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
&nbsp;
  <span style="color:#008000; font-style:italic;"># Fetch DB info if this app needs a database</span>
  <span style="color:#008000; font-style:italic;"># XXX Should just have a db flag in the App's class</span>
  db = <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#9966CC; font-weight:bold;">unless</span> app.<span style="color:#9900CC;">eql</span>? <span style="color:#ff3333; font-weight:bold;">:Skeleton</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'This app requires a database (only MySQL supported)'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'It will be created if it doesn<span style="color:#000099;">\'</span>t exist'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    db = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">'localhost'</span>
    <span style="color:#CC0066; font-weight:bold;">loop</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> Testing
        db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">'kiwi'</span>
        db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'pass'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">''</span>
        db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'name'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">'kiwi_sandbox9'</span>
      <span style="color:#9966CC; font-weight:bold;">else</span>
        db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'db_user'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Enter MySQL username: '</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'pass'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'db_pass'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Enter MySQL password: '</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>q<span style="color:#006600; font-weight:bold;">|</span> q.<span style="color:#9900CC;">echo</span> = <span style="color:#996600;">'*'</span><span style="color:#006600; font-weight:bold;">&#125;</span>
        db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'name'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = ask<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Enter database name (should begin w/ your <span style="color:#000099;">\'</span>username_<span style="color:#000099;">\'</span>)'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>dbn<span style="color:#006600; font-weight:bold;">|</span> dbn.<span style="color:#9900CC;">validate</span> = <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;">#{Username}_/}</span>
        <span style="color:#CC0066; font-weight:bold;">puts</span> db.<span style="color:#9900CC;">inspect</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Please double check: mysql://#{db['user']}:#{'*' * (db['pass']).size}@#{db['host']}/#{db['name']}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">break</span> <span style="color:#9966CC; font-weight:bold;">if</span> Testing <span style="color:#006600; font-weight:bold;">||</span> agree<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Is this correct?'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Please re-enter database info<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Check permissions and database login</span>
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Doing a preliminary check'</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Checking installation environment'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;"># Quit if the directory exists and the user does not want to go ahead</span>
  <span style="color:#9966CC; font-weight:bold;">unless</span> Testing
    <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span> <span style="color:#9966CC; font-weight:bold;">if</span> rio<span style="color:#006600; font-weight:bold;">&#40;</span>rootdir<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">exist</span>? <span style="color:#006600; font-weight:bold;">&amp;</span>amp;<span style="color:#006600; font-weight:bold;">&amp;</span>amp; !agree<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Directory '#{rootdir}' exists! Continue? (Y/N)&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Is the parent directory available and writable?</span>
  parentdir = rio<span style="color:#006600; font-weight:bold;">&#40;</span>rootdir<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">dirname</span>
  <span style="color:#9966CC; font-weight:bold;">unless</span> parentdir.<span style="color:#9900CC;">exist</span>? <span style="color:#006600; font-weight:bold;">&amp;</span>amp;<span style="color:#006600; font-weight:bold;">&amp;</span>amp; parentdir.<span style="color:#9900CC;">writable</span>?
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Directory '#{parentdir.to_s}' either doesn't exist or is not writable. Check permissions&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">unless</span> db.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#0000FF; font-weight:bold;">false</span>==getVal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'db_confirm'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;"># Check DB connection - but this does not check if user has any privileges</span>
    flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Checking database connection'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      dbo = Mysql.<span style="color:#9900CC;">real_connect</span><span style="color:#006600; font-weight:bold;">&#40;</span>db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, db<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'pass'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Successfully connected to '#{dbo.get_server_info}'&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">Mysql::Error</span> <span style="color:#006600; font-weight:bold;">=&amp;gt;</span> err
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'Unable to connect to database server'</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Error returned (#{err.errno}) = '#{err.error}'&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span>
    <span style="color:#9966CC; font-weight:bold;">ensure</span>
      dbo.<span style="color:#9900CC;">close</span> <span style="color:#9966CC; font-weight:bold;">if</span> dbo
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Begin installation</span>
  flash<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Word on the server racks is... you<span style="color:#000099;">\'</span>re good to go&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:emphasize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  klass = <span style="color:#CC00FF; font-weight:bold;">Kernel</span>.<span style="color:#9900CC;">const_get</span><span style="color:#006600; font-weight:bold;">&#40;</span>app<span style="color:#006600; font-weight:bold;">&#41;</span>
  webapp = klass.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>rootdir, domain, db<span style="color:#006600; font-weight:bold;">&#41;</span>
  webapp.<span style="color:#9900CC;">setup</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  webapp.<span style="color:#9900CC;">postInstall</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
main<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p><a href="http://biodegradablegeek.com/wp-content/uploads/2008/10/mksite.rb" target="_new"><strong>Download</strong> the ASCII mksite.rb file here.</a></p>
<p><a href="http://sharethis.com/item?&wp=2.6.1&amp;publisher=0f1bbcee-5646-4c3b-a5fa-23322de412ee&amp;title=Script+to+Quickly+Setup+WebApp+Environment+and+Domain&amp;url=http%3A%2F%2Fbiodegradablegeek.com%2F2008%2F10%2Fscript-to-quickly-setup-webapp-environment-and-domain%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/BiodegradableGeek/~4/418252507" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://biodegradablegeek.com/2008/10/script-to-quickly-setup-webapp-environment-and-domain/feed/</wfw:commentRss>
		<feedburner:origLink>http://biodegradablegeek.com/2008/10/script-to-quickly-setup-webapp-environment-and-domain/</feedburner:origLink></item>
		<item>
		<title>Top 5 Linux Apps That’ll Boost Your Productivity</title>
		<link>http://feeds.feedburner.com/~r/BiodegradableGeek/~3/412471173/</link>
		<comments>http://biodegradablegeek.com/2008/10/top-5-linux-apps-thatll-boost-your-productivity/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 04:57:53 +0000</pubDate>
		<dc:creator>Isam</dc:creator>
		
		<category><![CDATA[Intertubes]]></category>

		<category><![CDATA[List]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[productivity]]></category>

		<category><![CDATA[add]]></category>

		<category><![CDATA[adhd]]></category>

		<category><![CDATA[applications]]></category>

		<category><![CDATA[appz]]></category>

		<category><![CDATA[calendar]]></category>

		<category><![CDATA[calendars]]></category>

		<category><![CDATA[doing]]></category>

		<category><![CDATA[firebug]]></category>

		<category><![CDATA[gcal]]></category>

		<category><![CDATA[getting things done]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[gtd]]></category>

		<category><![CDATA[kuake]]></category>

		<category><![CDATA[mozilla]]></category>

		<category><![CDATA[prism]]></category>

		<category><![CDATA[q3a]]></category>

		<category><![CDATA[recommended]]></category>

		<category><![CDATA[rescue time]]></category>

		<category><![CDATA[rescuetime]]></category>

		<category><![CDATA[screen]]></category>

		<category><![CDATA[tada]]></category>

		<category><![CDATA[thinking]]></category>

		<category><![CDATA[tilad]]></category>

		<category><![CDATA[tilde]]></category>

		<category><![CDATA[time management]]></category>

		<category><![CDATA[todo]]></category>

		<category><![CDATA[tomboy]]></category>

		<category><![CDATA[top10]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[vim]]></category>

		<category><![CDATA[working]]></category>

		<guid isPermaLink="false">http://biodegradablegeek.com/?p=199</guid>
		<description><![CDATA[These are not in any specific order. Also, some might be available on other operating systems.

Tomboy
 
This is the best note taking app I&#8217;ve ever used. It sits in your taskbar, doesn&#8217;t annoy you and doesn&#8217;t hog your cpu cycles or memory. When you wanna jot down something, hit a global shortcut, type away, and [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Top 5 Linux Apps That&#8217;ll Boost Your Productivity", url: "http://biodegradablegeek.com/2008/10/top-5-linux-apps-thatll-boost-your-productivity/" });</script>]]></description>
			<content:encoded><![CDATA[<p><em>These are not in any specific order. Also, some might be available on other operating systems.</em><br />
<br/></p>
<h2><a href="http://www.gnome.org/projects/tomboy/" class="top10src" target="_blank">Tomboy</a></h2>
<p><img class="plainimg size-full wp-image-224 alignleft" style="padding: 5px;" title="tomboy-128" src="http://biodegradablegeek.com/wp-content/uploads/2008/10/tomboy-128.png" alt="" width="90" height="85" /> <img class="plainimg size-full wp-image-225 alignnone" style="padding: 5px;" title="tomboy" src="http://biodegradablegeek.com/wp-content/uploads/2008/10/tomboy.png" alt="" width="207" height="66" /></p>
<p>This is the best note taking app I&#8217;ve ever used. It sits in your taskbar, doesn&#8217;t annoy you and doesn&#8217;t hog your cpu cycles or memory. When you wanna jot down something, hit a global shortcut, type away, and then close. Notes are saved as you type, and it automatically links notes together if you use CamelCase words. It&#8217;s written in C#, and still pretty young, but I&#8217;ve never had a problem with it in regard to stability or compatibility.</p>
<p>If your distro&#8217;s repository doesn&#8217;t have a package for the latest version (0.12.0, I highly recommend downloading a newer binary and/or install from trunk/)</p>
<p><strong>Official site:</strong> <a href="http://www.gnome.org/projects/tomboy/" target="_blank">http://www.gnome.org/projects/tomboy/</a><br />
<strong>Subversion:</strong> <a href="http://svn.gnome.org/viewvc/tomboy/trunk/" target="_blank">http://svn.gnome.org/viewvc/tomboy/trunk/</a></p>
<p><br/></p>
<h2><a href="http://sourceforge.net/projects/tilda/" class="top10src" target="_blank">Tilda and friends</a></h2>
<p><img class="plainimg alignleft size-full wp-image-226" style="padding: 5px;" title="fetchphp" src="http://biodegradablegeek.com/wp-content/uploads/2008/10/fetchphp.png" alt="" width="128" height="128" /><br />
You know those slide-down consoles in FPS games like Quake, UT, Half-Life, that you invoke by hitting tilde (~), and use to enter your leet r_picmip hacks? Tilda is a Quake style drop-down terminal that gives you the same quick access to your Linux console on any workspace. No more opening a new terminal window for every little task.</p>
<p><strong>Official site:</strong> <a href="http://sourceforge.net/projects/tilda/" target="_blank">http://sourceforge.net/projects/tilda/</a></p>
<p><em>Tilda isn&#8217;t the only app of its kind. It&#8217;s not even the first. Check out the alternatives as well: </em><br />
<strong>sjterm (&#8221;works well with Compiz&#8221;):</strong> <a href="https://gna.org/projects/stjerm/" target="_blank">https://gna.org/projects/stjerm/</a> (<a href="https://gna.org/projects/stjerm/" target="_blank">alt page</a>)<br />
<strong>Yet Another Kuake (Yakuake, for KDE):</strong> <a href="http://yakuake.uv.ro/" target="_blank">http://yakuake.uv.ro/</a><br />
<strong>Kuake:</strong> <a href="http://www.nemohackers.org/kuake.php" target="_blank">http://www.nemohackers.org/kuake.php</a><br />
<strong>Visor (OS X):</strong> <a href="http://docs.blacktree.com/visor/visor" target="_blank">http://docs.blacktree.com/visor/visor</a></p>
<p><br/></p>
<h2><a href="http://rescuetime.com/" class="top10src" target="_blank">RescueTime</a></h2>
<p><a href="http://biodegradablegeek.com/wp-content/uploads/2008/10/rescue_time_logo_white.gif"><img class="plainimg alignleft size-full wp-image-227" title="rescue_time_logo_white" src="http://biodegradablegeek.com/wp-content/uploads/2008/10/rescue_time_logo_white.gif" alt="" width="213" height="60" /></a></p>
<p>RescueTime is a little program you download (Mac, Windows, Linux) that sits in the background and checks what windows/apps have focus, and uses this data to compile statistics about your computer habits and productivity. It creates neat graphs and shows how productive you are compared to others within a certain time frame.</p>
<p>The commercial versions have some great team features but the free one is enough to track your own productivity. If you&#8217;re paranoid, run it through a proxy or chew some Alprazolam or Zyprexa. <strong>It&#8217;s worth it. </strong></p>
<p>An app sorta like this was an idea I had but never implemented. It was one of those <em>wake up in the middle of the night with an epiphany, scramble to find a pen and paper to jot it down before it&#8217;s gone forever</em> idea, that you then wake up and either find silly or just toss in the idea bin never to be thought of again. The idea stemmed from wanting to create a chart of how I spend my time and compare myself week by week. My proposed implementation was a lot simpler though. I was thinking about having it only track apps that you specify.</p>
<p>This differs from RT which has a gigantic db of categorized apps and lets you choose categories to tag as productive or not (i.e., rhythmbox and mplayer would go under audio/video) I like RT&#8217;s implementation.</p>
<p><strong>Official Site:</strong> <a href="http://rescuetime.com/" target="_blank">http://rescuetime.com/</a><br />
<strong>Unofficial Linux client (works great):</strong> <a href="https://launchpad.net/rescuetime-linux-uploader" target="_blank">https://launchpad.net/rescuetime-linux-uploader</a></p>
<p><br/></p>
<h2><a href="http://www.gnu.org/software/screen/" class="top10src" target="_blank">Screen</a></h2>
<p><img class="plainimg alignleft size-full wp-image-230" style="padding: 5px;" title="gnu_split_screen" src="http://biodegradablegeek.com/wp-content/uploads/2008/10/gnu_split_screen1.png" alt="" width="220" height="142" /><br />
Screen is something you find on everybody&#8217;s list of Top/Fav Linux apps. If you use the console a lot, especially remotely, <strong>screen is a must have.</strong></p>
<p>It keeps a persistent console session open, and lets you attach and detach from it anytime you want, which is great if you get disconnected while working over a network, or when you want to continue what you&#8217;re doing at home from work or while on the road. It also has neat features like split screen, tabbed consoles, etc.</p>
<p>When you first run it, you might not notice anything different, but you&#8217;re actually in a screen session. Press <strong>CTRL+a</strong>, followed by &#8216;<strong>?</strong>&#8216; to see a list of shortcuts. Tilda + screen = hacks.</p>
<p><em>Note:</em> The CTRL+a keystroke is part of many of screen&#8217;s shortcuts. Unfortunately, it&#8217;s a shortcut in Bash that I frequently use (lets you jump to the beginning of the line), so this is annoying to me. There are ways around this but I&#8217;ve just gotten used to the workaround. To jump to the beginning of the line in screen, press <strong>CTRL+a, a</strong></p>
<p><strong>Official site:</strong> <a href="http://www.gnu.org/software/screen/ " target="_blank">http://www.gnu.org/software/screen/ </a></p>
<p>You might have it installed. If not:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> screen</pre></div></div>

<p>Also check out <strong>screenie</strong>, a wrapper for screen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> screenie</pre></div></div>

<p><br/></p>
<h2><a href="http://labs.mozilla.com/2007/10/prism/" class="top10src" target="_blank">Google Calendar Prism</a></h2>
<p><img class="plainimg alignleft size-full wp-image-228" title="prism-google-calendar-gcal" src="http://biodegradablegeek.com/wp-content/uploads/2008/10/prism-google-calendar-gcal.png" alt="" width="130" height="160" /><br />
Digital calendars are either <em>too lean</em> (lack features), or are too bloated to keep open. I don&#8217;t need the email features that come with some of them, and hate the fact that they&#8217;re written in Java.</p>
<p>I tried a number of apps before trying web apps, and now use Google Calendar. It&#8217;s secure, fast and you can see your life anywhere. One nice feature is being able to add to or edit the calendar from your PDA  or using text messages. I was initially weary of putting my calendar online, but the benefits outweigh the cons (paranoia).</p>
<p>Going back to desktop apps. The only decent one I&#8217;ve tried was <a href="http://www.rainlendar.net/">Rainlendar</a>, but it&#8217;s broken on Linux and it&#8217;s closed source. Besides, I only liked it because it was simple but synced with Google Cal. At the time, the only alternative I considered was keeping a tab open with Google Calendar, which I wasn&#8217;t going to do because Firefox needs to be xkill&#8217;d every few days. Then it hit me; Mozilla Prism!</p>
<p><a href="http://labs.mozilla.com/2007/10/prism/">Prism</a> is (basically) a stripped down web browser that is meant to help integrate web apps onto your desktop. <strong>prism-google-calendar</strong> is a packaged Mozilla Prism setup with Google Calendar out of the box.</p>
<p>It runs independent of your browser and can be treated as a webApp. And since it has its own memory space, it doesn&#8217;t go sluggish with Firefox and never needs to be restarted.</p>
<p>I keep it open fullscreen on my second monitor, and can glance at it anytime I feel lost in life.</p>
<p>The only thing missing is a decent alarm feature. Javascript alert()s are shit, and I don&#8217;t want annoying emails about my events. I suppose there are hacks around the problem but I learned to glance at the calendar often and don&#8217;t need reminders so much anymore.</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> prism-google-calendar</pre></div></div>

<p><br/><br/></p>
<p><a href="http://sharethis.com/item?&wp=2.6.1&amp;publisher=0f1bbcee-5646-4c3b-a5fa-23322de412ee&amp;title=Top+5+Linux+Apps+That%26%238217%3Bll+Boost+Your+Productivity&amp;url=http%3A%2F%2Fbiodegradablegeek.com%2F2008%2F10%2Ftop-5-linux-apps-thatll-boost-your-productivity%2F">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/BiodegradableGeek/~4/412471173" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://biodegradablegeek.com/2008/10/top-5-linux-apps-thatll-boost-your-productivity/feed/</wfw:commentRss>
		<feedburner:origLink>http://biodegradablegeek.com/2008/10/top-5-linux-apps-thatll-boost-your-productivity/</feedburner:origLink></item>
		<item>
		<title>Sharing Files Locally Without a Crossover Cable on OS X</title>
		<link>http://feeds.feedburner.com/~r/BiodegradableGeek/~3/409856019/</link>
		<comments>http://biodegradablegeek.com/2008/10/sharing-files-locally-without-a-crossover-cable-on-os-x/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 02:53:56 +0000</pubDate>
		<dc:creator>Isam</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<category><![CDATA[Workarounds]]></category>

		<category><![CDATA[file sharing]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[apple]]></category>

		<category><![CDATA[cat5]]></category>

		<category><![CDATA[category-5]]></category>

		<category><![CDATA[cross over cable]]></category>

		<category><![CDATA[crossover cable]]></category>

		<category><![CDATA[hackintosh]]></category>

		<category><![CDATA[imac]]></category>

		<category><![CDATA[macbook]]></category>

		<category><![CDATA[macbook pro]]></category>

		<category><![CDATA[macintosh]]></category>

		<category><![CDATA[macosx]]></category>

		<category><![CDATA[mbp]]></category>

		<category><![CDATA[netbios]]></category>

		<category><![CDATA[os x]]></category>

		<category><![CDATA[os9]]></category>

		<category><![CDATA[osx]]></category>

		<category><![CDATA[routers]]></category>

		<category><![CDATA[sending files]]></category>

		<category><![CDATA[share]]></category>

		<category><![CDATA[sharing files]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://biodegradablegeek.com/?p=147</guid>
		<description><![CDATA[Mac OS X is capable of intelligently detecting whether a cat5 cable is connected to a network device or to another PC. When connected to another PC, it will (digitally) flip the pins to &#8220;emulate&#8221; a cat5 crossover cable.
Here&#8217;s an example on how to share files between a Macbook and another box (XP, Linux etc). [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Sharing Files Locally Without a Crossover Cable on OS X", url: "http://biodegradablegeek.com/2008/10/sharing-files-locally-without-a-crossover-cable-on-os-x/" });</script>]]></description>
			<content:encoded><![CDATA[<p>Mac OS X is capable of intelligently detecting whether a cat5 cable is connected to a network device or to