Class: Landrush::Util::Path
- Inherits:
-
Object
- Object
- Landrush::Util::Path
- Defined in:
- lib/landrush/util/path.rb
Class Method Summary collapse
- .embedded_vagrant_bin_dir ⇒ Object
- .embedded_vagrant_ruby ⇒ Object
- .ensure_ruby_on_path ⇒ Object
- .separator ⇒ Object
Class Method Details
.embedded_vagrant_bin_dir ⇒ Object
15 16 17 18 19 20 |
# File 'lib/landrush/util/path.rb', line 15 def self. vagrant_binary = Vagrant::Util::Which.which('vagrant') vagrant_binary = File.realpath(vagrant_binary) if File.symlink?(vagrant_binary) # in a Vagrant installation the Ruby executable is in ../embedded/bin relative to the vagrant executable File.dirname(File.dirname(vagrant_binary)) + separator + 'embedded' + separator + 'bin' end |
.embedded_vagrant_ruby ⇒ Object
4 5 6 7 8 |
# File 'lib/landrush/util/path.rb', line 4 def self. bin_dir = ruby_bin = bin_dir + separator + 'ruby' ruby_bin if File.exist?(ruby_bin) end |
.ensure_ruby_on_path ⇒ Object
10 11 12 13 |
# File 'lib/landrush/util/path.rb', line 10 def self.ensure_ruby_on_path bin_dir = ENV['PATH'] = bin_dir + File::PATH_SEPARATOR + ENV['PATH'] if File.exist?(bin_dir) end |
.separator ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/landrush/util/path.rb', line 22 def self.separator # we don't use File.join here, since even on Cygwin we want a Windows path - see https://github.com/vagrant-landrush/landrush/issues/237 if Vagrant::Util::Platform.windows? '\\' else '/' end end |