<?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>Jtanium's Notebook &#187; dpkg</title>
	<atom:link href="http://www.jtanium.com/tag/dpkg/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jtanium.com</link>
	<description>I jot things down, in hopes of finding them later...</description>
	<lastBuildDate>Wed, 21 Dec 2011 23:21:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Using Native Bindings with Ruby Enterprise Edition</title>
		<link>http://www.jtanium.com/2008/10/13/using-native-bindings-with-ruby-enterprise-edition/</link>
		<comments>http://www.jtanium.com/2008/10/13/using-native-bindings-with-ruby-enterprise-edition/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 22:33:55 +0000</pubDate>
		<dc:creator>jtanium</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[phusion]]></category>
		<category><![CDATA[ruby enterprise edition]]></category>
		<category><![CDATA[warehouse]]></category>

		<guid isPermaLink="false">http://www.jtanium.com/blog/?p=63</guid>
		<description><![CDATA[I recently started using Passenger and Ruby Enterprise Edition to run my Rails apps. &#8220;It was just another day at the office, until suddenly&#8230;&#8221; I wanted to run Warehouse. It turns out that things get (just) slightly hairy when you need to use the native bindings for a library, in this case Subversion/SWIG. I ran [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started using <a href="http://www.modrails.com/">Passenger</a> and <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> to run my Rails apps.</p>
<p>&#8220;It was just another day at the office, until suddenly&#8230;&#8221; I wanted to run <a href="http://www.warehouseapp.com/">Warehouse</a>.  It turns out that things get (just) slightly hairy when you need to use the native bindings for a library, in this case Subversion/SWIG.</p>
<p>I ran <code>rake warehouse:bootstrap</code> without incident, but as soon as I submitted the &#8216;install&#8217; form, it died.  This is what I found in the log:</p>
<pre>ActionView::TemplateError (/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:478:in `const_missing': uninitialized constant Repository::Svn) on line #23 of repositories/index.html.erb:
20:
<li class="repo" id="repo-<%= repo.id %>">
21:     <%= link_to h(repo.name), hosted_url(repo, :admin) %>
22:     <span class="log"><%= repo.path %></span>
23:   <% if repo.sync? %>
24:   <% unless repo.sync_progress == 100 %>
25:
26:
<div class="need-sync" id="sync-<%= repo.id %>">

    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/vendor/plugins/expiring_attr_reader/lib/expiring_attr_reader.rb:32:in `silo'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/models/repository.rb:137:in `retrieve_silo'
    (eval):1:in `silo'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/models/repository.rb:100:in `eval'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/vendor/plugins/expiring_attr_reader/lib/expiring_attr_reader.rb:32:in `silo'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/models/repository.rb:100:in `sync?'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/views/repositories/index.html.erb:23:in `_run_erb_47app47views47repositories47index46html46erb'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/views/repositories/index.html.erb:19:in `each'
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/views/repositories/index.html.erb:19:in `_run_erb_47app47views47repositories47index46html46erb'
...</pre>
<p>Naturally I had installed the bindings using <code>sudo apt-get install libsvn-ruby1.8</code> so they were available to the default Ruby (located in <code>/usr/lib/ruby</code>), but not Ruby Enterprise Edition (located in <code>/opt/ruby-enterprise</code>), which the application runs on.</p>
<p>My solution was to simply symlink the Subversion bindings into Ruby Enterprise Edition.  A quick look in the libsvn-ruby package (<code>sudo dpkg -L libsvn-ruby1.8</code>) shows us what we&#8217;re dealing with:</p>
<pre>...
/usr/lib/ruby/1.8/i486-linux
/usr/lib/ruby/1.8/i486-linux/svn
/usr/lib/ruby/1.8/i486-linux/svn/ext
/usr/lib/ruby/1.8/i486-linux/svn/ext/core.so
/usr/lib/ruby/1.8/i486-linux/svn/ext/client.so
/usr/lib/ruby/1.8/i486-linux/svn/ext/delta.so
/usr/lib/ruby/1.8/i486-linux/svn/ext/fs.so
/usr/lib/ruby/1.8/i486-linux/svn/ext/ra.so
/usr/lib/ruby/1.8/i486-linux/svn/ext/repos.so
/usr/lib/ruby/1.8/i486-linux/svn/ext/wc.so
/usr/lib/ruby/1.8/svn
/usr/lib/ruby/1.8/svn/client.rb
/usr/lib/ruby/1.8/svn/core.rb
/usr/lib/ruby/1.8/svn/delta.rb
/usr/lib/ruby/1.8/svn/error.rb
/usr/lib/ruby/1.8/svn/fs.rb
/usr/lib/ruby/1.8/svn/info.rb
/usr/lib/ruby/1.8/svn/ra.rb
/usr/lib/ruby/1.8/svn/repos.rb
/usr/lib/ruby/1.8/svn/util.rb
/usr/lib/ruby/1.8/svn/wc.rb
...</pre>
<p>The key directories are: <code>/usr/lib/ruby/1.8/i486-linux/svn</code> and <code>/usr/lib/ruby/1.8/svn</code>.  So we&#8217;ll make them available to <code>/opt/ruby-enterprise</code> like so:</p>
<pre>cd /opt/ruby-enterprise/lib/ruby/1.8
sudo ln -s /usr/lib/ruby/1.8/svn
cd /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/i686-linux
sudo ln -s /usr/lib/ruby/1.8/i486-linux/svn</pre>
<p>After that, just restart Apache (<code>apache2ctl restart</code>), and it should be working.  Note, a simple <code>touch tmp/restart.txt</code> won&#8217;t work, because that doesn&#8217;t reload the libraries.  You actually need the <code>/opt/ruby-enterprise/ruby</code> process to restart.</p>
<p>Theoretically this same approach should work for any native bindings you need to be available to Ruby Enterprise Edition.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jtanium.com/2008/10/13/using-native-bindings-with-ruby-enterprise-edition/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

