<?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>Pivotal Labs &#187; fiasco</title>
	<atom:link href="http://pivotallabs.com/tag/fiasco/feed/" rel="self" type="application/rss+xml" />
	<link>http://pivotallabs.com</link>
	<description>Agility Developed</description>
	<lastBuildDate>Fri, 24 May 2013 21:58:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>The Naked Gemspec</title>
		<link>http://pivotallabs.com/the-naked-gemspec/</link>
		<comments>http://pivotallabs.com/the-naked-gemspec/#comments</comments>
		<pubDate>Fri, 14 Dec 2012 19:42:00 +0000</pubDate>
		<dc:creator>Doc Ritezel</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[bbq]]></category>
		<category><![CDATA[fiasco]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/the-naked-gemspec/</guid>
		<description><![CDATA[<p><p>Before we start, the <code>.gemspec</code> itself only appears once.  Here it is, as generated by <code>bundle init</code> and hand-tweaked for relevance:</p>

<pre><code>lib = File.expand_path&#40;"../lib", __FILE__&#41;
$LOAD_PATH.unshift&#40;lib&#41; unless $LOAD_PATH.include?&#40;lib&#41;
require "your_gem/version"

Gem::Specification.new do &#124;s&#124;
  s.name        = "your-gem"
  s.version     = YourGem::VERSION
  s.authors     = ["Your Name"]
  s.email       = ["you@example.com"]
  s.homepage    = "https://github.com/you/should-use-github"
  s.summary     = "Describe this gem like you're talking to me."
  s.description = "Describe this gem like you're talking to your mom."

  s.require_paths = ["lib"]
  s.files         = `git ls-files`.split&#40;"n"&#41;
  s.test_files    = `git ls-files -- spec/*`.split&#40;"n"&#41;

  s.add_dependency "hashie", "~&#62; 2.0"
  s.add_development_dependency "rspec", "~&#62; 2.12"
end
</code></pre>

<p>But what does all this mean?  Moreover, how do all these crazy bits fit together?</p> <a href="http://pivotallabs.com/the-naked-gemspec/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/the-naked-gemspec/">The Naked Gemspec</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Before we start, the <code>.gemspec</code> itself only appears once.  Here it is, as generated by <code>bundle init</code> and hand-tweaked for relevance:</p>
<pre><code>lib = File.expand_path&#40;"../lib", __FILE__&#41;
$LOAD_PATH.unshift&#40;lib&#41; unless $LOAD_PATH.include?&#40;lib&#41;
require "your_gem/version"

Gem::Specification.new do |s|
  s.name        = "your-gem"
  s.version     = YourGem::VERSION
  s.authors     = ["Your Name"]
  s.email       = ["you@example.com"]
  s.homepage    = "https://github.com/you/should-use-github"
  s.summary     = "Describe this gem like you're talking to me."
  s.description = "Describe this gem like you're talking to your mom."

  s.require_paths = ["lib"]
  s.files         = `git ls-files`.split&#40;"n"&#41;
  s.test_files    = `git ls-files -- spec/*`.split&#40;"n"&#41;

  s.add_dependency "hashie", "~&gt; 2.0"
  s.add_development_dependency "rspec", "~&gt; 2.12"
end
</code></pre>
<p>But what does all this mean?  Moreover, how do all these crazy bits fit together?</p>
<h2>Files</h2>
<p>The most important component of any gemspec is the list of files that it includes when building the gem.  After all, a <code>.gem</code> file is just a tarball with a metadata header written in Ruby.  Here&#8217;s how we make that happen:</p>
<pre><code>s.files         = ['file/one', 'file/two']
s.test_files    = ['spec/one', 'spec/two']
</code></pre>
<p>Let&#8217;s exploit part of <code>git</code> to give us the list of files.  Don&#8217;t use <code>git</code> on your project?  Start using <code>git</code>.  Problem solved!  Here&#8217;s what it gives us:</p>
<pre><code>$ git ls-files
.gitignore
.rvmrc
Gemfile
LICENSE
README.md
your-gem.gemspec
lib/your_gem.rb
lib/your_gem/version.rb
spec/lib/your_gem.rb
spec/spec_helper.rb
</code></pre>
<p>We can make this output into a Ruby array of strings quite simply:</p>
<pre><code>`git ls-files`.split&#40;"n"&#41;
</code></pre>
<p>Now, gems are laid out in a conventional way.  That means a <code>lib</code> directory, a <code>spec</code> directory and some predictable files.  That means nobody has to guess where your files are, which is fantastic!</p>
<p>Now let&#8217;s say you want to exclude your .rvmrc and .gitignore, because those files aren&#8217;t really all that important:</p>
<pre><code>`git ls-files`.split&#40;"n"&#41; - %w&#40;.rvmrc .gitignore&#41;
</code></pre>
<p>Note: exclude <code>Gemfile.lock</code> from git, even though it might exist in your directory.  This is conventional.</p>
<h2>Naming</h2>
<p>Your gem&#8217;s classes are called YourGem, while they live in files named <code>your_gem</code>.  As a matter of taste, I believe gems should be named <code>your-gem</code>.  There&#8217;s an argument to be made that gem names should match their requires &#40;i.e., the gem should be named <code>your_gem</code>&#41;.</p>
<h2>Version</h2>
<p>The first component here is the version number for your gem.  In this example, the <code>your_gem/version.rb</code> looks like this:</p>
<pre><code>module YourGem
  VERSION = "0.1.0"
end
</code></pre>
<p>This is a <a href="http://semver.org/">Semantic Versioning</a> string, and it&#8217;s the Simplest Thing that Could Possibly Work for a version.</p>
<h2>Dependencies</h2>
<p>This is the fun part.  I&#8217;m of the opinion that dependencies should be as loose as possible until they&#8217;re not, but that throwing them away by doing <code>&gt;= 0</code> is the wrong approach.</p>
<p>For example, the above file will pull in RSpec as a dependency, but require any version that matches a pattern like <code>2.y.z</code>, as long as <code>y</code> is above 12.  Note that <code>z</code> is allowed to be anything, which allows patch versions to be included.</p>
<p>Of course, this means that everyone in the community has to play along and not break their gem on a minor version bump.  Also, the community now includes you!</p>
<h2>Maintenance</h2>
<p>So now you&#8217;ve got a conventional gem with loosely-required dependencies.  How do you know if these change?  Well, if you&#8217;re on github, you can use <a href="https://gemnasium.com">Gemnasium</a> to watch for new dependency versions and see if anything&#8217;s broken!</p>
<p>Dropping a new version of your gem is as easy as <code>gem release</code> with <a href="https://twitter.com/svenfuchs">@svenfuchs</a>&#8216;s <a href="https://github.com/svenfuchs/gem-release">gem-release</a> gem.</p>
<h2>More Reading</h2>
<ul>
<li><a href="http://guides.rubygems.org/patterns">Rubygems Patterns</a></li>
<li><a href="http://semver.org">Semantic Versioning</a></li>
<li><a href="http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile">Clarifying the Roles of the gem spec and Gemfile</a></li>
<li><a href="http://robots.thoughtbot.com/post/2508037841/rubys-pessimistic-operator">The Pessimistic Gem Version Operator</a></li>
</ul>
<p>The post <a href="http://pivotallabs.com/the-naked-gemspec/">The Naked Gemspec</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/the-naked-gemspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Standup][SF] 09/12/12: The Milkshake Fiasco</title>
		<link>http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/</link>
		<comments>http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/#comments</comments>
		<pubDate>Wed, 12 Sep 2012 14:51:00 +0000</pubDate>
		<dc:creator>Doc Ritezel</dc:creator>
				<category><![CDATA[Standup]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[fiasco]]></category>
		<category><![CDATA[milkshake]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/</guid>
		<description><![CDATA[<p><h2>Events</h2>

<ul>
<li><p>Chocolate Milkshake Day was announced but not substantiated.</p>

<p>The SF office is now in breathless anticipation of chocolate milkshakes.</p></li>
</ul> <a href="http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/">[Standup][SF] 09/12/12: The Milkshake Fiasco</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h2>Events</h2>
<ul>
<li>
<p>Chocolate Milkshake Day was announced but not substantiated.</p>
<p>The SF office is now in breathless anticipation of chocolate milkshakes.</p>
</li>
</ul>
<p>The post <a href="http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/">[Standup][SF] 09/12/12: The Milkshake Fiasco</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/standup-sf-09-12-12-the-milkshake-fiasco/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using apc
Database Caching 1/20 queries in 0.021 seconds using apc
Object Caching 485/536 objects using apc

 Served from: pivotallabs.com @ 2013-05-25 00:59:15 by W3 Total Cache -->