How to name a gem which is a Ruby wrapper for an existing C library?
I want to write a Ruby wrapper for an existing C library.
Existing examples are the gems bcrypt-ruby which gives
Ruby interface for the bcrypt C library (password hashing), and
yajl-ruby which gives Ruby interface for the YAJL C
libary (JSON parser).
These two examples "break" the gem naming convention suggested in the Rubygems guides:
- The gem name contains dash instead of underscore
- The gem name doesn't match the
requireline (that is, in order to use the library you need torequire "yajl"orrequire "bcrypt".
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).
Note that naming the gem yajl (for example) might
create a problem because there is already a github project called
yajl (it's the C library code). Maybe the github
repository name can be yajl-ruby but the name in the
gemspec can be yajl. Is that cool?
Maybe keep the -ruby suffix even if it breaks the
naming convention? (maybe update the naming convention?)
Thanks a lot for your help,
dubek
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Luis Lavena on 08 Aug, 2011 07:58 PM
Hello,
Naming the gem, while not following recommended RubyGems practices, are not related to what the gem does.
For example, Psych is a gem that wraps libyaml library for YAML emitter.
Rugged is the wrapper around libgit2.
And there are other examples.
One simple example, sqlite3-ruby, it was known as SQLite3/Ruby bindings, which recently got renamed to simple "sqlite3"
MySQL/Ruby library which is distributed as "mysql" gem.
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.
The guides do not cover it in too much detail:
http://guides.rubygems.org/patterns/#consistent-naming
But Eric Hodel, one of the maintainers of RubyGems outlined his preferences about the conventions:
http://blog.segment7.net/2009/05/20/a-project-naming-recommendation
Hope that helps.
3 Posted by dubek on 09 Aug, 2011 06:24 AM
Thanks. I think in my case it would be better to name the gem simply after the name of the C library, like
mysqlorsqlite3. Clearly gems are for Ruby, so it doesn't make a lot of sense to add-rubyor_rubyto the gem name...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
yajlrepository which has the C library code). I think I'll follow your move withsqlite3: the github repository name will have the-rubysuffix, but the gem name (in gemspec) will be simply the library name.Makes sense?
Support Staff 4 Posted by Luis Lavena on 09 Aug, 2011 01:18 PM
Makes totally sense.
Glad this helped you. Closing out.
Feel free to reopen if you have further questions.
Luis Lavena closed this discussion on 09 Aug, 2011 01:18 PM.