vtk 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/README.md +17 -2
- data/lib/vtk/commands/module.rb +48 -0
- data/lib/vtk/commands/module/add.rb +6 -1
- data/lib/vtk/commands/module/controller.rb +31 -0
- data/lib/vtk/commands/module/model.rb +31 -0
- data/lib/vtk/commands/module/serializer.rb +31 -0
- data/lib/vtk/commands/module/service.rb +31 -0
- data/lib/vtk/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7583033a5831dfb0161f71d5ab8721382be7412148ab1d9c226586b14f79105
|
4
|
+
data.tar.gz: 3fabac91fa94bbedd1b33234ec76b2f21d9caaa5b7ec1d8f735d0395f7b28870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f4d8d91956e7e0bfd3bbe01cfee7cd83ffedfd1b163b708f633c5346c27ff4ed41c9674f22c39e17b9b2a14e808443987e99f184c02d3de5a749a033f97c674
|
7
|
+
data.tar.gz: 0d04131d2c1de00edfd0a09196d7ef15f38651837870b2e1b24bf070deb84144f9845bcd344b34494aac686ba3088e8dd40be6e61fd3dc1f4304a0160274188d
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
The purpose of this gem is to allow VFS engineers to quickly begin developing on the platform. 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
|
-
*The following assumes you have Ruby 2.6.6 or higher installed
|
5
|
+
*The following assumes you have Ruby 2.6.6 or higher installed*
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -14,6 +14,21 @@ Install it yourself as:
|
|
14
14
|
|
15
15
|
### Modules
|
16
16
|
|
17
|
-
Teams developing for vets-api should create their code as a module. This allows for the separation and easy identification of different projects. To scaffold a directory structure for your module, first cd into the vets-api directory, then enter the command below, substituting the name of your module for
|
17
|
+
Teams developing for vets-api should create their code as a module. This allows for the separation and easy identification of different projects. To scaffold a directory structure for your module, first cd into the vets-api directory, then enter the command below, substituting the name of your module for `<module name>`. This will build out a directory structure and create necessary files in the `modules/` directory.
|
18
18
|
|
19
19
|
$ vtk module add <module name>
|
20
|
+
|
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 module for *<module name>*
|
22
|
+
|
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
|
+
|
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
|
+
### Help
|
31
|
+
|
32
|
+
For helpful information about commands and subcommands run the following:
|
33
|
+
|
34
|
+
$ vtk -h
|
data/lib/vtk/commands/module.rb
CHANGED
@@ -8,6 +8,54 @@ module Vtk
|
|
8
8
|
class Module < Thor
|
9
9
|
namespace :module
|
10
10
|
|
11
|
+
desc 'service <module name>', 'Add new service class to a module in vets-api'
|
12
|
+
method_option :help, aliases: '-h', type: :boolean,
|
13
|
+
desc: 'Display usage information'
|
14
|
+
def service(name)
|
15
|
+
if options[:help]
|
16
|
+
invoke :help, ['service']
|
17
|
+
else
|
18
|
+
require_relative 'module/service'
|
19
|
+
Vtk::Commands::Module::Service.new(name, options).execute
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'serializer <module name>', 'Add new serializer to a module in vets-api'
|
24
|
+
method_option :help, aliases: '-h', type: :boolean,
|
25
|
+
desc: 'Display usage information'
|
26
|
+
def serializer(name)
|
27
|
+
if options[:help]
|
28
|
+
invoke :help, ['serializer']
|
29
|
+
else
|
30
|
+
require_relative 'module/serializer'
|
31
|
+
Vtk::Commands::Module::Serializer.new(name, options).execute
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'model <module name>', 'Add new model to a module in vets-api'
|
36
|
+
method_option :help, aliases: '-h', type: :boolean,
|
37
|
+
desc: 'Display usage information'
|
38
|
+
def model(name)
|
39
|
+
if options[:help]
|
40
|
+
invoke :help, ['model']
|
41
|
+
else
|
42
|
+
require_relative 'module/model'
|
43
|
+
Vtk::Commands::Module::Model.new(name, options).execute
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'controller <module name>', 'Add new controller to a module in vets-api'
|
48
|
+
method_option :help, aliases: '-h', type: :boolean,
|
49
|
+
desc: 'Display usage information'
|
50
|
+
def controller(name)
|
51
|
+
if options[:help]
|
52
|
+
invoke :help, ['controller']
|
53
|
+
else
|
54
|
+
require_relative 'module/controller'
|
55
|
+
Vtk::Commands::Module::Controller.new(name, options).execute
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
11
59
|
desc 'add <module name>', 'Add a new module to vets-api'
|
12
60
|
method_option :help, aliases: '-h', type: :boolean,
|
13
61
|
desc: 'Display usage information'
|
@@ -23,7 +23,12 @@ module Vtk
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def create_module(name)
|
26
|
-
|
26
|
+
# create a new module from the vets-api generator
|
27
|
+
if `gem which rails` == ''
|
28
|
+
output.puts 'Please install Rails - This command runs a Rails generator and Rails is a dependency of vtk'
|
29
|
+
else
|
30
|
+
system("rails g module #{name}")
|
31
|
+
end
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../command'
|
4
|
+
|
5
|
+
module Vtk
|
6
|
+
module Commands
|
7
|
+
class Module
|
8
|
+
# Adds a new module controller to vets-api
|
9
|
+
class Controller < Vtk::Command
|
10
|
+
attr_accessor :name, :options
|
11
|
+
|
12
|
+
def initialize(name, options)
|
13
|
+
@name = name
|
14
|
+
@options = options
|
15
|
+
|
16
|
+
super()
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute(_input: $stdin, _output: $stdout)
|
20
|
+
create_controller(name)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def create_controller(name)
|
26
|
+
`rails g module_component #{name} controller`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../command'
|
4
|
+
|
5
|
+
module Vtk
|
6
|
+
module Commands
|
7
|
+
class Module
|
8
|
+
# Adds a new module model to vets-api
|
9
|
+
class Model < Vtk::Command
|
10
|
+
attr_accessor :name, :options
|
11
|
+
|
12
|
+
def initialize(name, options)
|
13
|
+
@name = name
|
14
|
+
@options = options
|
15
|
+
|
16
|
+
super()
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute(_input: $stdin, _output: $stdout)
|
20
|
+
create_model(name)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def create_controller(name)
|
26
|
+
`rails g module_component #{name} model`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../command'
|
4
|
+
|
5
|
+
module Vtk
|
6
|
+
module Commands
|
7
|
+
class Module
|
8
|
+
# Adds a new module serializer to vets-api
|
9
|
+
class Serializer < Vtk::Command
|
10
|
+
attr_accessor :name, :options
|
11
|
+
|
12
|
+
def initialize(name, options)
|
13
|
+
@name = name
|
14
|
+
@options = options
|
15
|
+
|
16
|
+
super()
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute(_input: $stdin, _output: $stdout)
|
20
|
+
create_serializer(name)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def create_controller(name)
|
26
|
+
`rails g module_component #{name} serializer`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../command'
|
4
|
+
|
5
|
+
module Vtk
|
6
|
+
module Commands
|
7
|
+
class Module
|
8
|
+
# Adds a new module service class to vets-api
|
9
|
+
class Service < Vtk::Command
|
10
|
+
attr_accessor :name, :options
|
11
|
+
|
12
|
+
def initialize(name, options)
|
13
|
+
@name = name
|
14
|
+
@options = options
|
15
|
+
|
16
|
+
super()
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute(_input: $stdin, _output: $stdout)
|
20
|
+
create_service(name)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def create_controller(name)
|
26
|
+
`rails g module_component #{name} service`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/vtk/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.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-01-
|
13
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -127,6 +127,10 @@ files:
|
|
127
127
|
- lib/vtk/commands/.gitkeep
|
128
128
|
- lib/vtk/commands/module.rb
|
129
129
|
- lib/vtk/commands/module/add.rb
|
130
|
+
- lib/vtk/commands/module/controller.rb
|
131
|
+
- lib/vtk/commands/module/model.rb
|
132
|
+
- lib/vtk/commands/module/serializer.rb
|
133
|
+
- lib/vtk/commands/module/service.rb
|
130
134
|
- lib/vtk/templates/.gitkeep
|
131
135
|
- lib/vtk/templates/module/add/.gitkeep
|
132
136
|
- lib/vtk/version.rb
|