Class: Babushka::CurrentRuby
Instance Method Summary collapse
- #bin_dir ⇒ Object
- #gem_dir ⇒ Object
- #gem_version ⇒ Object
- #gemspec_dir ⇒ Object
- #path ⇒ Object
- #rbenv? ⇒ Boolean
- #rvm? ⇒ Boolean
- #version ⇒ Object
Instance Method Details
#bin_dir ⇒ Object
16 17 18 19 20 |
# File 'lib/babushka/current_ruby.rb', line 16 def bin_dir # The directory in which the binaries from gems are found. This is # sometimes different to where `gem` itself is running from. gem_env.val_for('EXECUTABLE DIRECTORY').p end |
#gem_dir ⇒ Object
22 23 24 |
# File 'lib/babushka/current_ruby.rb', line 22 def gem_dir gem_env.val_for('INSTALLATION DIRECTORY') / 'gems' end |
#gem_version ⇒ Object
34 35 36 |
# File 'lib/babushka/current_ruby.rb', line 34 def gem_version gem_env.val_for('RUBYGEMS VERSION').to_version end |
#gemspec_dir ⇒ Object
26 27 28 |
# File 'lib/babushka/current_ruby.rb', line 26 def gemspec_dir gem_env.val_for('INSTALLATION DIRECTORY') / 'specifications' end |
#path ⇒ Object
4 5 6 |
# File 'lib/babushka/current_ruby.rb', line 4 def path @path ||= Babushka::ShellHelpers.which('ruby').p end |
#rbenv? ⇒ Boolean
8 9 10 |
# File 'lib/babushka/current_ruby.rb', line 8 def rbenv? path.to_s[%r{\brbenv/}] end |
#rvm? ⇒ Boolean
12 13 14 |
# File 'lib/babushka/current_ruby.rb', line 12 def rvm? path.to_s[%r{\brvm/}] end |
#version ⇒ Object
30 31 32 |
# File 'lib/babushka/current_ruby.rb', line 30 def version @_version ||= Babushka::ShellHelpers.shell('ruby --version').scan(/^ruby (\S+)/).flatten.first.to_version end |