avmtrf1-tools 0.29.0 → 0.32.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/lib/avmtrf1/check_point/session.rb +10 -9
- data/lib/avmtrf1/esosti/instance/changed.rb +8 -5
- data/lib/avmtrf1/executables.rb +10 -2
- data/lib/avmtrf1/forponto/user/month.rb +1 -1
- data/lib/avmtrf1/inventario_sistemas.rb +40 -0
- data/lib/avmtrf1/inventario_sistemas/parser.rb +42 -0
- data/lib/avmtrf1/inventario_sistemas/parser/body.rb +27 -0
- data/lib/avmtrf1/inventario_sistemas/parser/body_row.rb +12 -0
- data/lib/avmtrf1/inventario_sistemas/parser/header.rb +38 -0
- data/lib/avmtrf1/inventario_sistemas/parser/header_column.rb +27 -0
- data/lib/avmtrf1/inventario_sistemas/site_build.rb +71 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base.rb +41 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base/elements.rb +54 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base/layout.rb +55 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base/stylesheet.css +57 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/index.rb +20 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/sistema.rb +62 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/sistemas_index.rb +31 -0
- data/lib/avmtrf1/patches/eac_launcher/git/base.rb +0 -15
- data/lib/avmtrf1/redmine/instance.rb +2 -1
- data/lib/avmtrf1/rest_provider/instance.rb +13 -55
- data/lib/avmtrf1/rest_provider/instance/issues.rb +30 -0
- data/lib/avmtrf1/rest_provider/request.rb +44 -0
- data/lib/avmtrf1/rest_provider/response.rb +77 -0
- data/lib/avmtrf1/tools/application.rb +13 -0
- data/lib/avmtrf1/tools/runner.rb +16 -26
- data/lib/avmtrf1/tools/runner/check_point.rb +1 -1
- data/lib/avmtrf1/tools/runner/check_point/login.rb +1 -1
- data/lib/avmtrf1/tools/runner/esosti.rb +1 -1
- data/lib/avmtrf1/tools/runner/esosti/changed.rb +7 -2
- data/lib/avmtrf1/tools/runner/esosti/fetch.rb +7 -2
- data/lib/avmtrf1/tools/runner/esosti/request.rb +88 -0
- data/lib/avmtrf1/tools/runner/forponto.rb +1 -1
- data/lib/avmtrf1/tools/runner/forponto/espelho.rb +1 -1
- data/lib/avmtrf1/tools/runner/forponto/marcacoes.rb +1 -1
- data/lib/avmtrf1/tools/runner/forponto/resumos.rb +1 -1
- data/lib/avmtrf1/tools/runner/forponto/saldo.rb +1 -1
- data/lib/avmtrf1/tools/runner/git.rb +1 -1
- data/lib/avmtrf1/tools/runner/git/issues_check.rb +1 -1
- data/lib/avmtrf1/tools/runner/git/push_large.rb +1 -1
- data/lib/avmtrf1/tools/runner/inventario_sistemas.rb +71 -0
- data/lib/avmtrf1/tools/runner/openvpn.rb +38 -0
- data/lib/avmtrf1/tools/runner/oracle.rb +1 -1
- data/lib/avmtrf1/tools/runner/oracle/query.rb +1 -1
- data/lib/avmtrf1/tools/runner/oracle/source_get.rb +1 -1
- data/lib/avmtrf1/tools/runner/oracle/user_clear.rb +1 -1
- data/lib/avmtrf1/tools/runner/php.rb +8 -15
- data/lib/avmtrf1/tools/runner/php/docker.rb +19 -29
- data/lib/avmtrf1/tools/runner/red.rb +1 -1
- data/lib/avmtrf1/tools/runner/trf1_dspace_base0.rb +1 -1
- data/lib/avmtrf1/tools/runner/trf1_dspace_base0/deploy.rb +3 -3
- data/lib/avmtrf1/tools/version.rb +1 -1
- data/lib/avmtrf1/trf1_dspace_base0/deploy.rb +3 -3
- metadata +56 -10
@@ -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
|
data/lib/avmtrf1/tools/runner.rb
CHANGED
@@ -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 '
|
5
|
+
require 'avmtrf1/tools/application'
|
6
|
+
require 'eac_ruby_base0/runner'
|
9
7
|
|
10
8
|
module Avmtrf1
|
11
9
|
module Tools
|
12
|
-
class Runner
|
13
|
-
|
14
|
-
include ::
|
15
|
-
|
16
|
-
|
17
|
-
Utilidades para AVM-TRF1 (http://redmine.trf1.gov.br/projects/avm-trf1).
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
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 =
|
32
|
-
|
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
|
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
|
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
|
11
|
+
class Runner
|
12
12
|
class Esosti < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
class Changed < ::EacRubyUtils::Console::DocoptRunner
|
14
14
|
enable_console_speaker
|
@@ -27,6 +27,7 @@ module Avmtrf1
|
|
27
27
|
|
28
28
|
def run
|
29
29
|
infov 'Time', time
|
30
|
+
infov 'URL', request.url
|
30
31
|
out data.to_yaml
|
31
32
|
end
|
32
33
|
|
@@ -34,7 +35,11 @@ module Avmtrf1
|
|
34
35
|
|
35
36
|
def data_uncached
|
36
37
|
infom 'Recuperando informações...'
|
37
|
-
|
38
|
+
request.response.body_data_or_raise
|
39
|
+
end
|
40
|
+
|
41
|
+
def request_uncached
|
42
|
+
context(:esosti_instance).changed_request(time)
|
38
43
|
end
|
39
44
|
|
40
45
|
def time
|
@@ -8,7 +8,7 @@ require 'avmtrf1/red/profile'
|
|
8
8
|
|
9
9
|
module Avmtrf1
|
10
10
|
module Tools
|
11
|
-
class Runner
|
11
|
+
class Runner
|
12
12
|
class Esosti < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
class Fetch < ::EacRubyUtils::Console::DocoptRunner
|
14
14
|
enable_console_speaker
|
@@ -26,15 +26,20 @@ module Avmtrf1
|
|
26
26
|
DOCOPT
|
27
27
|
|
28
28
|
def run
|
29
|
+
infov 'URL', request.url
|
29
30
|
fatal_error("Issue não encontrado: #{solicitacao_id}") unless issue
|
30
31
|
out issue.data.to_yaml
|
31
32
|
end
|
32
33
|
|
33
34
|
private
|
34
35
|
|
36
|
+
def request_uncached
|
37
|
+
context(:esosti_instance).issue_request(solicitacao_id)
|
38
|
+
end
|
39
|
+
|
35
40
|
def issue_uncached
|
36
41
|
infom "Recuperando informações de #{solicitacao_id}..."
|
37
|
-
|
42
|
+
request.response.body_data_or_raise
|
38
43
|
end
|
39
44
|
|
40
45
|
def solicitacao_id
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'avmtrf1/default_esosti'
|
6
|
+
require 'avmtrf1/ini'
|
7
|
+
require 'avmtrf1/red/profile'
|
8
|
+
|
9
|
+
module Avmtrf1
|
10
|
+
module Tools
|
11
|
+
class Runner
|
12
|
+
class Esosti < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
class Request < ::EacRubyUtils::Console::DocoptRunner
|
14
|
+
enable_console_speaker
|
15
|
+
enable_simple_cache
|
16
|
+
|
17
|
+
DOC = <<~DOCOPT
|
18
|
+
Requisições genéricas para e-Sosti (Control Desk).
|
19
|
+
|
20
|
+
Usage:
|
21
|
+
__PROGRAM__ [options] <url-suffix>
|
22
|
+
__PROGRAM__ -h | --help
|
23
|
+
|
24
|
+
Options:
|
25
|
+
-h --help Mostra esta ajuda.
|
26
|
+
-d --default Opções --json e --yaml.
|
27
|
+
-j --json Solicita resposta em JSON.
|
28
|
+
-x --xml Solicita resposta em XML.
|
29
|
+
-y --yaml Imprime saída em YAML.
|
30
|
+
DOCOPT
|
31
|
+
|
32
|
+
def run
|
33
|
+
start_banner
|
34
|
+
output_data
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def json?
|
40
|
+
options.fetch('--json') || options.fetch('--default')
|
41
|
+
end
|
42
|
+
|
43
|
+
def start_banner
|
44
|
+
infov 'URL', request.url
|
45
|
+
infom 'Recuperando informações...'
|
46
|
+
infov 'Response status', response.status
|
47
|
+
end
|
48
|
+
|
49
|
+
def output_data
|
50
|
+
if yaml?
|
51
|
+
out ::YAML.dump(response.body_data)
|
52
|
+
else
|
53
|
+
out response.body_str
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def request_uncached
|
58
|
+
context(:esosti_instance).request(url_suffix, request_headers)
|
59
|
+
end
|
60
|
+
|
61
|
+
def request_headers
|
62
|
+
r = {}
|
63
|
+
%w[json xml].each do |format|
|
64
|
+
r['Accept'] = "application/#{format}" if send("#{format}?")
|
65
|
+
end
|
66
|
+
r
|
67
|
+
end
|
68
|
+
|
69
|
+
def response_uncached
|
70
|
+
request.response
|
71
|
+
end
|
72
|
+
|
73
|
+
def url_suffix
|
74
|
+
options.fetch('<url-suffix>')
|
75
|
+
end
|
76
|
+
|
77
|
+
def xml?
|
78
|
+
options.fetch('--xml')
|
79
|
+
end
|
80
|
+
|
81
|
+
def yaml?
|
82
|
+
options.fetch('--yaml') || options.fetch('--default')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -9,7 +9,7 @@ require 'avmtrf1/forponto/user'
|
|
9
9
|
|
10
10
|
module Avmtrf1
|
11
11
|
module Tools
|
12
|
-
class Runner
|
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
|
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
|
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
|
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
|
9
|
+
class Runner
|
10
10
|
class Forponto < ::EacRubyUtils::Console::DocoptRunner
|
11
11
|
class Saldo < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
include ::EacRubyUtils::SimpleCache
|
@@ -7,7 +7,7 @@ require 'avmtrf1/git/cached_repository'
|
|
7
7
|
|
8
8
|
module Avmtrf1
|
9
9
|
module Tools
|
10
|
-
class Runner
|
10
|
+
class Runner
|
11
11
|
class Git < ::Avm::Tools::Runner::Git
|
12
12
|
class IssuesCheck < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
include ::EacRubyUtils::SimpleCache
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/tools/runner/check_point/login'
|
4
|
+
require 'avmtrf1/inventario_sistemas/parser'
|
5
|
+
require 'eac_cli/core_ext'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Tools
|
9
|
+
class Runner
|
10
|
+
class InventarioSistemas
|
11
|
+
DEFAULT_OUTPUT_DIR = './inventario-sistemas'
|
12
|
+
|
13
|
+
runner_with :help do
|
14
|
+
desc 'Formata a planilha de inventário de sistemas do TRF1.'
|
15
|
+
bool_opt '-w', '--overwrite', 'Sobreescreve diretório de saída se já existir.'
|
16
|
+
arg_opt '-d', '--output-directory', "Diretório de saída [default: #{DEFAULT_OUTPUT_DIR}]."
|
17
|
+
pos_arg 'source-file-path'
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
start_banner
|
22
|
+
prepare
|
23
|
+
build
|
24
|
+
end_banner
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def end_banner
|
30
|
+
success "Aplicação gerada em #{output_directory}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def build
|
34
|
+
site_build.run
|
35
|
+
end
|
36
|
+
|
37
|
+
def input_file_uncached
|
38
|
+
parsed.source_file_path.to_pathname.expand_path
|
39
|
+
end
|
40
|
+
|
41
|
+
def site_build_uncached
|
42
|
+
::Avmtrf1::InventarioSistemas::SiteBuild.new(input_file, output_directory)
|
43
|
+
end
|
44
|
+
|
45
|
+
def output_directory_uncached
|
46
|
+
parsed.output_directory.if_present(DEFAULT_OUTPUT_DIR).to_pathname.expand_path
|
47
|
+
end
|
48
|
+
|
49
|
+
def overwrite?
|
50
|
+
parsed.overwrite?
|
51
|
+
end
|
52
|
+
|
53
|
+
def start_banner
|
54
|
+
infov 'Arquivo de entrada', input_file
|
55
|
+
infov 'Diretório de saída', output_directory
|
56
|
+
end
|
57
|
+
|
58
|
+
def prepare
|
59
|
+
return unless output_directory.exist?
|
60
|
+
|
61
|
+
if overwrite?
|
62
|
+
infom "Removendo \"#{output_directory}\"..."
|
63
|
+
::FileUtils.rm_r(output_directory.to_path)
|
64
|
+
else
|
65
|
+
fatal_error "#{output_directory}: já existe (Utilize --overwrite para sobreescrever)"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/executables'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Openvpn
|
10
|
+
runner_with :help do
|
11
|
+
desc 'Conecta-se utilizando OpenVPN com configurações dinâmicas.'
|
12
|
+
bool_opt '-S', '--no-sudo', 'Não executa com "sudo".'
|
13
|
+
pos_arg :ovpn_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
infov 'Arquivo de configuração', parsed.ovpn_path
|
18
|
+
infov 'Linha de comando', ::Shellwords.join(command.args)
|
19
|
+
infov 'Resultado', command.system
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def command_uncached
|
25
|
+
if parsed.no_sudo?
|
26
|
+
::Avmtrf1::Executables.env.command(*openvpn_args)
|
27
|
+
else
|
28
|
+
::Avmtrf1::Executables.sudo.command(*openvpn_args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def openvpn_args
|
33
|
+
['openvpn', '--config', parsed.ovpn_path]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|