Class: DRbQS::Manage::SSHShell::RubyEnvironment
- Inherits:
-
Object
- Object
- DRbQS::Manage::SSHShell::RubyEnvironment
- Defined in:
- lib/drbqs/manage/ssh_shell.rb
Constant Summary collapse
- DEFAULT_RVM_SCRIPT =
'$HOME/.rvm/scripts/rvm'
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#rvm ⇒ Object
readonly
Returns the value of attribute rvm.
-
#rvm_init ⇒ Object
readonly
Returns the value of attribute rvm_init.
Instance Method Summary collapse
- #get_environment_commands ⇒ Object
-
#initialize(opts = {}) ⇒ RubyEnvironment
constructor
A new instance of RubyEnvironment.
- #setup_commands ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ RubyEnvironment
Returns a new instance of RubyEnvironment.
20 21 22 23 24 25 26 27 28 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 20 def initialize(opts = {}) @directory = opts[:directory] @rvm = opts[:rvm] @rvm_init = opts[:rvm_init] if (@rvm || @rvm_init) && !(String === @rvm_init) @rvm_init = DEFAULT_RVM_SCRIPT end @env = opts[:env] end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
13 14 15 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 13 def directory @directory end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
13 14 15 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 13 def env @env end |
#rvm ⇒ Object (readonly)
Returns the value of attribute rvm.
13 14 15 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 13 def rvm @rvm end |
#rvm_init ⇒ Object (readonly)
Returns the value of attribute rvm_init.
13 14 15 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 13 def rvm_init @rvm_init end |
Instance Method Details
#get_environment_commands ⇒ Object
49 50 51 52 53 54 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 49 def get_environment_commands ['echo "directory: " `pwd`', 'echo "files:"', 'ls', 'if which rvm > /dev/null; then rvm info; else ruby -v; fi'] end |
#setup_commands ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/drbqs/manage/ssh_shell.rb', line 41 def setup_commands cmds = commands_to_set_env_on_bash cmds << "cd #{@directory}" if @directory cmds << "source #{@rvm_init}" if @rvm_init cmds << "rvm use #{@rvm}" if @rvm cmds end |