vtk 0.7.0 → 0.8.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 +1 -0
- data/README.md +2 -2
- data/lib/vtk/analytics.rb +57 -0
- data/lib/vtk/command.rb +6 -0
- data/lib/vtk/version.rb +1 -1
- data/vtk.gemspec +2 -2
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f38bf2816e12d02d33715da96ee84b7101f72378daa994e7a09dcf84769d46b7
|
4
|
+
data.tar.gz: d823b0a548bb2b51d6e945b692c3ee396c556dedd715171d40266a1c3f86a5a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a9f1ab0d6e9b15a5397f277eb1cce487f7b73d7c5aace867c74c443f5c7f16a7edc2985bae32f4e227018601aefeb5e6cf6447064ee000e0968eeabad5bdc51
|
7
|
+
data.tar.gz: 25f80d204782a2327745b04dfdd76a6708651b941fc0aa73489c92d5c7e706d834cb9e588519e913c9435656ad75fc7c4c8bbba0db67d849f83f6385c35784d5
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# VFS Toolkit
|
2
2
|
|
3
|
-
The purpose of this gem is to allow
|
3
|
+
The purpose of this gem is to allow 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
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'net/http'
|
5
|
+
require 'open-uri'
|
6
|
+
require 'uri'
|
7
|
+
|
8
|
+
module Vtk
|
9
|
+
# Provides command analytics to VTK team
|
10
|
+
class Analytics
|
11
|
+
attr_reader :name, :args, :hostname
|
12
|
+
|
13
|
+
def initialize(name:, args: nil, hostname: nil)
|
14
|
+
@name = name
|
15
|
+
@args = args || ARGV.join('_')
|
16
|
+
@hostname = hostname || `hostname -f`.chomp
|
17
|
+
end
|
18
|
+
|
19
|
+
def log
|
20
|
+
return if ENV['CI'] || ENV['TEST'] || ENV['VTK_DISABLE_ANALYTICS']
|
21
|
+
|
22
|
+
Process.fork do
|
23
|
+
exit unless internet?
|
24
|
+
|
25
|
+
emit_point
|
26
|
+
rescue StandardError
|
27
|
+
false # Silently error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def emit_point
|
32
|
+
uri = URI.parse 'https://dev.va.gov/_vfs/vtk-analytics/record'
|
33
|
+
Net::HTTP.start uri.host, uri.port, use_ssl: uri.scheme == 'https' do |http|
|
34
|
+
request = Net::HTTP::Post.new uri, 'Content-Type' => 'application/json'
|
35
|
+
request.body = { series: [point] }.to_json
|
36
|
+
http.request request
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def point
|
41
|
+
{
|
42
|
+
metric: 'vtk.command_executed',
|
43
|
+
type: 'count',
|
44
|
+
interval: 1,
|
45
|
+
tags: ["name:#{name}", "args:#{args}"],
|
46
|
+
host: hostname,
|
47
|
+
points: [[Time.now.utc.to_i, '1']]
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def internet?
|
52
|
+
true if URI.open 'http://www.google.com/'
|
53
|
+
rescue SocketError
|
54
|
+
false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/vtk/command.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'forwardable'
|
4
|
+
require 'vtk/analytics'
|
4
5
|
|
5
6
|
module Vtk
|
6
7
|
# Command class that all command inherit from
|
@@ -9,6 +10,11 @@ module Vtk
|
|
9
10
|
|
10
11
|
def_delegators :command, :run
|
11
12
|
|
13
|
+
def initialize
|
14
|
+
command_name = self.class.to_s.split('::').last(2).join('_').downcase
|
15
|
+
Vtk::Analytics.new(name: command_name).log
|
16
|
+
end
|
17
|
+
|
12
18
|
# Execute this command
|
13
19
|
#
|
14
20
|
# @api public
|
data/lib/vtk/version.rb
CHANGED
data/vtk.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = 'A CLI for the platform'
|
13
13
|
spec.description = 'This is a platform CLI tool for VFS developer usage.'
|
14
14
|
spec.homepage = 'https://github.com/department-of-veterans-affairs/vtk'
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
18
|
spec.metadata['documentation_uri'] = spec.homepage
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'pry', '~> 0.13.0'
|
35
35
|
spec.add_development_dependency 'rake', '~> 13.0.0'
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
37
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 1.8.0'
|
38
38
|
spec.add_development_dependency 'rubocop-rake', '~> 0.5.0'
|
39
39
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.0.0'
|
40
40
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vtk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.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
13
|
date: 2021-03-01 00:00:00.000000000 Z
|
@@ -88,14 +88,14 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 1.
|
91
|
+
version: 1.8.0
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 1.
|
98
|
+
version: 1.8.0
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: rubocop-rake
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- docs/design-doc.md
|
151
151
|
- exe/vtk
|
152
152
|
- lib/vtk.rb
|
153
|
+
- lib/vtk/analytics.rb
|
153
154
|
- lib/vtk/cli.rb
|
154
155
|
- lib/vtk/command.rb
|
155
156
|
- lib/vtk/commands/.gitkeep
|
@@ -174,7 +175,7 @@ metadata:
|
|
174
175
|
documentation_uri: https://github.com/department-of-veterans-affairs/vtk
|
175
176
|
source_code_uri: https://github.com/department-of-veterans-affairs/vtk
|
176
177
|
changelog_uri: https://github.com/department-of-veterans-affairs/vtk/blob/master/CHANGELOG.md
|
177
|
-
post_install_message:
|
178
|
+
post_install_message:
|
178
179
|
rdoc_options: []
|
179
180
|
require_paths:
|
180
181
|
- lib
|
@@ -182,15 +183,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
183
|
requirements:
|
183
184
|
- - ">="
|
184
185
|
- !ruby/object:Gem::Version
|
185
|
-
version: 2.
|
186
|
+
version: 2.5.0
|
186
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
188
|
requirements:
|
188
189
|
- - ">="
|
189
190
|
- !ruby/object:Gem::Version
|
190
191
|
version: '0'
|
191
192
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
193
|
-
signing_key:
|
193
|
+
rubygems_version: 3.2.1
|
194
|
+
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: A CLI for the platform
|
196
197
|
test_files: []
|