Class: Vtk::Commands::Socks::Setup
- Inherits:
-
Vtk::Command
- Object
- Vtk::Command
- Vtk::Commands::Socks::Setup
- Defined in:
- lib/vtk/commands/socks/setup.rb
Overview
Sets up socks access to the VA network
Constant Summary collapse
- PROXY_URL =
'https://raw.githubusercontent.com/department-of-veterans-affairs/va.gov-team/master/' \ 'scripts/socks/proxy.pac'
Instance Attribute Summary collapse
-
#boot_script_path ⇒ Object
readonly
Returns the value of attribute boot_script_path.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#skip_test ⇒ Object
readonly
Returns the value of attribute skip_test.
-
#ssh_config_path ⇒ Object
readonly
Returns the value of attribute ssh_config_path.
-
#ssh_key_path ⇒ Object
readonly
Returns the value of attribute ssh_key_path.
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Setup
constructor
A new instance of Setup.
Methods inherited from Vtk::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #screen, #which
Constructor Details
#initialize(options) ⇒ Setup
Returns a new instance of Setup.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vtk/commands/socks/setup.rb', line 18 def initialize() @options = @prompt = TTY::Prompt.new interrupt: :exit @port = ['port'] || '2001' @boot_script_path = ['boot_script_path'] || "#{ENV['HOME']}/Library" @ssh_key_path = ['ssh_key_path'] || "#{ENV['HOME']}/.ssh/id_rsa_vagov" @ssh_config_path = ['ssh_config_path'] || "#{ENV['HOME']}/.ssh/config" @skip_test = ['skip_test'] || false super() end |
Instance Attribute Details
#boot_script_path ⇒ Object (readonly)
Returns the value of attribute boot_script_path.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def boot_script_path @boot_script_path end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def output @output end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def port @port end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def prompt @prompt end |
#skip_test ⇒ Object (readonly)
Returns the value of attribute skip_test.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def skip_test @skip_test end |
#ssh_config_path ⇒ Object (readonly)
Returns the value of attribute ssh_config_path.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def ssh_config_path @ssh_config_path end |
#ssh_key_path ⇒ Object (readonly)
Returns the value of attribute ssh_key_path.
16 17 18 |
# File 'lib/vtk/commands/socks/setup.rb', line 16 def ssh_key_path @ssh_key_path end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vtk/commands/socks/setup.rb', line 30 def execute(input: $stdin, output: $stdout) define_stdin_out_vars input: input, output: output setup_ssh_config check_ssh_key ssh_agent_add unless @ssh_key_created test_ssh_connection unless skip_test configure_system_boot configure_system_proxy end log "SOCKS setup complete. #{'Re-run `vtk socks setup` after your key is approved.' if @ssh_key_created}" end |