Giter Club home page Giter Club logo

gem-wedge's Introduction

Gem Wedge Plugin

DESCRIPTION

The Gem Wedge Plugin converts the Wedge library ‘wedge/gem.rb’ into a RubyGems plugin, so that it is automatically loaded whenever RubyGems is loaded.

WHY

One of the rarely mention edge cases with the way in which RubyGems loads library files, and in fact the way Ruby’s load system works in general, is that the “lib space” is a free for all. Any library can drop any file into their package’s lib/ directory and potentially clobber a file of the same name in some one else’s library. Now, a good gem citizen knows to put their scripts in a directory with the same name as their gem package, nonetheless you might be surprised to see how often this simple but important practice is violated. Consequently the order in which such gems are searched becomes of paramount importance –something that worked just fine on one machine can suddenly stop working on another for no obvious reason.

It is also worth noting that the recent crop of gem isolation systems, such as Bundler and Isolate, while serving to reduce the likelihood of possible name clashes still do not fully remedy the issue. They merely reduce the number to gems that could cause the problem for any given dependent application.

1

See the INFRACTIONS.rdoc file for examples.

HOW

The Gem Wedge solves the issue entirely by allowing you to load files directly for a single gem and only that gem. It does so by adding a new valid syntax to Ruby’s #load and #require methods. As an example, let’s say we wanted to load the troff.rb script from the unroller library.

require 'unroller:troff'

The colon is used to separate the gem name from the rest of the pathname. With this we can be 100% certain that the troff.rb file was required from the unroller gem and not a ‘troff.rb’ file from any other gem that might have created a script by the same name.

INSTALL

Using the usual ‘gem` command:

$ gem install gem-wedge

Keep in mind that this installs a RubyGems plugin. Once installed gem-wedge will be loaded automatically whenever RubyGems itself is loaded.

Copyright © 2010 Thomas Sawyer

Apache 2.0 License

(See LICENSE file for details.)

gem-wedge's People

Contributors

trans avatar

Watchers

James Cloos avatar

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.