<?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>stick&#039;s corner &#187; ruby</title>
	<atom:link href="http://stick.gk2.sk/blog/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://stick.gk2.sk</link>
	<description>Look at you, hacker. A pathetic creature of meat and bone. How can you challenge a perfect, immortal machine?</description>
	<lastBuildDate>Mon, 26 Jul 2010 16:31:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Gemcutter + openSUSE Build Service cooperation (idea)</title>
		<link>http://stick.gk2.sk/blog/2010/01/gemcutter-opensuse-build-service-cooperation-idea/</link>
		<comments>http://stick.gk2.sk/blog/2010/01/gemcutter-opensuse-build-service-cooperation-idea/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 14:32:23 +0000</pubDate>
		<dc:creator>Pavol Rusnak</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[gemcutter]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[mandriva]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://stick.gk2.sk/?p=1013</guid>
		<description><![CDATA[If you are closely following Ruby development and especially the situation around ruby gems, you might already know of Gemcutter. It is a new service, which provides a very easy way how to publish gems and also a good API to deal with them. It is not trying to replace RubyForge as whole, just its [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1017" style="margin-right: 8px;" title="Gemcutter" src="http://stick.gk2.sk/blog/wp-content/uploads/2010/01/gemcutter.png" alt="" width="128" height="128" /></p>
<p style="text-align: justify;">If you are closely following <a href="http://www.ruby-lang.org/">Ruby</a> development and especially the situation around ruby gems, you might already know of <a href="http://gemcutter.org/">Gemcutter</a>. It is a new service, which provides a very easy way how to publish gems and also a good <a href="http://gemcutter.org/pages/api_docs">API</a> to deal with them. It is not trying to replace <a href="http://rubyforge.org/">RubyForge</a> as whole, just its gem hosting (+ now defunct <a href="http://gems.github.com/">GitHub gem hosting</a>) and will soon become the central and the only place for Ruby gems. The whole site is <a href="http://www.opensource.org/licenses/mit-license.php">MIT licensed</a> and the code is available on <a href="http://github.com/qrush/gemcutter">GitHub</a>.</p>
<p style="text-align: justify;">During the winter holidays I wrote a <a href="http://gitorious.org/opensuse/misc/blobs/master/buildservice-gemcutter-versions">simple script</a> which utilizes the <a href="http://gemcutter.org/">Gemcutter</a> API and prints versions of <code>rubygem-*</code> packages in our <code>devel:languages:ruby:extensions</code> <a href="http://en.opensuse.org/Build_Service">Build Service</a> repository compared with the corresponding gem versions on Gemcutter. Using this script and a great <a href="http://rubyforge.org/projects/gem2rpm/">gem2rpm</a> (more particularly <code>gem2rpm-opensuse</code> command which applies openSUSE template and is available from <code>rubygem-gem2rpm</code> package), I was able to update nearly a hundred of gems in just two hours. <a href="http://rubyonrails.org/">Rails</a> rubygems have a specific packaging in openSUSE, so I left them out, but more than 90% of the rest didn&#8217;t need any changes in autogenerated spec file.</p>
<p style="text-align: justify;">This brought me an idea. If only <a href="http://gemcutter.org/">Gemcutter</a> had an option to somehow send out notification that a new gem has been pushed, we could automate the process and have up-to-date rubygems in our <code>devel:languages:ruby:extensions</code> repository almost instantly. (We would still need to keep the list of &#8220;dirty&#8221; rubygems that need to be updated manually, though. For example, <a href="http://rubyonrails.org/">Rails</a> packages I mentioned earlier, where we keep multiple versions, or others where we need to add a patch replacing <code>/usr/local/bin/ruby</code> with <code>/usr/bin/ruby</code> in scripts).</p>
<p style="text-align: justify;">Few days later, <a href="http://gemcutter.org/">Gemcutter</a> gained RSS feed support, but only for the gems one is interested in. I didn&#8217;t find the option to have RSS feed for all gems. This could have helped in creating such mechanism, but that won&#8217;t be needed anymore because &#8230;</p>
<p style="text-align: justify;">&#8230; yesterday <a href="http://twitter.com/qrush">Nick Quaranto</a> of <a href="http://gemcutter.org/">Gemcutter</a> announced <a href="http://gemcutter.org/pages/gem_docs#webhook">webhook support</a>. I&#8217;m really excited, because that&#8217;s exactly what we need! When one registers a webhook, <a href="http://gemcutter.org/">Gemcutter</a> emits a POST request on a certain URL when a gem is pushed or updated. This request is a JSON document containing the info about gem. What we need is to create a mechanism that:</p>
<ul>
<li>receives notification via POST JSON request</li>
<li>checks whether the package is not &#8220;dirty&#8221; → exit if it is (and probably send some email &#8230;)</li>
<li>fetches the package from the <a href="http://en.opensuse.org/Build_Service">Build Service</a> or create a new one</li>
<li>fetches the new gem, removes the old one</li>
<li>runs <code>gem2rpm-opensuse</code> to create a spec file replacing the old one</li>
<li>adds changelog entry</li>
<li>pushes the updated package back into the <a href="http://en.opensuse.org/Build_Service">Build Service</a></li>
</ul>
<p style="text-align: justify;">Last but not least: If <a href="http://fedoraproject.org/">Fedora</a> and <a href="http://mandriva.com/">Mandriva</a> had <a href="http://rubyforge.org/projects/gem2rpm/">gem2rpm</a> templates in a perfect shape too, <a href="http://en.opensuse.org/Build_Service">Build Service</a> could provide packaged gems also for their distributions.</p>
<p style="text-align: justify;">So what do you think? Any volunteers for this? Right now, I&#8217;m off to fix some small bugs I found in <a href="http://rubyforge.org/projects/gem2rpm/">gem2rpm</a> while fiddling with it &#8230; <img src='http://stick.gk2.sk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://stick.gk2.sk/blog/2010/01/gemcutter-opensuse-build-service-cooperation-idea/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>image_url function in Ruby on Rails</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/</link>
		<comments>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 15:40:31 +0000</pubDate>
		<dc:creator>Pavol Rusnak</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://stick.gk2.sk/?p=997</guid>
		<description><![CDATA[If you need to get the full URL of an image, just put the following code snippet into ApplicationHelper module in your app/helpers/application_helper.rb: def image_url(source) abs_path = image_path(source) unless abs_path =~ /^http/ abs_path = "#{request.protocol}#{request.host_with_port}#{abs_path}" end abs_path end I wonder why this function is not already a standard part of Rails. (Idea by Rob Biedenharn)]]></description>
			<content:encoded><![CDATA[<p>If you need to get the full URL of an image, just put the following code snippet into <code>ApplicationHelper</code> module in your <code>app/helpers/application_helper.rb</code>:</p>
<pre>  def image_url(source)
    abs_path = image_path(source)
    unless abs_path =~ /^http/
      abs_path = "#{request.protocol}#{request.host_with_port}#{abs_path}"
    end
   abs_path
  end</pre>
<p>I wonder why this function is not already a standard part of Rails.</p>
<p>(<a href="http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/ab495ed6596afe21">Idea</a> by <a href="http://biedenharn.us/">Rob Biedenharn</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
