vtk 0.2.6 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 678cd7a4d85c462d38c72c3e46a44593200c01392b16a81d3d483d85291fbce1
4
- data.tar.gz: 581e25dc6f9380c05cc818ff8d14aec417631089abb884a3f6f91e6bacbc2179
3
+ metadata.gz: dbb2159bd782736d6f9647826b073ab189e0e7d40d69dcb1664c16f62a688f09
4
+ data.tar.gz: 36386f949cd2c08013e97d3689ebc6f2c86c95ce0ca9fd7344223c35cb3ff261
5
5
  SHA512:
6
- metadata.gz: c2431f851ba14a8e3be191d5013bf67ffe9b5a5b2adee26725a167df34aef97b235a1ec48d3992511eda52412904ae7224bb860511a04e572011bdb159051a9b
7
- data.tar.gz: fada05e459fb4244d0aa32b0eeb62a46e4ba7cb68e1c6e2d26ecea208541ca63a340ccb2fd9c6f737e34b3343acc7c79d88ab67559618f8b89b3def509de571b
6
+ metadata.gz: b375532131584051a1ad0c3036f68bab2304e8bdeb47cbfe7e3806fba24a5838be3e2229663cc836ae429eb17ebc2dc86a771589d83934226ea011dd80a8edc5
7
+ data.tar.gz: e28c0bbfa60f7ef3b15948e355171a8e9f2b8cb17fca8f4094217b75423b337e1e693d7226b42a80cc2b1165da08f7ac3951a284c26c68fc5178da2fef5504d9
data/.rubocop.yml CHANGED
@@ -6,4 +6,5 @@ Layout/LineLength:
6
6
 
7
7
  Metrics/BlockLength:
8
8
  Exclude:
9
- - 'spec/integration/module_spec.rb'
9
+ - 'spec/**/*.rb'
10
+ - '*.gemspec'
data/CHANGELOG.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/department-of-veterans-affairs/vtk/tree/HEAD)
3
+ ## [v0.2.6](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.6) (2021-02-03)
4
4
 
5
- [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.5...HEAD)
6
-
7
- ## [v0.2.5](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.5) (2021-02-03)
8
-
9
- [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.4...v0.2.5)
5
+ [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.5...v0.2.6)
10
6
 
11
7
  **Merged pull requests:**
12
8
 
13
9
  - 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))
