Code Monkey home page Code Monkey logo

Comments (2)

Fryguy avatar Fryguy commented on July 26, 2024

Yeah, the common pattern for gems is to have (omitting extra folders for brevity) the following. Note that the file name path generally matches the class being implemented...e.g. lib/hawkular/metrics/nested_class_under_metrics.rb implements Hawkular::Metrics::NestedClassUnderMetrics.

hawular-client-ruby
├─ lib
|  ├─ hawkular
|  |  ├─ metrics
|  |  |   └─ nested_class_under_metrics.rb # implements Hawkular::Metrics::NestedClassUnderMetrics
|  |  └─ metrics.rb                        # implements Hawkular::Metrics
|  └─ hawkular.rb                          # implements things directly in Hawkular module
...

When a gem is detected, the lib directory is put on the $LOAD_PATH. So, it's expected that the user will just do require 'hawkular' and everything will just work. Actually, since the gem is named hawkular-client-ruby the user might expect require 'hawkular/client/ruby' or require 'hawkular-client-ruby' to work. In particular, bundler defaults to the former. As such, you may want to add dummy files that when required will just subsequently require 'hawkular'.

See also http://guides.rubygems.org/make-your-own-gem/#requiring-more-files for some of the layout details and http://guides.rubygems.org/name-your-gem/ for the naming conventions with respect to the gem name and how people might require the gem.

from hawkular-client-ruby.

simon3z avatar simon3z commented on July 26, 2024

@pilhuhn remember that this probably has repercussion on how we're using this gem for collecting metrics for OpenShift in ManageIQ. Let me know when you update the gem there so we can check if everything is in order.

from hawkular-client-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.