tag:help.rubygems.org,2010-01-19:/discussions/questions/76-how-to-name-a-gem-which-is-a-ruby-wrapper-for-an-existing-c-libraryRubyGems.org: Discussion 2011-08-09T13:18:25Ztag:help.rubygems.org,2010-01-19:Comment/91668322011-08-08T19:44:59Z2011-08-08T19:45:00ZHow to name a gem which is a Ruby wrapper for an existing C library?<div><p>I want to write a Ruby wrapper for an existing C library.
Existing examples are the gems <code>bcrypt-ruby</code> which gives
Ruby interface for the bcrypt C library (password hashing), and
<code>yajl-ruby</code> which gives Ruby interface for the YAJL C
libary (JSON parser).</p>
<p>These two examples "break" the gem naming convention suggested
in the Rubygems guides:</p>
<ol>
<li>The gem name contains dash instead of underscore</li>
<li>The gem name doesn't match the <code>require</code> line (that
is, in order to use the library you need to <code>require
"yajl"</code> or <code>require "bcrypt"</code>.</li>
</ol>
<p>I don't have anything against those two gems, but I want to know
what would be the best way to name another gem with a similar
purpose (Ruby wrapper for an existing C library).</p>
<p>Note that naming the gem <code>yajl</code> (for example) might
create a problem because there is already a github project called
<code>yajl</code> (it's the C library code). Maybe the github
repository name can be <code>yajl-ruby</code> but the name in the
gemspec can be <code>yajl</code>. Is that cool?</p>
<p>Maybe keep the <code>-ruby</code> suffix even if it breaks the
naming convention? (maybe update the naming convention?)</p>
<p>Thanks a lot for your help,<br>
dubek</p></div>dubektag:help.rubygems.org,2010-01-19:Comment/91668322011-08-08T19:58:07Z2011-08-08T19:58:07ZHow to name a gem which is a Ruby wrapper for an existing C library?<div><p>Hello,</p>
<p>Naming the gem, while not following <em>recommended</em>
RubyGems practices, are not related to what the gem does.</p>
<p>For example, Psych is a gem that wraps libyaml library for YAML
emitter.</p>
<p>Rugged is the wrapper around libgit2.</p>
<p>And there are other examples.</p>
<p>One simple example, sqlite3-ruby, it was known as SQLite3/Ruby
bindings, which recently got renamed to simple "sqlite3"</p>
<p>MySQL/Ruby library which is distributed as "mysql" gem.</p>
<p>You're free to name the gem as you like, as long is not
inflammatory or disrespectful of other members or libraries in the
community like "railssucks" or things like that.</p>
<p>The guides do not cover it in too much detail:</p>
<p><a href=
"http://guides.rubygems.org/patterns/#consistent-naming">http://guides.rubygems.org/patterns/#consistent-naming</a></p>
<p>But Eric Hodel, one of the maintainers of RubyGems outlined his
preferences about the conventions:</p>
<p><a href=
"http://blog.segment7.net/2009/05/20/a-project-naming-recommendation">
http://blog.segment7.net/2009/05/20/a-project-naming-recommendation</a></p>
<p>Hope that helps.</p></div>Luis Lavenatag:help.rubygems.org,2010-01-19:Comment/91668322011-08-09T06:24:19Z2011-08-09T06:24:21ZHow to name a gem which is a Ruby wrapper for an existing C library?<div><p>Thanks. I think in my case it would be better to name the gem
simply after the name of the C library, like <code>mysql</code> or
<code>sqlite3</code>. Clearly gems are for Ruby, so it doesn't make
a lot of sense to add <code>-ruby</code> or <code>_ruby</code> to
the gem name...</p>
<p>The only thing I don't like is having a github project named
after the original library name, because it can be mistaken for as
the official repository for the C library (consider the
<code>yajl</code> repository which has the C library code). I think
I'll follow your move with <code>sqlite3</code>: the github
repository name will have the <code>-ruby</code> suffix, but the
gem name (in gemspec) will be simply the library name.</p>
<p>Makes sense?</p></div>dubektag:help.rubygems.org,2010-01-19:Comment/91668322011-08-09T13:18:20Z2011-08-09T13:18:20ZHow to name a gem which is a Ruby wrapper for an existing C library?<div><p>Makes totally sense.</p>
<p>Glad this helped you. Closing out.</p>
<p>Feel free to reopen if you have further questions.</p></div>Luis Lavena