avmtrf1-tools 0.30.0 → 0.32.1

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avmtrf1/check_point/session.rb +10 -9
  3. data/lib/avmtrf1/executables.rb +10 -2
  4. data/lib/avmtrf1/forponto/user/month.rb +1 -1
  5. data/lib/avmtrf1/inventario_sistemas.rb +40 -0
  6. data/lib/avmtrf1/inventario_sistemas/parser.rb +42 -0
  7. data/lib/avmtrf1/inventario_sistemas/parser/body.rb +27 -0
  8. data/lib/avmtrf1/inventario_sistemas/parser/body_row.rb +12 -0
  9. data/lib/avmtrf1/inventario_sistemas/parser/header.rb +38 -0
  10. data/lib/avmtrf1/inventario_sistemas/parser/header_column.rb +27 -0
  11. data/lib/avmtrf1/inventario_sistemas/site_build.rb +71 -0
  12. data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base.rb +41 -0
  13. data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base/elements.rb +54 -0
  14. data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base/layout.rb +55 -0
  15. data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base/stylesheet.css +57 -0
  16. data/lib/avmtrf1/inventario_sistemas/site_build/index.rb +20 -0
  17. data/lib/avmtrf1/inventario_sistemas/site_build/sistema.rb +62 -0
  18. data/lib/avmtrf1/inventario_sistemas/site_build/sistemas_index.rb +31 -0
  19. data/lib/avmtrf1/patches/eac_launcher/git/base.rb +0 -15
  20. data/lib/avmtrf1/tools/application.rb +13 -0
  21. data/lib/avmtrf1/tools/runner.rb +16 -26
  22. data/lib/avmtrf1/tools/runner/check_point.rb +1 -1
  23. data/lib/avmtrf1/tools/runner/check_point/login.rb +1 -1
  24. data/lib/avmtrf1/tools/runner/esosti.rb +1 -1
  25. data/lib/avmtrf1/tools/runner/esosti/changed.rb +1 -1
  26. data/lib/avmtrf1/tools/runner/esosti/fetch.rb +1 -1
  27. data/lib/avmtrf1/tools/runner/esosti/request.rb +1 -1
  28. data/lib/avmtrf1/tools/runner/forponto.rb +1 -1
  29. data/lib/avmtrf1/tools/runner/forponto/espelho.rb +1 -1
  30. data/lib/avmtrf1/tools/runner/forponto/marcacoes.rb +1 -1
  31. data/lib/avmtrf1/tools/runner/forponto/resumos.rb +1 -1
  32. data/lib/avmtrf1/tools/runner/forponto/saldo.rb +1 -1
  33. data/lib/avmtrf1/tools/runner/git.rb +1 -1
  34. data/lib/avmtrf1/tools/runner/git/issues_check.rb +1 -1
  35. data/lib/avmtrf1/tools/runner/git/push_large.rb +1 -1
  36. data/lib/avmtrf1/tools/runner/inventario_sistemas.rb +71 -0
  37. data/lib/avmtrf1/tools/runner/openvpn.rb +38 -0
  38. data/lib/avmtrf1/tools/runner/oracle.rb +1 -1
  39. data/lib/avmtrf1/tools/runner/oracle/query.rb +1 -1
  40. data/lib/avmtrf1/tools/runner/oracle/source_get.rb +1 -1
  41. data/lib/avmtrf1/tools/runner/oracle/user_clear.rb +1 -1
  42. data/lib/avmtrf1/tools/runner/php.rb +8 -15
  43. data/lib/avmtrf1/tools/runner/php/docker.rb +19 -29
  44. data/lib/avmtrf1/tools/runner/red.rb +1 -1
  45. data/lib/avmtrf1/tools/runner/trf1_dspace_base0.rb +1 -1
  46. data/lib/avmtrf1/tools/runner/trf1_dspace_base0/deploy.rb +3 -3
  47. data/lib/avmtrf1/tools/version.rb +1 -1
  48. data/lib/avmtrf1/trf1_dspace_base0/deploy.rb +3 -3
  49. data/template/avmtrf1/php/docker_image/Dockerfile.template +4 -1
  50. metadata +52 -10
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ class InventarioSistemas
5
+ class SiteBuild
6
+ class HtmlPageBase
7
+ module Layout
8
+ def metadata_info
9
+ "<div class='input_metadata'>" \
10
+ "Extraído de <strong>#{site.input_file.basename}</strong>." \
11
+ '</div>'
12
+ end
13
+
14
+ def output_body
15
+ <<HTML
16
+ <body><div id="top">
17
+ #{output_navbar}
18
+ <h1>#{site_title}</h1>
19
+ #{metadata_info}
20
+ </div><div id="inner">
21
+ <h2>#{title}</h2>
22
+ #{output_inner_content}
23
+ </div></body>
24
+ HTML
25
+ end
26
+
27
+ def output_content
28
+ "<html>\n" + output_header + output_body + '</html>'
29
+ end
30
+
31
+ def output_header
32
+ <<HTML
33
+ <head>
34
+ <meta charset="UTF-8">
35
+ <title>#{site_title} - #{title}</title>
36
+ <style>
37
+ #{::File.read(::File.join(__dir__, 'stylesheet.css'))}
38
+ </style>
39
+ </head>
40
+ HTML
41
+ end
42
+
43
+ def output_navbar
44
+ '<nav>' + output_navbar_path(false) + '</nav>'
45
+ end
46
+
47
+ def output_navbar_path(links)
48
+ (parent.present? ? parent.output_navbar_path(true) + NAVBAR_SEPARATOR : '') +
49
+ (links ? self_html_link : title)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,57 @@
1
+ body, #top, #top * {
2
+ padding: 0;
3
+ margin: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ #top * {
8
+ padding: 0.3em;
9
+ }
10
+
11
+ #inner {
12
+ margin: 0.3em;
13
+ }
14
+
15
+ nav {
16
+ padding: 0.2em;
17
+ }
18
+
19
+ a {
20
+ color: blue;
21
+ }
22
+
23
+ a:visited {
24
+ color: darkblue;
25
+ }
26
+
27
+ h1 {
28
+ text-align: right;
29
+ background-color: lightyellow;
30
+ }
31
+
32
+ .input_metadata {
33
+ text-align: right;
34
+ background-color: lightblue;
35
+ }
36
+
37
+ table {
38
+ border: thin solid black;
39
+ border-collapse: collapse;
40
+ }
41
+
42
+ .odd {
43
+ background-color: lightgray;
44
+ }
45
+
46
+ td, th {
47
+ border-left: thin solid black;
48
+ }
49
+
50
+ th {
51
+ border-bottom: thin solid black;
52
+ }
53
+
54
+ nav, nav a, nav a:visited, th {
55
+ background-color: black;
56
+ color: white;
57
+ }
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avmtrf1/inventario_sistemas/site_build/html_page_base'
5
+
6
+ module Avmtrf1
7
+ class InventarioSistemas
8
+ class SiteBuild
9
+ class Index < ::Avmtrf1::InventarioSistemas::SiteBuild::HtmlPageBase
10
+ def output_inner_content
11
+ ['<ul>', "<li>#{site.sistemas_index.self_html_link}</li>", '</ul>'].join("\n")
12
+ end
13
+
14
+ def title
15
+ 'Índice'
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avmtrf1/inventario_sistemas/parser/header_column'
5
+ require 'avmtrf1/inventario_sistemas/site_build/html_page_base'
6
+
7
+ module Avmtrf1
8
+ class InventarioSistemas
9
+ class SiteBuild
10
+ class Sistema < ::Avmtrf1::InventarioSistemas::SiteBuild::HtmlPageBase
11
+ attr_reader :raw_row
12
+
13
+ def initialize(site, parent, raw_row)
14
+ super(site, parent)
15
+ @raw_row = raw_row
16
+ end
17
+
18
+ def id
19
+ nome.parameterize
20
+ end
21
+
22
+ def gestor
23
+ column_value('gestor na jf1', 'unidade')
24
+ end
25
+
26
+ def nome
27
+ column_value('sistema', 'sigla')
28
+ end
29
+
30
+ def producao
31
+ html_linkfy(column_value('ambientes', 'produção – serv. ap'))
32
+ end
33
+
34
+ def responsavel
35
+ %w[unidade seção nome]
36
+ .map { |sub| column_value('responsável pelo desenvolvimento', sub) }
37
+ .reject(&:blank?).join(' » ')
38
+ end
39
+
40
+ def output_inner_content
41
+ column_values = site.parser.header_columns.map { |c| [c.key, column_value(c)] }
42
+ '<h3>Detalhes</h3>' + html_table(%w[Campo Valor], column_values)
43
+ end
44
+
45
+ def title
46
+ nome
47
+ end
48
+
49
+ def column_value(main, sub = nil)
50
+ column = if main.is_a?(::Avmtrf1::InventarioSistemas::Parser::HeaderColumn)
51
+ main
52
+ else
53
+ site.column(main, sub)
54
+ end
55
+ raise 'Out of bound' if column.index >= raw_row.count
56
+
57
+ raw_row[column.index]
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avmtrf1/inventario_sistemas/site_build/html_page_base'
5
+
6
+ module Avmtrf1
7
+ class InventarioSistemas
8
+ class SiteBuild
9
+ class SistemasIndex < ::Avmtrf1::InventarioSistemas::SiteBuild::HtmlPageBase
10
+ def output_inner_content
11
+ output_count + output_list
12
+ end
13
+
14
+ def title
15
+ 'Sistemas'
16
+ end
17
+
18
+ def output_count
19
+ "<p>Quantidade: #{site.sistemas.count}</p>"
20
+ end
21
+
22
+ def output_list
23
+ html_table(
24
+ %w[Nome Produção Responsável Gestor],
25
+ site.sistemas.map { |s| [s.self_html_link, s.producao, s.responsavel, s.gestor] }
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -16,21 +16,6 @@ module Avmtrf1
16
16
  end
17
17
 
18
18
  module InstanceMethods
19
- def execute(*args)
20
- args, options = build_args(args)
21
- ::EacRubyUtils::Envs.local.command(*args).execute(options)
22
- end
23
-
24
- def system(*args)
25
- args, options = build_args(args)
26
- ::EacRubyUtils::Envs.local.command(*args).system(options)
27
- end
28
-
29
- def command(*args)
30
- args, _options = build_args(args)
31
- ::EacRubyUtils::Envs.local.command(*args)
32
- end
33
-
34
19
  def status_files
35
20
  execute!('-c', 'core.quotepath=off', 'status', '--porcelain').each_line.map do |line|
36
21
  parse_status_file(line)
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/application'
4
+
5
+ module Avmtrf1
6
+ module Tools
7
+ class << self
8
+ def application
9
+ @application ||= ::EacRubyBase0::Application.new(::File.expand_path('../../..', __dir__))
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,39 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'aranha/selenium/driver_factory/base'
4
- require 'eac_ruby_utils/console/docopt_runner'
5
- require 'eac_ruby_utils/require_sub'
6
- require 'avmtrf1/tools/version'
7
4
  require 'avmtrf1/ruby/gems/not_found_error'
8
- require 'eac_ruby_utils/console/speaker'
5
+ require 'avmtrf1/tools/application'
6
+ require 'eac_ruby_base0/runner'
9
7
 
10
8
  module Avmtrf1
11
9
  module Tools
12
- class Runner < ::EacRubyUtils::Console::DocoptRunner
13
- ::EacRubyUtils.require_sub(__FILE__)
14
- include ::EacRubyUtils::Console::Speaker
15
-
16
- DOC = <<~DOCOPT
17
- Utilidades para AVM-TRF1 (http://redmine.trf1.gov.br/projects/avm-trf1).
18
-
19
- Usage:
20
- __PROGRAM__ [options] __SUBCOMMANDS__
21
- __PROGRAM__ -h | --help
22
- __PROGRAM__ --version
10
+ class Runner
11
+ require_sub __FILE__
12
+ include ::EacRubyBase0::Runner
13
+
14
+ runner_definition do
15
+ desc 'Utilidades para AVM-TRF1 (http://redmine.trf1.gov.br/projects/avm-trf1).'
16
+ bool_opt '-H', '--headless',
17
+ 'Quando usando Selenium não mostra a interface gráfica do navegador web.'
18
+ end
23
19
 
24
- Options:
25
- -h --help Show this screen.
26
- -v --version Show version.
27
- -H --headless Quando usando Selenium não mostra a interface gráfica do navegador web.
28
- DOCOPT
20
+ def application
21
+ ::Avmtrf1::Tools.application
22
+ end
29
23
 
30
24
  def run
31
- ::Aranha::Selenium::DriverFactory::Base.default_headless = options.fetch('--headless')
32
- if options.fetch('--version')
33
- out(::Avmtrf1::Tools::VERSION + "\n")
34
- else
35
- run_with_subcommand
36
- end
25
+ ::Aranha::Selenium::DriverFactory::Base.default_headless = parsed.headless?
26
+ super
37
27
  rescue ::Avmtrf1::Ruby::Gems::NotFoundError => e
38
28
  on_gem_not_found(e.dependency)
39
29
  end
@@ -5,7 +5,7 @@ require 'avmtrf1/tools/runner/check_point/login'
5
5
 
6
6
  module Avmtrf1
7
7
  module Tools
8
- class Runner < ::EacRubyUtils::Console::DocoptRunner
8
+ class Runner
9
9
  class CheckPoint < ::EacRubyUtils::Console::DocoptRunner
10
10
  DOC = <<~DOCOPT
11
11
  Utilidades para Check Point (https://cp.trf1.jus.br).
@@ -8,7 +8,7 @@ require 'avmtrf1/check_point/session'
8
8
 
9
9
  module Avmtrf1
10
10
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class Runner
12
12
  class CheckPoint < ::EacRubyUtils::Console::DocoptRunner
13
13
  class Login < ::EacRubyUtils::Console::DocoptRunner
14
14
  include ::EacRubyUtils::SimpleCache
@@ -8,7 +8,7 @@ require 'avmtrf1/red/profile'
8
8
 
9
9
  module Avmtrf1
10
10
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class Runner
12
12
  class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
13
  require_sub __FILE__
14
14
  enable_console_speaker
@@ -8,7 +8,7 @@ require 'avmtrf1/red/profile'
8
8
 
9
9
  module Avmtrf1
10
10
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class Runner
12
12
  class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
13
  class Changed < ::EacRubyUtils::Console::DocoptRunner
14
14
  enable_console_speaker
@@ -8,7 +8,7 @@ require 'avmtrf1/red/profile'
8
8
 
9
9
  module Avmtrf1
10
10
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class Runner
12
12
  class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
13
  class Fetch < ::EacRubyUtils::Console::DocoptRunner
14
14
  enable_console_speaker
@@ -8,7 +8,7 @@ require 'avmtrf1/red/profile'
8
8
 
9
9
  module Avmtrf1
10
10
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class Runner
12
12
  class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
13
  class Request < ::EacRubyUtils::Console::DocoptRunner
14
14
  enable_console_speaker
@@ -9,7 +9,7 @@ require 'avmtrf1/forponto/user'
9
9
 
10
10
  module Avmtrf1
11
11
  module Tools
12
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
+ class Runner
13
13
  class Forponto < ::EacRubyUtils::Console::DocoptRunner
14
14
  include ::EacRubyUtils::SimpleCache
15
15
  include ::EacRubyUtils::Console::Speaker
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/simple_cache'
6
6
 
7
7
  module Avmtrf1
8
8
  module Tools
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
+ class Runner
10
10
  class Forponto < ::EacRubyUtils::Console::DocoptRunner
11
11
  class Espelho < ::EacRubyUtils::Console::DocoptRunner
12
12
  include ::EacRubyUtils::SimpleCache
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
6
6
 
7
7
  module Avmtrf1
8
8
  module Tools
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
+ class Runner
10
10
  class Forponto < ::EacRubyUtils::Console::DocoptRunner
11
11
  class Marcacoes < ::EacRubyUtils::Console::DocoptRunner
12
12
  enable_console_speaker
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/simple_cache'
6
6
 
7
7
  module Avmtrf1
8
8
  module Tools
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
+ class Runner
10
10
  class Forponto < ::EacRubyUtils::Console::DocoptRunner
11
11
  class Resumos < ::EacRubyUtils::Console::DocoptRunner
12
12
  include ::EacRubyUtils::SimpleCache
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/simple_cache'
6
6
 
7
7
  module Avmtrf1
8
8
  module Tools
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
+ class Runner
10
10
  class Forponto < ::EacRubyUtils::Console::DocoptRunner
11
11
  class Saldo < ::EacRubyUtils::Console::DocoptRunner
12
12
  include ::EacRubyUtils::SimpleCache
@@ -8,7 +8,7 @@ require 'avmtrf1/patches/avm/git/issue/complete'
8
8
 
9
9
  module Avmtrf1
10
10
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class Runner
12
12
  class Git < ::Avm::Tools::Runner::Git
13
13
  end
14
14
  end