Giter Club home page Giter Club logo

rbenv-binstubs's Introduction

rbenv-binstubs: A Bundler binstubs Plugin for rbenv

This plugin makes rbenv transparently aware of project-specific binstubs created by bundler.

This means you don't have to type bundle exec ${command} ever again!

Installation

To install rbenv-binstubs, clone this repository into your ~/.rbenv/plugins directory. (You'll need a recent version of rbenv that supports plugin bundles.)

$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone https://github.com/ianheggie/rbenv-binstubs.git 

Then for each application directory run the following just once:

$ bundle install --binstubs .bundle/bin
$ rbenv rehash

The .bundle/bin argument keeps the binstubs separate from the default bin/ since bin/ is now used for application scripts and should be included in your code repository (from rails 4.0.0 onwards). If you wish to mix application scripts and binstubs, then consider generating only those binstubs you need.

I recommend you also install the gem-rehash plugin as well so you don't have to remember to use rbenv rehash after each bundle install. Note gem-rehash only calls rbenv rehash if a new gem executable is installed, so you will need to run rbenv rehash for each project directory after installing this plugin or for the specific project if you change the binstub directory.

Usage

Simply type the name of the command you want to run! Thats all folks! Eg:

$ rake --version

This plugin searches from the current directory up towards root for a directory containing a Gemfile. If such a directory is found, then the plugin checks for the desired command under the 'bin' sub-directoy. If you used bundle --binstubs=some/pib/path then that directory will be checked instead of 'bin'.

To confirm that the bundler binstub is being used, run the command:

$ rbenv which COMMAND

To show which gem bundle will use, run the command:

$ bundle show GEM

You can disable the searching for binstubs by setting the environment variable DISABLE_BINSTUBS to a non empty string:

$ DISABLE_BINSTUBS=1 rbenv which command

You can list the bundles (project directories) and their associated binstub directories that have been registered since the plugin was installed using the command:

$ rbenv bundles

This will add a comment if bundle is not set to automatically create binstubs, or the binstubs directory is missing, or if a Gemfile no longer exists. If the Gemfile for a bundle is removed, then that bundle will be dropped from the list of bundles to check when rbenv rehash is next run.

License

Copyright (c) 2013 Ian Heggie - Released under the same terms as rbenv's MIT-License

Links

Similar Projects

rbenv-bundler is another rbenv plugin for bundler - it makes shims aware of bundle installation paths. It uses a more involved approach which has performance and other consequences.

Note on Patches/Pull Requests

This project is now in maintenance mode and contributions will only be considered where there are passing tests.

  • Fork the project.
  • Make your feature addition or bug fix, with tests
  • Commit
  • Send me a pull request. Bonus points for topic branches.

Contributors

Thanks go to:

  • madumlao - contributed code so this plugin now creates shims for all the executable files in the binstubs directory, thus bundle --path=vendor/bundle ... is now handled, as are arbitary executables in the binstubs directory.
  • Various people who have given feedback and suggestions via the issues list

rbenv-binstubs's People

Contributors

ianheggie avatar beneinwechter avatar madumlao avatar

Watchers

Ian Ker-Seymer 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.