vtk 0.2.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +47 -6
- data/README.md +35 -10
- data/Rakefile +1 -2
- data/lib/vtk/cli.rb +3 -0
- data/lib/vtk/commands/module.rb +13 -14
- data/lib/vtk/commands/module/controller.rb +4 -3
- data/lib/vtk/commands/module/model.rb +4 -3
- data/lib/vtk/commands/module/serializer.rb +4 -3
- data/lib/vtk/commands/module/service.rb +4 -3
- data/lib/vtk/commands/socks.rb +40 -0
- data/lib/vtk/commands/socks/off.rb +40 -0
- data/lib/vtk/commands/socks/on.rb +61 -0
- data/lib/vtk/version.rb +1 -1
- data/vtk.gemspec +6 -4
- metadata +30 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad99a9b7f12175a81330df9b6dd29e528e088a934d9ddb4d13532cdc82745b8a
|
|
4
|
+
data.tar.gz: 79949c6723be663c804e04e06f8ff8e6a13781b9eda335821fa28f1b73830200
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5950052b41123adfda1fb86db4dcb8ba66387b8f743a0b8f80cbea87b20963c4e75e84077addd2f96be7a172305c63c1140869997ed932bf6d30a092f76c1235
|
|
7
|
+
data.tar.gz: f290f9c6a3be7c2dd31e45d70568da46ab22d214311e5dfb5845e6432d05f2a4416f62b1fd6ba837ceed49e7882f381130966f5facda0f7e0e01584dcf17420e
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [v0.5.0](https://github.com/department-of-veterans-affairs/vtk/tree/v0.5.0) (2021-02-19)
|
|
4
4
|
|
|
5
|
-
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.
|
|
5
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.4.0...v0.5.0)
|
|
6
6
|
|
|
7
|
-
## [v0.
|
|
7
|
+
## [v0.4.0](https://github.com/department-of-veterans-affairs/vtk/tree/v0.4.0) (2021-02-19)
|
|
8
8
|
|
|
9
|
-
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.
|
|
9
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.3.0...v0.4.0)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Added the ability to specify a name when creating a component \(i.e. controller, model, etc.\) [\#14](https://github.com/department-of-veterans-affairs/vtk/pull/14) ([thilton-oddball](https://github.com/thilton-oddball))
|
|
14
|
+
|
|
15
|
+
## [v0.3.0](https://github.com/department-of-veterans-affairs/vtk/tree/v0.3.0) (2021-02-16)
|
|
16
|
+
|
|
17
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.6...v0.3.0)
|
|
18
|
+
|
|
19
|
+
**Merged pull requests:**
|
|
20
|
+
|
|
21
|
+
- SOCKS On/Off Commands [\#9](https://github.com/department-of-veterans-affairs/vtk/pull/9) ([ericboehs](https://github.com/ericboehs))
|
|
22
|
+
|
|
23
|
+
## [v0.2.6](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.6) (2021-02-03)
|
|
24
|
+
|
|
25
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.5...v0.2.6)
|
|
10
26
|
|
|
11
27
|
**Merged pull requests:**
|
|
12
28
|
|
|
13
29
|
- Update changelog docs and raketask [\#13](https://github.com/department-of-veterans-affairs/vtk/pull/13) ([LindseySaari](https://github.com/LindseySaari))
|
|
14
|
-
- add gem [\#12](https://github.com/department-of-veterans-affairs/vtk/pull/12) ([LindseySaari](https://github.com/LindseySaari))
|
|
30
|
+
- add gem to auto generate changelog [\#12](https://github.com/department-of-veterans-affairs/vtk/pull/12) ([LindseySaari](https://github.com/LindseySaari))
|
|
31
|
+
|
|
32
|
+
## [v0.2.5](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.5) (2021-02-03)
|
|
33
|
+
|
|
34
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.4...v0.2.5)
|
|
15
35
|
|
|
16
36
|
## [v0.2.4](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.4) (2021-01-26)
|
|
17
37
|
|
|
18
|
-
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/
|
|
38
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.3...v0.2.4)
|
|
19
39
|
|
|
20
40
|
**Merged pull requests:**
|
|
21
41
|
|
|
@@ -23,8 +43,29 @@
|
|
|
23
43
|
- use system command [\#7](https://github.com/department-of-veterans-affairs/vtk/pull/7) ([LindseySaari](https://github.com/LindseySaari))
|
|
24
44
|
- Add additional module subcommands [\#6](https://github.com/department-of-veterans-affairs/vtk/pull/6) ([LindseySaari](https://github.com/LindseySaari))
|
|
25
45
|
- Check for Rails dependency [\#5](https://github.com/department-of-veterans-affairs/vtk/pull/5) ([LindseySaari](https://github.com/LindseySaari))
|
|
46
|
+
|
|
47
|
+
## [v0.2.3](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.3) (2021-01-05)
|
|
48
|
+
|
|
49
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.2...v0.2.3)
|
|
50
|
+
|
|
51
|
+
**Merged pull requests:**
|
|
52
|
+
|
|
26
53
|
- one more crack at fixing the README [\#4](https://github.com/department-of-veterans-affairs/vtk/pull/4) ([thilton-oddball](https://github.com/thilton-oddball))
|
|
54
|
+
|
|
55
|
+
## [v0.2.2](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.2) (2021-01-05)
|
|
56
|
+
|
|
57
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.1.0...v0.2.2)
|
|
58
|
+
|
|
59
|
+
**Merged pull requests:**
|
|
60
|
+
|
|
27
61
|
- fixing markdown in README … [\#3](https://github.com/department-of-veterans-affairs/vtk/pull/3) ([thilton-oddball](https://github.com/thilton-oddball))
|
|
62
|
+
|
|
63
|
+
## [v0.1.0](https://github.com/department-of-veterans-affairs/vtk/tree/v0.1.0) (2021-01-04)
|
|
64
|
+
|
|
65
|
+
[Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/oclif...v0.1.0)
|
|
66
|
+
|
|
67
|
+
**Merged pull requests:**
|
|
68
|
+
|
|
28
69
|
- Start afresh with tty [\#2](https://github.com/department-of-veterans-affairs/vtk/pull/2) ([LindseySaari](https://github.com/LindseySaari))
|
|
29
70
|
|
|
30
71
|
## [oclif](https://github.com/department-of-veterans-affairs/vtk/tree/oclif) (2020-08-10)
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Platform Developer Toolkit
|
|
2
2
|
|
|
3
|
-
The purpose of this gem is to allow VFS engineers to quickly begin developing on
|
|
3
|
+
The purpose of this gem is to allow VFS engineers to quickly begin developing on VA.gov. It does this by providing a command line interface that allows the use of simple commands and parameters to do everything from setting up a development environment to building out a directory structure and creating necessary files for separating code into its own module.
|
|
4
4
|
|
|
5
5
|
*The following assumes you have Ruby 2.6.6 or higher installed*
|
|
6
6
|
|
|
@@ -9,6 +9,10 @@ The purpose of this gem is to allow VFS engineers to quickly begin developing on
|
|
|
9
9
|
Install it yourself as:
|
|
10
10
|
|
|
11
11
|
$ gem install vtk
|
|
12
|
+
|
|
13
|
+
To update to the latest version:
|
|
14
|
+
|
|
15
|
+
$ gem update vtk
|
|
12
16
|
|
|
13
17
|
## Usage
|
|
14
18
|
|
|
@@ -18,14 +22,31 @@ Teams developing for vets-api should create their code as a module. This allows
|
|
|
18
22
|
|
|
19
23
|
$ vtk module add <module name>
|
|
20
24
|
|
|
21
|
-
To add additional functionality to your module, the commands listed below are available for use. These commands can build out common functionality needed when working with a module and will be created within the given module space. When creating a new module component for a module space that does not currently exist, users will be prompted with the choice to create the module directory structure. As above, first cd into the vets-api directory, then enter the command below, substituting the name of your
|
|
25
|
+
To add additional functionality to your module, the commands listed below are available for use. These commands can build out common functionality needed when working with a module and will be created within the given module space. When creating a new module component for a module space that does not currently exist, users will be prompted with the choice to create the module directory structure. As above, first cd into the vets-api directory, then enter the command below, substituting the name of your component for `<component name>`. You also MUST specify the name of the module by including `-m <module name>` after the component name.
|
|
22
26
|
|
|
23
|
-
$ vtk module controller <module name>
|
|
24
|
-
$ vtk module model <module name>
|
|
25
|
-
$ vtk module serializer <module name>
|
|
26
|
-
$ vtk module service <module name>
|
|
27
|
+
$ vtk module controller <component name> -m <module name>
|
|
28
|
+
$ vtk module model <component name> -m <module name>
|
|
29
|
+
$ vtk module serializer <component name> -m <module name>
|
|
30
|
+
$ vtk module service <component name> -m <module name>
|
|
27
31
|
|
|
28
32
|
This above command runs a custom rails generator. For more information see the [module generator documentation](https://github.com/department-of-veterans-affairs/vets-api/blob/master/lib/generators/module/USAGE)
|
|
33
|
+
|
|
34
|
+
### SOCKS
|
|
35
|
+
|
|
36
|
+
Handles connecting to VA network via SOCKS.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
$ vtk socks on
|
|
40
|
+
----> Connecting...
|
|
41
|
+
----> Connected to SOCKS.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
To disconnect, run:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
$ vtk socks off
|
|
48
|
+
----> Disconnected from SOCKS.
|
|
49
|
+
```
|
|
29
50
|
|
|
30
51
|
### Help
|
|
31
52
|
|
|
@@ -33,6 +54,7 @@ For helpful information about commands and subcommands run the following:
|
|
|
33
54
|
|
|
34
55
|
$ vtk -h
|
|
35
56
|
$ vtk module -h
|
|
57
|
+
$ vtk socks -h
|
|
36
58
|
|
|
37
59
|
### Docker
|
|
38
60
|
|
|
@@ -51,6 +73,9 @@ If using the vtk gem in Docker, you may first need to run the following commands
|
|
|
51
73
|
6. Create new Pull Request
|
|
52
74
|
|
|
53
75
|
### Releasing
|
|
54
|
-
1.
|
|
55
|
-
2. Update the
|
|
56
|
-
|
|
76
|
+
1. Merge in your approved pull requests
|
|
77
|
+
2. Update the version to be whatever it should (in lib/vtk/version.rb) be and commit
|
|
78
|
+
- The version bump could also be part of your PR
|
|
79
|
+
3. ``` bundle exec rake release ```
|
|
80
|
+
- This will tag the release and publish to RubyGems
|
|
81
|
+
4. Update the changelog — (```github_changelog_generator -u department-of-veterans-affairs -p vtk```)
|
data/Rakefile
CHANGED
|
@@ -14,8 +14,7 @@ task default: %i[spec rubocop]
|
|
|
14
14
|
desc 'Tags version, pushes to remote, and pushes gem'
|
|
15
15
|
task :release do
|
|
16
16
|
sh 'git', 'tag', "v#{Vtk::VERSION}"
|
|
17
|
-
sh 'git push origin master'
|
|
18
17
|
sh "git push origin v#{Vtk::VERSION}"
|
|
19
18
|
sh 'rake build'
|
|
20
|
-
sh
|
|
19
|
+
sh "ls pkg/vtk-#{Vtk::VERSION}.gem | xargs -n 1 gem push"
|
|
21
20
|
end
|
data/lib/vtk/cli.rb
CHANGED
|
@@ -18,6 +18,9 @@ module Vtk
|
|
|
18
18
|
end
|
|
19
19
|
map %w[--version -v] => :version
|
|
20
20
|
|
|
21
|
+
require_relative 'commands/socks'
|
|
22
|
+
register Vtk::Commands::Socks, 'socks', 'socks [SUBCOMMAND]', 'Handles connecting to VA network via SOCKS'
|
|
23
|
+
|
|
21
24
|
require_relative 'commands/module'
|
|
22
25
|
register Vtk::Commands::Module, 'module', 'module [SUBCOMMAND]', 'Command description...'
|
|
23
26
|
end
|
data/lib/vtk/commands/module.rb
CHANGED
|
@@ -8,9 +8,9 @@ module Vtk
|
|
|
8
8
|
class Module < Thor
|
|
9
9
|
namespace :module
|
|
10
10
|
|
|
11
|
-
desc 'service <
|
|
12
|
-
method_option :help, aliases: '-h', type: :boolean,
|
|
13
|
-
|
|
11
|
+
desc 'service <component name>', 'Add new service class to a module in vets-api'
|
|
12
|
+
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
|
|
13
|
+
method_option :module_name, aliases: '-m', type: :string, desc: 'Specify the module name', required: true
|
|
14
14
|
def service(name)
|
|
15
15
|
if options[:help]
|
|
16
16
|
invoke :help, ['service']
|
|
@@ -20,9 +20,9 @@ module Vtk
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
desc 'serializer <
|
|
24
|
-
method_option :help, aliases: '-h', type: :boolean,
|
|
25
|
-
|
|
23
|
+
desc 'serializer <component name>', 'Add new serializer to a module in vets-api'
|
|
24
|
+
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
|
|
25
|
+
method_option :module_name, aliases: '-m', type: :string, desc: 'Specify the module name', required: true
|
|
26
26
|
def serializer(name)
|
|
27
27
|
if options[:help]
|
|
28
28
|
invoke :help, ['serializer']
|
|
@@ -32,9 +32,9 @@ module Vtk
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
desc 'model <
|
|
36
|
-
method_option :help, aliases: '-h', type: :boolean,
|
|
37
|
-
|
|
35
|
+
desc 'model <component name>', 'Add new model to a module in vets-api'
|
|
36
|
+
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
|
|
37
|
+
method_option :module_name, aliases: '-m', type: :string, desc: 'Specify the module name', required: true
|
|
38
38
|
def model(name)
|
|
39
39
|
if options[:help]
|
|
40
40
|
invoke :help, ['model']
|
|
@@ -44,9 +44,9 @@ module Vtk
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
desc 'controller <
|
|
48
|
-
method_option :help, aliases: '-h', type: :boolean,
|
|
49
|
-
|
|
47
|
+
desc 'controller <component name>', 'Add new controller to a module in vets-api'
|
|
48
|
+
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
|
|
49
|
+
method_option :module_name, aliases: '-m', type: :string, desc: 'Specify the module name', required: true
|
|
50
50
|
def controller(name)
|
|
51
51
|
if options[:help]
|
|
52
52
|
invoke :help, ['controller']
|
|
@@ -57,8 +57,7 @@ module Vtk
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
desc 'add <module name>', 'Add a new module to vets-api'
|
|
60
|
-
method_option :help, aliases: '-h', type: :boolean,
|
|
61
|
-
desc: 'Display usage information'
|
|
60
|
+
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
|
|
62
61
|
def add(name)
|
|
63
62
|
if options[:help]
|
|
64
63
|
invoke :help, ['add']
|
|
@@ -17,13 +17,14 @@ module Vtk
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def execute(_input: $stdin, _output: $stdout)
|
|
20
|
-
create_controller(name)
|
|
20
|
+
create_controller(name, options)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
-
def create_controller(name)
|
|
26
|
-
|
|
25
|
+
def create_controller(name, options)
|
|
26
|
+
module_name = options[:module_name]
|
|
27
|
+
system("rails g module_component #{module_name} method:controller component_name:#{name}")
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -17,13 +17,14 @@ module Vtk
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def execute(_input: $stdin, _output: $stdout)
|
|
20
|
-
create_model(name)
|
|
20
|
+
create_model(name, options)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
-
def create_model(name)
|
|
26
|
-
|
|
25
|
+
def create_model(name, options)
|
|
26
|
+
module_name = options[:module_name]
|
|
27
|
+
system("rails g module_component #{module_name} method:model component_name:#{name}")
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -17,13 +17,14 @@ module Vtk
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def execute(_input: $stdin, _output: $stdout)
|
|
20
|
-
create_serializer(name)
|
|
20
|
+
create_serializer(name, options)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
-
def create_serializer(name)
|
|
26
|
-
|
|
25
|
+
def create_serializer(name, options)
|
|
26
|
+
module_name = options[:module_name]
|
|
27
|
+
system("rails g module_component #{module_name} method:serializer component_name:#{name}")
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -17,13 +17,14 @@ module Vtk
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def execute(_input: $stdin, _output: $stdout)
|
|
20
|
-
create_service(name)
|
|
20
|
+
create_service(name, options)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
-
def create_service(name)
|
|
26
|
-
|
|
25
|
+
def create_service(name, options)
|
|
26
|
+
module_name = options[:module_name]
|
|
27
|
+
system("rails g module_component #{module_name} method:service component_name:#{name}")
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'thor'
|
|
4
|
+
|
|
5
|
+
module Vtk
|
|
6
|
+
module Commands
|
|
7
|
+
# Handles connecting to VA network via SOCKS
|
|
8
|
+
class Socks < Thor
|
|
9
|
+
namespace :socks
|
|
10
|
+
|
|
11
|
+
desc 'off', 'Disconnects from VA SOCKS'
|
|
12
|
+
method_option :help, aliases: '-h', type: :boolean,
|
|
13
|
+
desc: 'Display usage information'
|
|
14
|
+
method_option :port, aliases: '-p', type: :string,
|
|
15
|
+
desc: 'Port that SOCKS server is running on'
|
|
16
|
+
def off(*)
|
|
17
|
+
if options[:help]
|
|
18
|
+
invoke :help, ['off']
|
|
19
|
+
else
|
|
20
|
+
require_relative 'socks/off'
|
|
21
|
+
Vtk::Commands::Socks::Off.new(options).execute
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
desc 'on', 'Connects to VA SOCKS'
|
|
26
|
+
method_option :help, aliases: '-h', type: :boolean,
|
|
27
|
+
desc: 'Display usage information'
|
|
28
|
+
method_option :port, aliases: '-p', type: :string,
|
|
29
|
+
desc: 'Port to run SOCKS server on'
|
|
30
|
+
def on(*)
|
|
31
|
+
if options[:help]
|
|
32
|
+
invoke :help, ['on']
|
|
33
|
+
else
|
|
34
|
+
require_relative 'socks/on'
|
|
35
|
+
Vtk::Commands::Socks::On.new(options).execute
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../command'
|
|
4
|
+
|
|
5
|
+
module Vtk
|
|
6
|
+
module Commands
|
|
7
|
+
class Socks
|
|
8
|
+
# Turns off SOCKS connection to VA network
|
|
9
|
+
class Off < Vtk::Command
|
|
10
|
+
attr_reader :options
|
|
11
|
+
|
|
12
|
+
def initialize(options)
|
|
13
|
+
@options = options
|
|
14
|
+
|
|
15
|
+
super()
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def execute(_input: $stdin, output: $stdout)
|
|
19
|
+
pids_killed = running_pids.map { |pid| kill_pid pid }
|
|
20
|
+
|
|
21
|
+
if pids_killed.any? && pids_killed.all?
|
|
22
|
+
output.puts '----> Disconnected from SOCKS.'
|
|
23
|
+
else
|
|
24
|
+
output.puts '----> No SOCKS connection found.'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def running_pids
|
|
31
|
+
`lsof -Pi :#{options['port'] || 2001} -sTCP:LISTEN -t`.chomp.split "\n"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def kill_pid(pid)
|
|
35
|
+
system "kill -9 #{pid}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../command'
|
|
4
|
+
|
|
5
|
+
module Vtk
|
|
6
|
+
module Commands
|
|
7
|
+
class Socks
|
|
8
|
+
# Turns on SOCKS connection to VA network
|
|
9
|
+
class On < Vtk::Command
|
|
10
|
+
attr_reader :input, :output, :port
|
|
11
|
+
|
|
12
|
+
def initialize(options)
|
|
13
|
+
@options = options
|
|
14
|
+
@port = options['port'] || '2001'
|
|
15
|
+
|
|
16
|
+
super()
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def execute(_input: $stdin, output: $stdout)
|
|
20
|
+
@input = input
|
|
21
|
+
@output = output
|
|
22
|
+
|
|
23
|
+
return output.puts '----> Already connected to SOCKS.' if connected?
|
|
24
|
+
|
|
25
|
+
connect_to_socks
|
|
26
|
+
ensure_connection
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def connected?
|
|
32
|
+
system "curl --max-time 2 -sL --proxy socks5h://127.0.0.1:#{port} sentry.vfs.va.gov 2> /dev/null | " \
|
|
33
|
+
'grep -q sentry-logo'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def connect_to_socks
|
|
37
|
+
exit if system "lsof -Pi :#{port} -sTCP:LISTEN -t > /dev/null"
|
|
38
|
+
|
|
39
|
+
Process.spawn "nohup ssh -vvv -o ServerAliveInterval=60 -o ConnectTimeout=5 socks -D #{port} -N" \
|
|
40
|
+
'> /tmp/socks.log 2>&1 &'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def ensure_connection
|
|
44
|
+
output.print '----> Connecting'
|
|
45
|
+
10.times do
|
|
46
|
+
sleep 1
|
|
47
|
+
output.print '.'
|
|
48
|
+
next unless connected?
|
|
49
|
+
|
|
50
|
+
return output.puts "\r----> Connected to SOCKS."
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
output.puts "\r----> ERROR: Could not connect to SOCKS."
|
|
54
|
+
output.puts "----> Verbose Output from SSH log:\n\n"
|
|
55
|
+
|
|
56
|
+
output.puts File.read '/tmp/socks.log'
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/vtk/version.rb
CHANGED
data/vtk.gemspec
CHANGED
|
@@ -9,14 +9,15 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = ['Eric Boehs', 'Lindsey Hattamer', 'Travis Hilton']
|
|
10
10
|
spec.email = ['eric.boehs@oddball.io', 'lindsey.hattamer@oddball.io', 'travis.hilton@oddball.io']
|
|
11
11
|
|
|
12
|
-
spec.summary = 'A CLI for the
|
|
13
|
-
spec.description = 'This is a CLI tool for
|
|
14
|
-
spec.homepage = 'https://github.com/department-of-veterans-affairs/
|
|
12
|
+
spec.summary = 'A CLI for the platform'
|
|
13
|
+
spec.description = 'This is a platform CLI tool for VFS developer usage.'
|
|
14
|
+
spec.homepage = 'https://github.com/department-of-veterans-affairs/vtk'
|
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
|
16
16
|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['documentation_uri'] = spec.homepage
|
|
18
19
|
spec.metadata['source_code_uri'] = spec.homepage
|
|
19
|
-
spec.metadata['changelog_uri'] = 'https://github.com/department-of-veterans-affairs/
|
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/department-of-veterans-affairs/vtk/blob/master/CHANGELOG.md'
|
|
20
21
|
|
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -30,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
30
31
|
spec.add_dependency 'thor', '> 0.20.3'
|
|
31
32
|
|
|
32
33
|
spec.add_development_dependency 'github_changelog_generator', '~> 1.15.0'
|
|
34
|
+
spec.add_development_dependency 'pry', '~> 0.13.0'
|
|
33
35
|
spec.add_development_dependency 'rake', '~> 13.0.0'
|
|
34
36
|
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
|
35
37
|
spec.add_development_dependency 'rubocop', '~> 1.6.0'
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vtk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Boehs
|
|
8
8
|
- Lindsey Hattamer
|
|
9
9
|
- Travis Hilton
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2021-
|
|
13
|
+
date: 2021-03-01 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: thor
|
|
@@ -40,6 +40,20 @@ dependencies:
|
|
|
40
40
|
- - "~>"
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
42
|
version: 1.15.0
|
|
43
|
+
- !ruby/object:Gem::Dependency
|
|
44
|
+
name: pry
|
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - "~>"
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: 0.13.0
|
|
50
|
+
type: :development
|
|
51
|
+
prerelease: false
|
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - "~>"
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 0.13.0
|
|
43
57
|
- !ruby/object:Gem::Dependency
|
|
44
58
|
name: rake
|
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -110,7 +124,7 @@ dependencies:
|
|
|
110
124
|
- - "~>"
|
|
111
125
|
- !ruby/object:Gem::Version
|
|
112
126
|
version: 2.0.0
|
|
113
|
-
description: This is a CLI tool for
|
|
127
|
+
description: This is a platform CLI tool for VFS developer usage.
|
|
114
128
|
email:
|
|
115
129
|
- eric.boehs@oddball.io
|
|
116
130
|
- lindsey.hattamer@oddball.io
|
|
@@ -145,18 +159,22 @@ files:
|
|
|
145
159
|
- lib/vtk/commands/module/model.rb
|
|
146
160
|
- lib/vtk/commands/module/serializer.rb
|
|
147
161
|
- lib/vtk/commands/module/service.rb
|
|
162
|
+
- lib/vtk/commands/socks.rb
|
|
163
|
+
- lib/vtk/commands/socks/off.rb
|
|
164
|
+
- lib/vtk/commands/socks/on.rb
|
|
148
165
|
- lib/vtk/templates/.gitkeep
|
|
149
166
|
- lib/vtk/templates/module/add/.gitkeep
|
|
150
167
|
- lib/vtk/version.rb
|
|
151
168
|
- vtk.gemspec
|
|
152
|
-
homepage: https://github.com/department-of-veterans-affairs/
|
|
169
|
+
homepage: https://github.com/department-of-veterans-affairs/vtk
|
|
153
170
|
licenses:
|
|
154
171
|
- MIT
|
|
155
172
|
metadata:
|
|
156
|
-
homepage_uri: https://github.com/department-of-veterans-affairs/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
173
|
+
homepage_uri: https://github.com/department-of-veterans-affairs/vtk
|
|
174
|
+
documentation_uri: https://github.com/department-of-veterans-affairs/vtk
|
|
175
|
+
source_code_uri: https://github.com/department-of-veterans-affairs/vtk
|
|
176
|
+
changelog_uri: https://github.com/department-of-veterans-affairs/vtk/blob/master/CHANGELOG.md
|
|
177
|
+
post_install_message:
|
|
160
178
|
rdoc_options: []
|
|
161
179
|
require_paths:
|
|
162
180
|
- lib
|
|
@@ -171,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
189
|
- !ruby/object:Gem::Version
|
|
172
190
|
version: '0'
|
|
173
191
|
requirements: []
|
|
174
|
-
rubygems_version: 3.0.
|
|
175
|
-
signing_key:
|
|
192
|
+
rubygems_version: 3.0.3
|
|
193
|
+
signing_key:
|
|
176
194
|
specification_version: 4
|
|
177
|
-
summary: A CLI for the
|
|
195
|
+
summary: A CLI for the platform
|
|
178
196
|
test_files: []
|