<?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>LuckyCatLabs &#187; Uncategorized</title>
	<atom:link href="http://blog.luckycatlabs.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.luckycatlabs.com</link>
	<description>Making code suck less</description>
	<lastBuildDate>Tue, 16 Mar 2010 01:37:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Licensing Your Code the Ruby Way</title>
		<link>http://blog.luckycatlabs.com/2009/01/31/licensing-your-code-the-ruby-way/</link>
		<comments>http://blog.luckycatlabs.com/2009/01/31/licensing-your-code-the-ruby-way/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:44:52 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.luckycatlabs.com/?p=31</guid>
		<description><![CDATA[Do you have an existing project you want to open-source?  Does the thought of manually adding the license comment block to EVERY. SINGLE. SOURCE. FILE. sound not-so-exciting?  Here&#8217;s some help, ruby style:

class Licenser

    def licenseFiles(dir)
          filenames = Dir[dir.chop + "**/*.java"]
	  [...]]]></description>
			<content:encoded><![CDATA[<p>Do you have an existing project you want to open-source?  Does the thought of manually adding the license comment block to EVERY. SINGLE. SOURCE. FILE. sound not-so-exciting?  Here&#8217;s some help, ruby style:</p>
<pre name="code" class="ruby:nocontrols:nogutter">
class Licenser

    def licenseFiles(dir)
          filenames = Dir[dir.chop + "**/*.java"]
	  for filename in filenames do
              contents = ''
              File.open(filename, 'r') { |file| contents = file.read }
              contents = HEADER + contents
              File.open(filename, 'w') { |file| file.write(contents) }
          end
    end
end

HEADER = &lt;&lt;HEAD
/*
 * Copyright 2008-2009 Mike Reedell / LuckyCatLabs.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

HEAD

	Licenser.new.licenseFiles(ARGV[0])
</pre>
<p>This script was inspired by the the <a href="http://svn.apache.org/viewvc/incubator/ode/trunk/tasks/check_license_headers.rb?revision=524802&#038;view=markup&#038;pathrev=524802">check_license_headers.rb</a> script in the Apache SVN repo.  Couldn&#8217;t get it to work on my setup, so I rewrote the parts I needed.</p>
<p>This can be found in the <a href="http://github.com/mikereedell/scripts/tree/master">LuckyCat Labs GitHub scripts project</a>.  Look for updates to handle more source types and to check for existing license headers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.luckycatlabs.com/2009/01/31/licensing-your-code-the-ruby-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
