Coder Social home page Coder Social logo

src-run-opt / ruby-gem-home-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from postmodern/gem_home

0.0 2.0 0.0 50 KB

A simple bash approach to managing your shell environment with regards to ruby gems, specifically the $GEM_HOME variable.

Home Page: https://src.run/ruby-gem-home-manager

License: MIT License

Makefile 19.79% Ruby 3.69% Shell 56.99% Roff 19.53%
ruby ruby-gem ruby-versions bash bash-script shell-script

ruby-gem-home-manager's Introduction

gem_home

Build Status

Changes your $GEM_HOME.

Features

  • Updates $GEM_HOME, $GEM_PATH and $PATH.
    • Switches $GEM_HOME by pushing and popping gem directories to $GEM_PATH. This allows the stacking of multiple gem directories.
    • Prepends the new $GEM_HOME/bin to $PATH so it takes precedence.
  • Compartmentalizes gems into .gem/$ruby_engine/$ruby_version.
  • Plays nicely with RVM and chruby.
  • Supports bash and zsh.
  • Small (~90 LOC).
  • Has tests.

Synopsis

Change the $GEM_HOME:

$ gem_home /path/to/project

Revert the $GEM_HOME:

$ gem_home -

Using with bundler:

$ cd padrino-app/
$ gem_home .
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.0
Using thread_safe 0.3.4
Installing tzinfo 1.2.2
Using activesupport 4.1.4
Using addressable 2.3.6
Installing builder 3.2.2
Using bundler 1.6.2
Using data_objects 0.10.14
Using dm-core 1.2.1
Using dm-aggregates 1.2.0
Using dm-do-adapter 1.2.0
Using dm-migrations 1.2.0
...    
$ padrino console # no `bundle exec` needed
  • Notice how bundler re-used many of the gems from ~/.gem/... but installed missing gems into $PWD/.gem/....

Install

wget -O gem_home-0.1.0.tar.gz https://github.com/postmodern/gem_home/archive/v0.1.0.tar.gz
tar -xzvf gem_home-0.1.0.tar.gz
cd gem_home-0.1.0/
sudo make install

PGP

All releases are PGP signed for security. Instructions on how to import my PGP key can be found on my blog. To verify that a release was not tampered with:

wget https://raw.github.com/postmodern/gem_home/master/pkg/gem_home-0.1.0.tar.gz.asc
gpg --verify gem_home-0.1.0.tar.gz.asc gem_home-0.1.0.tar.gz

Homebrew

gem_home can also be installed with homebrew:

brew install --HEAD https://raw.github.com/postmodern/gem_home/master/homebrew/gem_home.rb

Configuration

Add the following to the ~/.bashrc or ~/.zshrc file:

source /usr/local/share/gem_home/gem_home.sh

System Wide

If you wish to enable gem_home system-wide, add the following to /etc/profile.d/gem_home.sh:

if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
  source /usr/local/share/gem_home/gem_home.sh
  ...
fi

This will prevent gem_home from accidentally being loaded by /bin/sh, which is not always the same as /bin/bash.

Uninstall

After removing the gem_home configuration:

$ sudo make uninstall

Alternatives

ruby-gem-home-manager's People

Contributors

docwhat avatar ilikepi avatar krisleech avatar phongnh avatar postmodern avatar robfrawley avatar

Watchers

 avatar  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.