├── .gitignore ├── .stow-local-ignore ├── ARCHITECTURE.md ├── MOTIVATION.md ├── README.md ├── bin └── vruby ├── example ├── 0_start_here.sh ├── 1_rack_app.rb ├── 2_nokogiri.rb ├── 3_bundler.sh ├── 4_rails.sh ├── 5_ruby_version │ ├── .ruby-version │ └── test.sh ├── Gemfile ├── Gemfile.lock └── test.html └── share └── vruby ├── downloads.yml └── embed ├── activate.fish └── activate.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | /vruby/ 4 | .gem 5 | /tmp 6 | example/vruby_test 7 | -------------------------------------------------------------------------------- /.stow-local-ignore: -------------------------------------------------------------------------------- 1 | \.git 2 | \.gitignore 3 | 4 | /ARCHITECTURE.md 5 | /README.md 6 | 7 | /example 8 | 9 | -------------------------------------------------------------------------------- /ARCHITECTURE.md: -------------------------------------------------------------------------------- 1 | # Architecture 2 | 3 | ## Prototype 4 | 5 | Like most developers, I've never built a version manager before. I have an idea of what it would take, but clear enough for an easy path forward. Therefore I'm building this in the fastest, least-resistant way possible, with a shell script. Any of the user-facing code will be rewritten once we've had a number of people try this project and confirm that it's working. 6 | 7 | ### Why? 8 | 9 | Well, like I said, I want to better understand what it will take to build a version manager like this before committing myself to a language. I'm pretty sure the actual CLI tool for this will remain fairly lightweight, so there shouldn't be much risk in rewriting it in a compiled language later. Also, my time is valuable to me (as yours should be to you). I don't want to invest time in setting up an awesomely shiny cross-platform build toolchain until I know people are going to adopt this. Furthermore, there are some new tools out there that can make testing a project like this insanely easy. As we go, I want to automate tests that can run in Docker containers against different platforms. 10 | 11 | ## The Future 12 | 13 | So that said, I see this project eventually migrating to a compiled, cross-platform system language like Go or Rust. I like Go for its simplicity in constraints; I like Rust for its focus on functional concepts. I have no idea which one is better for this project, but I'm open to suggestions. 14 | 15 | I hope to continue to flesh out this document further, but for now this will have to do. 16 | -------------------------------------------------------------------------------- /MOTIVATION.md: -------------------------------------------------------------------------------- 1 | I originally posted this as a comment in [#3](https://github.com/joefiorini/vruby/issues/3), but I felt like it's important enough to put it into it's own document. 2 | 3 | ### The Use Case 4 | 5 | I've been developing vruby with a primary use case in mind: developers who don't use Ruby as their primary language, but switch a lot. There are a lot of developers (myself included) these days who just write javascript but have to jump into Ruby projects occasionally. I feel these developers would be best served with a tool that requires: 6 | 7 | ##### (1) Does absolute minimal work required to host ruby versions 8 | 9 | One of the biggest problems I've had with the existing version management options is troubleshooting installations, starting with determining if it's a problem of the version manager, the ruby installation or a gem. This would be much easier if the version managers did a little less. No gemsets, no magic commands for version switching, no overriding `cd` to auto switch. Using this workflow, if I run into a problem while working on a project I know it's either a problem in Ruby or a gem. I can kill all my gems with `rm -rf .gem` and start over. I can reset my environment by opening a new Terminal window. 10 | 11 | ##### (2) Very simple installation via platform package manager 12 | 13 | That way installation/uninstallation is simple, predictable and easy. No messing around with piping potentially unsafe scripts from the web or wondering how to uninstall a library after it's installed. 14 | 15 | ##### (3) Cross platform support 16 | 17 | Runs on Windows and *nix with a minimum of compromises/disorganized code for platform support 18 | 19 | ##### (4) Does not require any setup steps to begin using 20 | 21 | If Ruby isn't my primary language, I don't want to be adding stuff to my dotfiles just because some project I work on requires Ruby. 22 | 23 | ##### (5) Isolates gem dependencies within the given project 24 | 25 | To make it easy to start from scratch/troubleshoot when I run into problems 26 | 27 | ##### (6) Offers the ability to isolate the Ruby interpreter in the given project 28 | 29 | Same as previous, plus the added makes it much more likely that the project will continue to run after years of sitting on a backup drive without having to setup an environment for it again 30 | 31 | ##### (7) Uses binary ruby distributions 32 | 33 | This may be a bit ambitious at this point, but projects like Tokaido have made it possible to have a purely binary Ruby distribution, which takes installation of new versions down from 10-20 minutes (quite often more than that on slower machines) to literally seconds. A binary distribution also lowers the risk of platform issues, since someone has already worked out dependency issues in order to build the binaries. 34 | 35 | ### Thoughts on Implementation 36 | 37 | My thinking has been that a compiled language would make it easier to achieve both (1) and (2) above. I know there is no silver bullet with regards to cross-platform support, but a compiled language would at least help make sure the binary is runnable on other platforms regardless of language support. 38 | 39 | I'm certainly open to other thoughts on this. I'm open to any solutions as long as we meet the use cases outlined above. Whatever decision we make, I do _not_ want to stick with bash long term. I'm not very happy with how the existing shell script is going, and would like to clean it all up. 40 | 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vruby 2 | 3 | It's like virtualenv, but for ruby. 4 | 5 | ## Really!? Another ruby version manager? But why? 6 | 7 | Because even after using rvm, rbenv and chruby, I'm still not happy with how they work. Don't get me wrong, if _all you do is Ruby_ any one of these solutions is great. However, if you're like me and switch between many languages, having to maintain a version manager for a language you don't use much isn't worth it. vruby is built with simplicity in mind; this simplicity is heavily inspired by python's virtualenv. Use vruby if: 8 | 9 | - You don't want to customize your config files for a language you don't use often 10 | - You don't like patching `cd` but also don't want to worry about generating wrapper scripts when you update gems 11 | - You've found yourself pining for something like `virtualenv` but for ruby 12 | - Are sick of waiting for rubies to compile when someone has already done it on every platform anyway 13 | 14 | For more detail read [MOTIVATION.md](https://github.com/joefiorini/vruby/blob/master/MOTIVATION.md) 15 | 16 | ## Call for Community 17 | 18 | This project is currently alpha. I've been using vruby for managing Ruby on a couple Macs for more than 6 months and it is working great for me. Alas, I cannot call it anything but alpha until it's proven successful in the wild. If you decide to try vruby, please submit feedback by opening issue and telling me about your experience. Regardless of how it went, feedback is the only way to be confident in recommending it to the community. 19 | 20 | Likewise, if you are interested in collaborating on this, please get in touch with me and we can chat. 21 | 22 | ## Installation 23 | 24 | ### Homebrew 25 | 26 | vruby does not yet have an acceptable homebrew formula. To install the latest HEAD via Homebrew use [this gist](https://gist.githubusercontent.com/joefiorini/333f9b0d6b66dd93d622/raw/vruby.rb): 27 | 28 | ``` 29 | brew install --HEAD https://gist.githubusercontent.com/joefiorini/333f9b0d6b66dd93d622/raw/vruby.rb 30 | ``` 31 | 32 | ## Install Ruby 33 | 34 | ### Using binary Ruby distributions 35 | 36 | vruby has built-in support for installing binary Ruby distributions. These have the significant advantage that installation is simply decompressing the archive to a directory. However, these distributions require manual effort to maintain and are not always up-to-date. Check to see if the version you need is available for your platform. 37 | 38 | Install the latest binary distribution by running: 39 | 40 | ``` 41 | vruby install 42 | ``` 43 | 44 | This command will look to a `.ruby-version` file if one exists in the current working directory, or default to `$default_ruby_version`. You can override this behavior by specifying a version with: 45 | 46 | ``` 47 | vruby install $VERSION 48 | ``` 49 | 50 | By default this will install Ruby versions to `/opt/vruby/share/$VERSION`. 51 | 52 | ### Compiling a ruby with ruby-build 53 | 54 | If you don't mind compiling your Ruby, you can use `ruby-build` (installed on OS X via Homebrew) to download and compile any Ruby version into the location necessary for vruby: 55 | 56 | ``` 57 | mkdir -p /opt/vruby/share 58 | ruby-build 2.3.0 --prefix /opt/vruby/share/2.3.0 59 | ``` 60 | 61 | ## Usage 62 | 63 | Once you have a ruby installed, embed in your project under a folder called `vruby` like so: 64 | 65 | 66 | ``` 67 | vruby vruby 68 | ``` 69 | 70 | This will create a vruby folder in your project and create symlinks to the installed ruby version. 71 | 72 | To activate this ruby just run: 73 | 74 | ``` 75 | source vruby/bin/activate 76 | ``` 77 | 78 | To deactivate, close your terminal session and open a new one. 79 | 80 | ## TODO 81 | 82 | - [x] Create map of platforms to binary Ruby download URLs 83 | - [x] Make it work on OS X 84 | - [x] Make sure it works with a rails app 85 | - [x] Make it possible to install globally in `/usr/local` 86 | - [ ] Packages for major platforms (using FPM to create binary distributions) 87 | - [ ] Automated testing in docker containers 88 | -------------------------------------------------------------------------------- /bin/vruby: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | vruby_version="0.1" 5 | default_ruby_version="2.2.1" 6 | 7 | prog_name=$(basename $0) 8 | 9 | # Taken from https://gist.github.com/pkuczynski/8665367 10 | # Parses yaml file into variables, for example: 11 | # 12 | # foo: 13 | # bar: baz 14 | # qux: quux 15 | # 16 | # would become a shell variables: 17 | # $foo_bar = baz 18 | # $foo_qux = quux 19 | parse_yaml() { 20 | local prefix=$2 21 | local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') 22 | sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ 23 | -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | 24 | awk -F$fs '{ 25 | indent = length($1)/2; 26 | vname[indent] = $2; 27 | for (i in vname) {if (i > indent) {delete vname[i]}} 28 | if (length($3) > 0) { 29 | vn=""; for (i=0; i [options]\n" 37 | echo "Subcommands:" 38 | echo " install Do bar" 39 | echo "" 40 | echo "For help with each subcommand run:" 41 | echo "$prog_name -h|--help" 42 | echo "" 43 | } 44 | 45 | _install_bundler() { 46 | base=$1 47 | 48 | source "${base}/bin/activate" 49 | gem install --no-user-install bundler 50 | } 51 | 52 | _load_default_ruby_version() { 53 | current_dir=$(pwd) 54 | test -f $current_dir/.ruby-version 55 | use_ruby_version_file=$? 56 | 57 | if [ $use_ruby_version_file -eq 0 ]; then 58 | # This will be overridden if --version arg is passed 59 | version=$(cat $current_dir/.ruby-version) 60 | else 61 | version=$default_ruby_version 62 | fi 63 | 64 | echo $version 65 | } 66 | 67 | sub_install(){ 68 | 69 | to=/opt/vruby/share 70 | 71 | version=$(_load_default_ruby_version) 72 | 73 | platform=$(uname) 74 | 75 | while [ $# -ne 0 ] 76 | do 77 | arg=$1 78 | shift 79 | case $arg in 80 | --to) 81 | to="$1" 82 | shift 83 | ;; 84 | --version) 85 | version="$1" 86 | shift 87 | ;; 88 | *) 89 | echo -e "WARNING: Unknown option \"$arg\"\n" 1>&2 90 | exit 1 91 | ;; 92 | esac 93 | done 94 | 95 | 96 | share_dir="$(dirname "${BASH_SOURCE[0]}")/../share" 97 | eval $(parse_yaml $share_dir/vruby/downloads.yml "downloads_") 98 | 99 | version_key=$(echo $version | sed 's/\./_/g') 100 | 101 | case $platform in 102 | (Linux|GNU*) 103 | url_key="downloads_${version_key}_linux" 104 | ;; 105 | (Darwin) 106 | url_key="downloads_${version_key}_osx" 107 | ;; 108 | (*) 109 | cat <<< "$platform is an unsupported platform. Please open an issue at https://github.com/joefiorini/vruby with the subject line \"Support for $platform\"." 1>&2 110 | return 1 111 | ;; 112 | esac 113 | 114 | ruby_url=${!url_key} 115 | 116 | case $ruby_url in 117 | ("") 118 | cat <<< "$version is not a supported Ruby version. Please open an issue at https://github.com/joefiorini/vruby with the subject line \"Support for Ruby $version\"." 1>&2 119 | return 1 120 | ;; 121 | esac 122 | 123 | tmp_file=/tmp/$(basename $ruby_url) 124 | tmp_output=/tmp/$(basename $tmp_file .tar.bz2) 125 | 126 | # Save previous directory so we can change back, in the event 127 | # that $to is passed as a relative path 128 | previous_dir=$(pwd) 129 | 130 | cd $(dirname $tmp_file) 131 | 132 | # first if we have a file, make sure it is complete 133 | if [ -f $tmp_file ]; then 134 | set +e 135 | tar -tf $tmp_file 2>1 > /dev/null 136 | err=$? 137 | set -e 138 | else 139 | err=0 140 | fi 141 | 142 | # if the file is missing or incomplete, start or resume download 143 | if [ ! -f $tmp_file -o $err -ne 0 ]; then 144 | cat <<< "Downloading from $ruby_url" 145 | curl -C - -O $ruby_url 146 | fi 147 | 148 | tar -xvf $tmp_file > /dev/null 149 | 150 | # sed -i.bak -e "s/^echo GEM_HOME=.*$//" $tmp_output/bin/ruby_environment 151 | # rm $tmp_output/bin/ruby_environment.bak 152 | 153 | cd "$previous_dir" 154 | 155 | cat <<< "Installing to $to" 156 | mkdir -p $to 157 | echo "Copying $tmp_output/ to $to/$version" 158 | cp -r $tmp_output/ $to/$version 159 | } 160 | 161 | sub_embed() { 162 | from=/opt/vruby/share 163 | target_base=$1 164 | host_dir=$(pwd) 165 | 166 | version=$(_load_default_ruby_version) 167 | 168 | share_dir="$(dirname "${BASH_SOURCE[0]}")/../share/vruby" 169 | 170 | 171 | while [[ $# > 1 ]] 172 | do 173 | arg="$1" 174 | 175 | case $arg in 176 | --from) 177 | from="$2" 178 | shift 179 | shift 180 | ;; 181 | --version) 182 | version="$2" 183 | shift 184 | ;; 185 | *) 186 | target_base=$1 187 | shift 188 | ;; 189 | esac 190 | done 191 | 192 | # if we do not have an absolute path, make it absolute 193 | # ln needs an absolute path 194 | if [[ $from != /* ]]; then 195 | from=$PWD/$from 196 | fi 197 | 198 | target_dir=$target_base/$version 199 | 200 | mkdir -p $target_base/bin 201 | 202 | for activate_script in $share_dir/embed/*; do 203 | 204 | activate_script_name=$(basename $activate_script) 205 | 206 | if [ $activate_script_name == "activate.sh" ]; then 207 | activate_file="$target_base/bin/activate" 208 | else 209 | activate_file="$target_base/bin/$activate_script_name" 210 | fi 211 | 212 | contents="$(cat $activate_script)" 213 | # Would really like to use `sed` here, but it's interface is VERY 214 | # inconsistent between Linux/Mac; using bash string replacement 215 | # instead 216 | # 217 | contents=${contents//__VERSION__/$version} 218 | contents=${contents//__HOST_DIR__/$host_dir} 219 | contents=${contents//__TARGET_DIR__/$target_dir} 220 | contents=${contents//__FROM__/$from} 221 | 222 | echo "$contents" > "$activate_file" 223 | done 224 | 225 | ln -s $from/$version $target_dir 226 | 227 | _install_bundler $target_base 228 | } 229 | 230 | subcommand=$1 231 | case $subcommand in 232 | "" | "-h" | "--help") 233 | sub_help 234 | ;; 235 | "-v" | "--version") 236 | echo "vruby v${vruby_version}" 237 | ;; 238 | install) 239 | shift 240 | sub_install $@ 241 | ;; 242 | *) 243 | sub_embed $@ 244 | ;; 245 | esac 246 | -------------------------------------------------------------------------------- /example/0_start_here.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # To get started execute this file with: 4 | # 5 | # ./0_start_here.sh 6 | # 7 | # 8 | 9 | install_to=../share 10 | 11 | # Make sure we're running from examples directory 12 | current_dir=$(basename $(pwd)) 13 | 14 | if [[ "$current_dir" != "example" ]]; then 15 | # Assumes we're at least in the vruby directory 16 | cd example 17 | fi 18 | 19 | rm -rf ./vruby 20 | 21 | ../bin/vruby install --to $install_to 22 | 23 | echo "Latest ruby installed to $install_to" 24 | echo "Next run:" 25 | echo 26 | echo " ../bin/vruby vruby --from $install_to" 27 | echo " source vruby/bin/activate" 28 | -------------------------------------------------------------------------------- /example/1_rack_app.rb: -------------------------------------------------------------------------------- 1 | begin 2 | require 'rack' 3 | rescue LoadError 4 | system "gem install --no-user-install rack" 5 | Gem.clear_paths 6 | retry 7 | end 8 | 9 | app = Proc.new do |env| 10 | ['200', {'Content-Type' => 'text/html'}, ['A barebones rack app.']] 11 | end 12 | 13 | Rack::Handler::WEBrick.run app 14 | -------------------------------------------------------------------------------- /example/2_nokogiri.rb: -------------------------------------------------------------------------------- 1 | begin 2 | require 'nokogiri' 3 | rescue LoadError 4 | system "gem install --no-user-install nokogiri" 5 | Gem.clear_paths 6 | retry 7 | end 8 | 9 | f = File.open('test.html') 10 | doc = Nokogiri::HTML(f) 11 | 12 | puts doc.title 13 | puts doc.css("#intro") 14 | 15 | -------------------------------------------------------------------------------- /example/3_bundler.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | command_exists() { 4 | command -v $1 &> /dev/null 5 | return $? 6 | } 7 | 8 | test_require() { 9 | ruby -r$1 -e "" 10 | result=$? 11 | 12 | if [[ result -ne 0 ]]; then 13 | echo "Could not load $1 Please open an issue at https://github.com/joefiorini/vruby and paste in all the output from this test." 14 | return $result 15 | fi 16 | } 17 | 18 | command_exists mogrify || echo "You need imagemagick installed for this test. Please install it using your platform's package manager." 19 | 20 | bundle install 21 | 22 | echo "Testing rmagick..." 23 | test_require rmagick 24 | 25 | echo "Testing faker..." 26 | test_require faker 27 | 28 | echo "All tests passed." 29 | -------------------------------------------------------------------------------- /example/4_rails.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | source vruby/bin/activate 6 | 7 | command_exists() { 8 | command -v $1 &> /dev/null 9 | return $? 10 | } 11 | 12 | test_require() { 13 | ruby -r$1 -e "" 14 | result=$? 15 | 16 | return $result 17 | } 18 | 19 | test_require rails || gem install --no-user-install --no-document rails 20 | 21 | rails new vruby_test 22 | 23 | cd vruby_test 24 | 25 | test_require "vruby_test/config/application" 26 | 27 | if [[ $? -eq 0 ]]; then 28 | echo "Successfully loaded Rails app!" 29 | fi 30 | 31 | -------------------------------------------------------------------------------- /example/5_ruby_version/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.1.5 2 | -------------------------------------------------------------------------------- /example/5_ruby_version/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ../../bin/vruby install 4 | ../../bin/vruby vruby 5 | 6 | source vruby/bin/activate 7 | 8 | echo $(ruby --version) 9 | -------------------------------------------------------------------------------- /example/Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem "faker" 4 | gem "rmagick" 5 | -------------------------------------------------------------------------------- /example/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | faker (1.4.3) 5 | i18n (~> 0.5) 6 | i18n (0.7.0) 7 | rmagick (2.13.4) 8 | 9 | PLATFORMS 10 | ruby 11 | 12 | DEPENDENCIES 13 | faker 14 | rmagick 15 | -------------------------------------------------------------------------------- /example/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ruby Programming Language 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 93 | 94 |
95 | 96 |
97 |
98 |
99 |
100 |

