vtk 0.1.0 → 0.2.4

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
- SHA256:
3
- metadata.gz: 548575ce6bef53e2e3e617e8151e056879c569821d24cdcb0c9ab1ded7cde684
4
- data.tar.gz: 1a087c94d0c2f30076cbd312c020a59dcc995185a4cf5a658a9fe3fd35adde45
2
+ SHA1:
3
+ metadata.gz: 5233e958125b2b2387bd0fd51485a07a56ea69a5
4
+ data.tar.gz: cb51fdfa129f514c7b799cf145838b1f91e8c24d
5
5
  SHA512:
6
- metadata.gz: 9772f4461e30d1fb40da791790c851aada39362d18dff6d9b903ad45a2b35017201066c724397a99175d923f2aa4940563b6af65c360f86920e826fdcd51944d
7
- data.tar.gz: 63a40c81a3f42214db2a46cc9ccd68a562ce570c5b1557a5d9937f156ad850ea7ec98774c481ed18f759e05b71d29da9396ac9b581e9267437405537096a6674
6
+ metadata.gz: 8bf07839d51f19dbf77c61f6fc7323fba5fc90b39cf1aebc859b650e0334ec11d2e9d4fa5c430c2c528b8ef70107b22bc02eeb7b0a26b09a20ca96f1ca6e84d6
7
+ data.tar.gz: f412acad46d4c3c540213634bed1d36527af8084470f9f8d15110b6660cdecf11625ba35e0c84ca37428d7ed09e27ea3b3234dd87170f381daf8753bd53b8976
@@ -3,3 +3,7 @@ AllCops:
3
3
 
4
4
  Layout/LineLength:
5
5
  Max: 120
6
+
7
+ Metrics/BlockLength:
8
+ Exclude:
9
+ - 'spec/integration/module_spec.rb'
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,30 @@ 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 *<module name>*. This will build out a directory structure and create necessary files in the `modules/` directory.
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
35
+ $ vtk module -h
36
+
37
+ ### Docker
38
+
39
+ If using the vtk gem in Docker, you may first need to run the following commands to avoid any errors:
40
+
41
+ $ make docker-clean
42
+ $ make build
43
+ $ make bash
@@ -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
- `rails g module #{name}`
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
+ system("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_model(name)
26
+ system("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_serializer(name)
26
+ system("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_service(name)
26
+ system("rails g module_component #{name} service")
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vtk
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.4'
5
5
  end
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.1.0
4
+ version: 0.2.4
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-01-05 00:00:00.000000000 Z
13
+ date: 2021-01-26 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
@@ -138,7 +142,7 @@ metadata:
138
142
  homepage_uri: https://github.com/department-of-veterans-affairs/vsp-toolkit
139
143
  source_code_uri: https://github.com/department-of-veterans-affairs/vsp-toolkit
140
144
  changelog_uri: https://github.com/department-of-veterans-affairs/vsp-toolkit/blob/master/CHANGELOG.md
141
- post_install_message:
145
+ post_install_message:
142
146
  rdoc_options: []
143
147
  require_paths:
144
148
  - lib
@@ -153,8 +157,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
157
  - !ruby/object:Gem::Version
154
158
  version: '0'
155
159
  requirements: []
156
- rubygems_version: 3.0.8
157
- signing_key:
160
+ rubyforge_project:
161
+ rubygems_version: 2.6.14.3
162
+ signing_key:
158
163
  specification_version: 4
159
164
  summary: A CLI for the VSP platform
160
165
  test_files: []