<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog - ShiftEleven &#187; script</title>
	<atom:link href="http://shifteleven.com/articles/tag/script/feed" rel="self" type="application/rss+xml" />
	<link>http://shifteleven.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 19 Sep 2009 11:19:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>Managing Vim Scripts with a Vimball</title>
		<link>http://shifteleven.com/articles/2009/05/21/managing-vim-plugins-with-a-vimball</link>
		<comments>http://shifteleven.com/articles/2009/05/21/managing-vim-plugins-with-a-vimball#comments</comments>
		<pubDate>Fri, 22 May 2009 03:38:27 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Version Control]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimball]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=214</guid>
		<description><![CDATA[I am a vim user.  The thing I like about vim is it&#8217;s speed, how universal it is, and it&#8217;s customizations.  These customizations can come in the form of plugins, syntax files, compilers, and code completion utilities; all of which are scripts.  Scripts can be a single file like MiniBufExplorer or can encompass multple files [...]]]></description>
			<content:encoded><![CDATA[<p>I am a <a href="http://www.vim.org">vim</a> user.  The thing I like about vim is it&#8217;s speed, how universal it is, and it&#8217;s customizations.  These customizations can come in the form of plugins, syntax files, compilers, and code completion utilities; all of which are <a href="http://www.vim.org/scripts/index.php">scripts</a>.  Scripts can be a single file like <a href="http://vim.sourceforge.net/scripts/script.php?script_id=159">MiniBufExplorer</a> or can encompass multple files like <a href="http://www.vim.org/scripts/script.php?script_id=1213">vjde</a>.</p>
<p>Single file scripts are fairly easy to manage.  If you notice a new version of your script is released, then simply replace your file with the new version.  Likewise, it&#8217;s very easy to remove the script if you want to just try it out.  However, scripts spanning multiple files are much harder to manage.  For one, the script&#8217;s files get merged in with all of your other script files.</p>
<p>To help know what files are apart of what plugin, I manage <a href="http://github.com/pope/personal/tree/master">my vim scripts in git</a>.  Another way to keep track of things is to use a <a href="http://vimdoc.sourceforge.net/htmldoc/pi_vimball.html">vimball</a>.</p>
<h3>What Are Vimballs?</h3>
<p>Vimballs are essential vim script installers.  Each vimball contains all of the files that are needed for the script to work.  Not only that, but it also has a hook for you to easily uninstall the script as well.</p>
<p><a href="http://www.vim.org/scripts/script.php?script_id=1714">Tail Bundle</a> is a script that mimics <code>tail -f</code> for vim.  The downloadable artifact is a vba file.  That file is the vimball.  To actually install the file:</p>
<ol>
<li><code>vim tail-03.vba</code></li>
<li><code>:so %</code></li>
<li><code>:q</code></li>
</ol>
<p>So what that all means is that you&#8217;re opening the vimball in vim.  From there, you&#8217;re executing the instructions that are in the file.  Lastly, you&#8217;re just quitting.  You see, a vimball is a vim script in of itself.  So executing it writes everything out to where it&#8217;s supposed to go.</p>
<p>While the tail bundle makes use of the vimball, not every script does.  Luckily, it&#8217;s easy to make vimballs out of most script downloads.<br />
<span id="more-214"></span></p>
<h3>Converting Scripts to a Vimball</h3>
<p>In order to make a vimball, it&#8217;s quite easy. List out all of the files you want to include in your bundle, relative to where your current directory is.  For instance:</p>
<pre>doc/myawesomeplugin.txt
plugin/myawesomeplugin.vim
syntax/myawesomeplugin.vim</pre>
<p>Next thing, while in visual mode, type <code>ggVG:MkVimball myawesomeplugin</code>.  The <code>ggVG</code> is a akin to doing a &#8220;select all&#8221;.</p>
<p>This will create your install file named myawesomeplugin.vba.  Now just install it like any other vimball.</p>
<p>You don&#8217;t have to just make vimballs for your own scripts.  I love <a href="http://www.vim.org/scripts/script.php?script_id=2611">xpt</a>, but there are so many files to manage.  Well, you can make the vimball script even when the author does not.</p>
<p>Open a new buffer and use the command <code>:r! find . -type f</code>.  This will find all of the files and print them out into the buffer.  If you want to do any cleanup, like remove blank lines and removing the extra <code>./</code> before each entry, feel free to do so.  Now that you easily got a list of all the files, create the vimball from that.</p>
<p>Now you have records of what went in with the script and you have a super easy way of uninstalling the script too.  Speaking of which&#8230;</p>
<h3>Removing Scripts</h3>
<p>To remove a vimball script, simply execute <code>:RmVimball myawesomeplugin</code>.  That will go through and delete all files created by the plugin.</p>
<p>After figuring this out, I now know that when I want to use and install vim scripts, I&#8217;m going to do so via vimballs.  It&#8217;s too easy not to, and the benefit of having a way to back-out scripts is just too tempting.</p>
]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2009/05/21/managing-vim-plugins-with-a-vimball/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Loading Your Rails Environment Into a Script</title>
		<link>http://shifteleven.com/articles/2006/10/08/loading-your-rails-environment-into-a-script</link>
		<comments>http://shifteleven.com/articles/2006/10/08/loading-your-rails-environment-into-a-script#comments</comments>
		<pubDate>Mon, 09 Oct 2006 03:08:52 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://dev.fecalrod.com/articles/2006/10/08/loading-your-rails-environment-into-a-script</guid>
		<description><![CDATA[This is a fairly simple little tidbit, but still useful.  Sometimes I want to have a script for my rails application, like running some reports on the data.  There are two basic ways to do this: write a task(rake), or create a new ruby script file, like in the scripts directory.
If you want [...]]]></description>
			<content:encoded><![CDATA[<p>This is a fairly simple little tidbit, but still useful.  Sometimes I want to have a script for my rails application, like running some reports on the data.  There are two basic ways to do this: write a task(rake), or create a new ruby script file, like in the scripts directory.</p>
<p>If you want to do the latter, then there are two lines you my want to put at the top of your script.</p>
<pre class="ruby" title="code">ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")</pre>
<p>The first line allows us to supply which environment we would like to run the script in.  Say the script is called <code>process.rb</code>, we could call the script like <code>./process.rb production</code> and now the environment is set to production.</p>
<p>The second line loads the environment file.  Now all of rails, your models, libraries, and plugins are available to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2006/10/08/loading-your-rails-environment-into-a-script/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