10
+ - add gem to auto generate changelog [\#12](https://github.com/department-of-veterans-affairs/vtk/pull/12) ([LindseySaari](https://github.com/LindseySaari))
11
+
12
+ ## [v0.2.5](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.5) (2021-02-03)
13
+
14
+ [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.4...v0.2.5)
15
15
 
16
16
  ## [v0.2.4](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.4) (2021-01-26)
17
17
 
18
- [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/oclif...v0.2.4)
18
+ [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.3...v0.2.4)
19
19
 
20
20
  **Merged pull requests:**
21
21
 
@@ -23,8 +23,29 @@
23
23
  - use system command [\#7](https://github.com/department-of-veterans-affairs/vtk/pull/7) ([LindseySaari](https://github.com/LindseySaari))
24
24
  - Add additional module subcommands [\#6](https://github.com/department-of-veterans-affairs/vtk/pull/6) ([LindseySaari](https://github.com/LindseySaari))
25
25
  - Check for Rails dependency [\#5](https://github.com/department-of-veterans-affairs/vtk/pull/5) ([LindseySaari](https://github.com/LindseySaari))
26
+
27
+ ## [v0.2.3](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.3) (2021-01-05)
28
+
29
+ [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.2.2...v0.2.3)
30
+
31
+ **Merged pull requests:**
32
+
26
33
  - 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))
34
+
35
+ ## [v0.2.2](https://github.com/department-of-veterans-affairs/vtk/tree/v0.2.2) (2021-01-05)
36
+
37
+ [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/v0.1.0...v0.2.2)
38
+
39
+ **Merged pull requests:**
40
+
27
41
  - fixing markdown in README … [\#3](https://github.com/department-of-veterans-affairs/vtk/pull/3) ([thilton-oddball](https://github.com/thilton-oddball))
42
+
43
+ ## [v0.1.0](https://github.com/department-of-veterans-affairs/vtk/tree/v0.1.0) (2021-01-04)
44
+
45
+ [Full Changelog](https://github.com/department-of-veterans-affairs/vtk/compare/oclif...v0.1.0)
46
+
47
+ **Merged pull requests:**
48
+
28
49
  - Start afresh with tty [\#2](https://github.com/department-of-veterans-affairs/vtk/pull/2) ([LindseySaari](https://github.com/LindseySaari))
29
50
 
30
51
  ## [oclif](https://github.com/department-of-veterans-affairs/vtk/tree/oclif) (2020-08-10)
data/README.md CHANGED
@@ -26,6 +26,23 @@ To add additional functionality to your module, the commands listed below are av
26
26
  $ vtk module service <module name>
27
27
 
28
28
  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)
29
+
30
+ ### SOCKS
31
+
32
+ Handles connecting to VA network via SOCKS.
33
+
34
+ ```
35
+ $ vtk socks on
36
+ ----> Connecting...
37
+ ----> Connected to SOCKS.
38
+ ```
39
+
40
+ To disconnect, run:
41
+
42
+ ```
43
+ $ vtk socks off
44
+ ----> Disconnected from SOCKS.
45
+ ```
29
46
 
30
47
  ### Help
31
48
 
@@ -51,6 +68,9 @@ If using the vtk gem in Docker, you may first need to run the following commands
51
68
  6. Create new Pull Request
52
69
 
53
70
  ### Releasing
54
- 1. Update the version to be whatever it should be and commit
55
- 2. Update the changelog (github_changelog_generator -u department-of-veterans-affairs -p vtk)
56
- 3. bundle exec rake release
71
+ 1. Merge in your approved pull requests
72
+ 2. Update the version to be whatever it should (in lib/vtk/version.rb) be and commit
73
+ - The version bump could also be part of your PR
74
+ 3. ``` bundle exec rake release ```
75
+ - This will tag the release and publish to RubyGems
76
+ 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 'ls pkg/*.gem | xargs -n 1 gem push'
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vtk
4
- VERSION = '0.2.6'
4
+ VERSION = '0.3.0'
5
5
  end
data/vtk.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = spec.homepage
19
- spec.metadata['changelog_uri'] = 'https://github.com/department-of-veterans-affairs/vsp-toolkit/blob/master/CHANGELOG.md'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/department-of-veterans-affairs/vtk/blob/master/CHANGELOG.md'
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'thor', '> 0.20.3'
31
31
 
32
32
  spec.add_development_dependency 'github_changelog_generator', '~> 1.15.0'
33
+ spec.add_development_dependency 'pry', '~> 0.13.0'
33
34
  spec.add_development_dependency 'rake', '~> 13.0.0'
34
35
  spec.add_development_dependency 'rspec', '~> 3.10.0'
35
36
  spec.add_development_dependency 'rubocop', '~> 1.6.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Boehs
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-02-03 00:00:00.000000000 Z
13
+ date: 2021-02-16 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
@@ -145,6 +159,9 @@ 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
@@ -155,7 +172,7 @@ licenses:
155
172
  metadata:
156
173
  homepage_uri: https://github.com/department-of-veterans-affairs/vsp-toolkit
157
174
  source_code_uri: https://github.com/department-of-veterans-affairs/vsp-toolkit
158
- changelog_uri: https://github.com/department-of-veterans-affairs/vsp-toolkit/blob/master/CHANGELOG.md
175
+ changelog_uri: https://github.com/department-of-veterans-affairs/vtk/blob/master/CHANGELOG.md
159
176
  post_install_message:
160
177
  rdoc_options: []
161
178
  require_paths:
@@ -171,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
188
  - !ruby/object:Gem::Version
172
189
  version: '0'
173
190
  requirements: []
174
- rubygems_version: 3.0.8
191
+ rubygems_version: 3.2.1
175
192
  signing_key:
176
193
  specification_version: 4
177
194
  summary: A CLI for the VSP platform