Ruby is...

101 | 102 |

103 | A dynamic, open source programming language with a focus on 104 | simplicity and productivity. It has an elegant syntax that is 105 | natural to read and easy to write. 106 |

107 | 108 | Download Ruby 109 | or 110 | Read More... 111 | 112 |
113 |
126 |
127 | 128 |
129 |
130 | 131 | 132 | 133 |
134 |
135 |
136 | 137 | 138 | 139 | 140 | 141 | 142 |
143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 |
154 |

Google Summer of Code 2015

155 | 156 |

Ruby will be participating in the Google Summer of Code 2015 as a top-level organization. We will be acting as an 157 | umbrella for Ruby-related projects including Ruby, JRuby, Celluloid and 158 | others. Student applications can be submitted starting March 16 and the deadline is March 27 159 | (here’s the timeline).

160 | 161 | 162 | 163 |

Continue Reading...

164 | 165 | 166 |
167 | 168 |
169 |

Ruby 2.2.1 Released

170 | 171 |

We are pleased to announce the release of Ruby 2.2.1. 172 | This is the first TEENY version release of the stable 2.2 series.

173 | 174 | 175 | 176 |

Continue Reading...

177 | 178 | 179 |
180 | 181 |
182 |

Ruby 2.0.0-p643 Released

183 | 184 |

