Reputation: 14631
Suppose there is Foo service and it has RESTful API. If I want to create wrapper lib for it:
bundle gem foo-api-client
Then it creates following structure:
foo-api-client/Gemfile
foo-api-client/Rakefile
foo-api-client/LICENSE.txt
foo-api-client/README.md
foo-api-client/.gitignore
foo-api-client/foo-api-client.gemspec
foo-api-client/lib/foo/api/client.rb
foo-api-client/lib/foo/api/client/version.rb
I don't need separately api module, and I wonder should I leave it or maybe try to change to: fooapi-client/lib/fooapi/client.rb
Is there some naming convention for this?
Upvotes: 3
Views: 391
Reputation: 27207
bundle gem
is trying to build a structure that matches naming conventions as advised on the Rubygems website
Table of example names taken from the link:
Gem name Require statement Main class or module
fancy_require require 'fancy_require' FancyRequire
ruby_parser require 'ruby_parser' RubyParser
net-http-persistent require 'net/http/persistent' Net::HTTP::Persistent
rdoc-data require 'rdoc/data' RDoc::Data
autotest-growl require 'autotest/growl' Autotest::Growl
net-http-digest_auth require 'net/http/digest_auth' Net::HTTP::DigestAuth
That this is deliberate behaviour of bundler is backed up by comments on issue 1255
As for naming your client, I'd probably suggest bundle gem foo_api_client
unless your client is an extension for an existing foo
gem. Although a suitable pun on the gem's purpose or history is often acceptable in the Ruby community.
Upvotes: 6