Class: Cabal::IdentityManager

Inherits:
Object
  • Object
show all
Defined in:
lib/cabal/identity_manager.rb

Overview

Manages ssh-agent sessions for forwarding identity information via Cabal::SSH

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#envString (readonly)

Returns the environment settings for the running ssh-agent.

Returns:

  • (String)

    the environment settings for the running ssh-agent



7
8
9
# File 'lib/cabal/identity_manager.rb', line 7

def env
  @env
end

Instance Method Details

#startnil

Spawns an ssh-agent process and records its related environment settings

Returns:

  • (nil)


11
12
13
14
15
16
# File 'lib/cabal/identity_manager.rb', line 11

def start
  @env = start_agent.
    split(/(\;|\n)/).
    select {|line| line =~ /^SSH_/}.
    join(' ')
end

#stopnil

Stops a running ssh-agent that was previously spawned

Returns:

  • (nil)


20
21
22
# File 'lib/cabal/identity_manager.rb', line 20

def stop
  stop_agent
end