Class: Gel::Command::ShellSetup
- Inherits:
-
Gel::Command
- Object
- Gel::Command
- Gel::Command::ShellSetup
- Defined in:
- lib/gel/command/shell_setup.rb
Instance Attribute Summary
Attributes inherited from Gel::Command
Instance Method Summary collapse
Methods inherited from Gel::Command
extract_word, handle_error, run
Instance Method Details
#run(command_line) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gel/command/shell_setup.rb', line 4 def run(command_line) require "shellwords" variables = [] bin_dir = File.("~/.local/gel/bin") unless ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).include?(bin_dir) puts "PATH=\"#{Shellwords.shellescape bin_dir}#{File::PATH_SEPARATOR}$PATH\"" variables << "PATH" end lib_dir = File.("../compatibility", __dir__) unless ENV.fetch("RUBYLIB", "").split(File::PATH_SEPARATOR).include?(lib_dir) puts "RUBYLIB=\"#{Shellwords.shellescape lib_dir}:$RUBYLIB\"" variables << "RUBYLIB" end unless variables.empty? puts "export #{variables.join(" ")}" end end |