We are pleased to announce the release of Ruby 2.0.0-p643.

185 | 186 | 187 | 188 |

Continue Reading...

189 | 190 | 191 |
192 | 193 |
194 |

Support for Ruby 1.9.3 has ended

195 | 196 |

As of today, all support for Ruby 1.9.3 has ended. Bug and security fixes 197 | from more recent Ruby versions will no longer be backported to 1.9.3.

198 | 199 | 200 | 201 |

Continue Reading...

202 | 203 | 204 |
205 | 206 | 207 |
208 |

Other News

209 | 242 | 243 |

244 | More News... 245 |

246 |
247 | 248 |
249 |
250 |
251 | 252 | 345 |
346 | 347 |
348 |
349 |
350 | 351 |
352 | 404 |
405 | 406 | 419 | 420 | 421 | 422 | -------------------------------------------------------------------------------- /share/vruby/downloads.yml: -------------------------------------------------------------------------------- 1 | 2_2_3: 2 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.2.3.tar.bz2 3 | 2_2_1: 4 | linux: http://rvm.io/binaries/ubuntu/14.10/x86_64/ruby-2.2.1.tar.bz2 5 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.2.1.tar.bz2 6 | 2_1_7: 7 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.7.tar.bz2 8 | 2_1_6: 9 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.6.tar.bz2 10 | 2_1_5: 11 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.5.tar.bz2 12 | 2_1_4: 13 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.4.tar.bz2 14 | 2_1_3: 15 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.3.tar.bz2 16 | 2_1_2: 17 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.2.tar.bz2 18 | 2_1_1: 19 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.1.tar.bz2 20 | 2_1_0: 21 | osx: https://rvm.io/binaries/osx/10.10/x86_64/ruby-2.1.0.tar.bz2 22 | -------------------------------------------------------------------------------- /share/vruby/embed/activate.fish: -------------------------------------------------------------------------------- 1 | function deactivate -d "Exit vruby and return to normal shell environment" 2 | 3 | # reset old environment variables 4 | if set -q _OLD_VRUBY_PATH 5 | set -gx PATH $_OLD_VRUBY_PATH 6 | set -e _OLD_VRUBY_PATH 7 | end 8 | 9 | if set -q _OLD_VRUBY_RUBY_ROOT 10 | set -gx RUBY_ROOT $_OLD_VRUBY_RUBY_ROOT 11 | set -e _OLD_VRUBY_RUBY_ROOT 12 | else 13 | set -e RUBY_ROOT 14 | end 15 | 16 | if set -q _OLD_VRUBY_GEM_HOME 17 | set -gx GEM_HOME $_OLD_VRUBY_GEM_HOME 18 | set -e _OLD_VRUBY_GEM_HOME 19 | else 20 | set -e GEM_HOME 21 | end 22 | 23 | if set -q _OLD_VRUBY_GEM_PATH 24 | set -gx GEM_PATH $_OLD_VRUBY_GEM_PATH 25 | set -e _OLD_VRUBY_GEM_PATH 26 | else 27 | set -e GEM_PATH 28 | end 29 | 30 | set -e VRUBY 31 | 32 | functions -e deactivate 33 | end 34 | 35 | if test -n $RUBY_ROOT 36 | set -x _OLD_VRUBY_RUBY_ROOT $RUBY_ROOT 37 | end 38 | 39 | if test -n $GEM_HOME 40 | set -x _OLD_VRUBY_GEM_HOME $GEM_HOME 41 | end 42 | 43 | if test -n $GEM_PATH 44 | set -x _OLD_VRUBY_GEM_PATH $GEM_PATH 45 | end 46 | 47 | set RUBY_VERSION __VERSION__ 48 | set RUBY_ENGINE ruby 49 | set RUBY_ROOT "__HOST_DIR__/__TARGET_DIR__" 50 | 51 | set -x GEM_HOME "__HOST_DIR__/.gem/$RUBY_ENGINE/$RUBY_VERSION" 52 | set -x GEM_PATH "$GEM_HOME" 53 | 54 | set ruby_cmd $RUBY_ROOT/bin/ruby 55 | set ruby_api_version (eval $ruby_cmd -e "puts RbConfig::CONFIG['ruby_version']") 56 | 57 | set -x _OLD_VRUBY_PATH $PATH 58 | set -x PATH $GEM_HOME/bin "__FROM__/__VERSION__/lib/ruby/gems/$ruby_api_version" "$RUBY_ROOT/bin" $PATH 59 | 60 | set -x VRUBY "__HOST_DIR__/__TARGET_DIR__" 61 | -------------------------------------------------------------------------------- /share/vruby/embed/activate.sh: -------------------------------------------------------------------------------- 1 | deactivate() { 2 | 3 | if [ -n "${_OLD_VRUBY_PATH}" ]; then 4 | echo "RESETTING PATH" 5 | export PATH="$_OLD_VRUBY_PATH" 6 | unset _OLD_VRUBY_PATH 7 | fi 8 | 9 | if [ -n "${_OLD_VRUBY_RUBY_ROOT}" ]; then 10 | echo "RESETTING RUBY_ROOT" 11 | export RUBY_ROOT="$_OLD_VRUBY_RUBY_ROOT" 12 | unset _OLD_VRUBY_RUBY_ROOT 13 | else 14 | unset RUBY_ROOT 15 | fi 16 | 17 | if [ -n "${_OLD_VRUBY_GEM_HOME}" ]; then 18 | echo "RESETTING GEM_HOME" 19 | export GEM_HOME="$_OLD_VRUBY_GEM_HOME" 20 | unset _OLD_VRUBY_GEM_HOME 21 | else 22 | unset GEM_HOME 23 | fi 24 | 25 | if [ -n "${_OLD_VRUBY_GEM_PATH}" ]; then 26 | echo "RESETTING GEM_PATH" 27 | export GEM_PATH="$_OLD_VRUBY_GEM_PATH" 28 | unset _OLD_VRUBY_GEM_PATH 29 | else 30 | unset GEM_PATH 31 | fi 32 | 33 | unset VRUBY 34 | 35 | unset -f deactivate 36 | } 37 | 38 | RUBY_VERSION=__VERSION__ 39 | RUBY_ENGINE=ruby 40 | 41 | if [ -n "${RUBY_ROOT}" ]; then 42 | _OLD_VRUBY_RUBY_ROOT="$RUBY_ROOT" 43 | export _OLD_VRUBY_RUBY_ROOT 44 | fi 45 | 46 | RUBY_ROOT=__HOST_DIR__/__TARGET_DIR__ 47 | 48 | export RUBY_ROOT=__HOST_DIR__/__TARGET_DIR__ 49 | 50 | if [ -n "${GEM_HOME}" ]; then 51 | _OLD_VRUBY_GEM_HOME="$GEM_HOME" 52 | export _OLD_VRUBY_GEM_HOME 53 | fi 54 | 55 | export GEM_HOME="__HOST_DIR__/.gem/$RUBY_ENGINE/$RUBY_VERSION" 56 | 57 | if [ -n "${GEM_PATH}" ]; then 58 | _OLD_VRUBY_GEM_PATH="$GEM_PATH" 59 | export _OLD_VRUBY_GEM_PATH 60 | fi 61 | 62 | 63 | export GEM_HOME="__HOST_DIR__/.gem/$RUBY_ENGINE/$RUBY_VERSION" 64 | export GEM_PATH=$GEM_HOME 65 | 66 | ruby_api_version=$(ruby -e "puts RbConfig::CONFIG['ruby_version']") 67 | 68 | export _OLD_VRUBY_PATH="$PATH" 69 | export PATH=$GEM_HOME/bin:__FROM__/__VERSION__/lib/ruby/gems/$ruby_api_version/bin:$RUBY_ROOT/bin:$PATH 70 | 71 | export VRUBY="__HOST_DIR__/__TARGET_DIR__" 72 | --------------------------------------------------------------------------------