Class: Console::Mux::RunWith

Inherits:
Object
  • Object
show all
Defined in:
lib/console/mux/run_with.rb

Class Method Summary collapse

Class Method Details

.bundle_exec(c, str) ⇒ Object

A filter for running a command with bundle exec. Ensures the BUNDLE_GEMFILE environment variable is cleared before running bundle exec.



64
65
66
# File 'lib/console/mux/run_with.rb', line 64

def bundle_exec(c, str)
  "bundle exec #{str}"
end

.bundle_exec_sh(c, str) ⇒ Object



68
69
70
# File 'lib/console/mux/run_with.rb', line 68

def bundle_exec_sh(c, str)
  "#{::Console::Mux::BUNDLE_EXEC_SH} #{str}"
end

.rbenv(c, str) ⇒ Object

A filter for running a command with rbenv. Sets RBENV_VERSION environment var will be set to the value of the :ruby option.

Parameters:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/console/mux/run_with.rb', line 43

def rbenv(c, str)
  c.env['RBENV_VERSION'] = c[:ruby]

  # Strip out any rbenv version bin path.  Assumes rbenv is
  # installed in .rbenv.  This is necessary because if we run
  # console-mux via an rbenv shim, that shim first tacks on
  # the bin path to the in-use ruby version prior to exec'ing
  # the actual console-mux...  But we don't want that path to
  # follow down to sub processes spawned by console-mux.
  c.env['PATH'] =
    ENV['PATH'].
    split(File::PATH_SEPARATOR).
    reject{|p| p =~ %r{.rbenv/versions}}.
    join(File::PATH_SEPARATOR)
  
  str
end

.rvm_shell(c, str) ⇒ Object

A filter for running a command with RVM shell. Looks at the :ruby option.

Parameters:



30
31
32
33
34
35
# File 'lib/console/mux/run_with.rb', line 30

def rvm_shell(c, str)
  rvm_command = 'rvm-shell '
  rvm_command += "'#{c[:ruby]}' " if c[:ruby]
  rvm_command += "-c '#{str}'"
  rvm_command
end