avmtrf1-tools 0.31.0 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avmtrf1/check_point/session.rb +10 -9
- data/lib/avmtrf1/executables.rb +10 -2
- data/lib/avmtrf1/forponto/user/month.rb +1 -1
- data/lib/avmtrf1/openvpn/config/builder.rb +59 -0
- data/lib/avmtrf1/openvpn/config/parser.rb +20 -0
- data/lib/avmtrf1/openvpn/config/parser/builder.rb +62 -0
- data/lib/avmtrf1/openvpn/config/parser/line.rb +47 -0
- data/lib/avmtrf1/openvpn/config/parser/simple.rb +27 -0
- data/lib/avmtrf1/openvpn/config/parser/tag.rb +39 -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 +1 -1
- data/lib/avmtrf1/tools/runner/esosti/fetch.rb +1 -1
- data/lib/avmtrf1/tools/runner/esosti/request.rb +1 -1
- 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 +7 -9
- data/lib/avmtrf1/tools/runner/openvpn.rb +91 -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
- data/template/avmtrf1/php/docker_image/Dockerfile.template +4 -1
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28aaea569505102ad3211b02ec77cf0c2b290acc629b3530190acf0603f289d1
|
4
|
+
data.tar.gz: 755924e206af72290f5958622a20a545cf925882b4ebc6a8c1e5fc7821bbe6ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767c2478bcc066672821f52114c903f4bf6e30f44b6a1a746c045cce80c33b8589f1fc36051b33009fc02318ff6971b15cc039cc9aad7b725ea93a291a5aa563
|
7
|
+
data.tar.gz: 382e3a8930764a843005e9c24a2f8e9f1cb3deb89886433ed34bcfa40996aaf2a57324c8e61a146cb1834810dff2deeb4fc13fddbb53eb8fbc75610fab557f43
|
@@ -2,10 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'avmtrf1/ad_user'
|
4
4
|
require 'avmtrf1/check_point/session/login'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
5
6
|
|
6
7
|
module Avmtrf1
|
7
8
|
module CheckPoint
|
8
9
|
class Session
|
10
|
+
enable_simple_cache
|
11
|
+
|
9
12
|
ROOT_URL = 'https://cp.trf1.jus.br'
|
10
13
|
LOGIN_URL = "#{ROOT_URL}/connect/PortalMain"
|
11
14
|
LOGGED_TITLE_TEXT = 'Network Access Granted'
|
@@ -24,15 +27,7 @@ module Avmtrf1
|
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
def initialize(username, password, driver_options = {})
|
30
|
-
@username = username
|
31
|
-
@password = password
|
32
|
-
@session = ::Aranha::Selenium::Session.new(
|
33
|
-
driver_options.merge(accept_insecure_certs: true)
|
34
|
-
)
|
35
|
-
end
|
30
|
+
common_constructor :username, :password, :driver_options, default: [{}]
|
36
31
|
|
37
32
|
def logged?
|
38
33
|
session.navigate.to LOGIN_URL
|
@@ -54,6 +49,12 @@ module Avmtrf1
|
|
54
49
|
end
|
55
50
|
result_text
|
56
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def session_uncached
|
56
|
+
::Aranha::Selenium::Session.new(driver_options.merge(accept_insecure_certs: true))
|
57
|
+
end
|
57
58
|
end
|
58
59
|
end
|
59
60
|
end
|
data/lib/avmtrf1/executables.rb
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
3
5
|
module Avmtrf1
|
4
6
|
module Executables
|
5
7
|
class << self
|
8
|
+
enable_simple_cache
|
9
|
+
|
6
10
|
def env
|
7
11
|
::EacRubyUtils::Envs.local
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
private
|
15
|
+
|
16
|
+
%w[docker sudo].each do |program|
|
17
|
+
define_method(program.underscore + '_uncached') do
|
18
|
+
env.executable(program, '--version')
|
19
|
+
end
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/openvpn/config/parser'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/fs/temp'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Openvpn
|
9
|
+
module Config
|
10
|
+
class Builder
|
11
|
+
common_constructor :source_data do
|
12
|
+
unless source_data.is_a?(::Hash)
|
13
|
+
self.source_data = ::Avmtrf1::Openvpn::Config::Parser.new(source_data.to_s).data
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def data
|
18
|
+
[simple, tags].reject(&:blank?).join("\n")
|
19
|
+
end
|
20
|
+
|
21
|
+
def on_data_file
|
22
|
+
::EacRubyUtils::Fs::Temp.on_file do |file|
|
23
|
+
file.write(data)
|
24
|
+
yield(file)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def simple
|
29
|
+
source_data.fetch(:simple)
|
30
|
+
.map { |s| ::Shellwords.join([s.fetch(:attribute)] + s.fetch(:args)) }
|
31
|
+
.map { |s| "#{s}\n" }.join
|
32
|
+
end
|
33
|
+
|
34
|
+
def simple_add_or_update(name, args)
|
35
|
+
new_data = { attribute: name, args: args }
|
36
|
+
s = simple_find(name)
|
37
|
+
if s
|
38
|
+
s.merge!(new_data)
|
39
|
+
else
|
40
|
+
source_data.fetch(:simple) << new_data
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def tags
|
45
|
+
source_data.fetch(:tags).map { |t| tag_to_data(t) }
|
46
|
+
end
|
47
|
+
|
48
|
+
def tag_to_data(tag)
|
49
|
+
["<#{tag.fetch(:name)}>", tag.fetch(:content), "</#{tag.fetch(:name)}>"]
|
50
|
+
.map { |v| "#{v}\n" }.join
|
51
|
+
end
|
52
|
+
|
53
|
+
def simple_find(name)
|
54
|
+
source_data.fetch(:simple).find { |s| s.fetch(:attribute) == name }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aranha/parsers/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Openvpn
|
8
|
+
module Config
|
9
|
+
class Parser < ::Aranha::Parsers::Base
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
def data
|
13
|
+
builder = ::Avmtrf1::Openvpn::Config::Parser::Builder.new
|
14
|
+
content.each_line { |line| builder.add_line(line) }
|
15
|
+
{ simple: builder.simple.map(&:data), tags: builder.tags.map(&:data) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/openvpn/config/parser/line'
|
4
|
+
require 'avmtrf1/openvpn/config/parser/simple'
|
5
|
+
require 'avmtrf1/openvpn/config/parser/tag'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Openvpn
|
9
|
+
module Config
|
10
|
+
class Parser < ::Aranha::Parsers::Base
|
11
|
+
class Builder
|
12
|
+
attr_reader :simple, :tags
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@simple = []
|
16
|
+
@tags = []
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_line(line_text)
|
20
|
+
line = ::Avmtrf1::Openvpn::Config::Parser::Line.new(line_text)
|
21
|
+
if on_tag?
|
22
|
+
add_line_on_tag(line)
|
23
|
+
else
|
24
|
+
add_line_not_on_tag(line)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_line_on_tag(line)
|
29
|
+
if line.close_tag?
|
30
|
+
if line.tag_name != current_tag.name
|
31
|
+
raise("Closing tag \"#{line.tag_name}\" does not match current tag " \
|
32
|
+
"\"#{current_tag}\"")
|
33
|
+
end
|
34
|
+
|
35
|
+
current_tag.close
|
36
|
+
else
|
37
|
+
current_tag.add_line(line.text)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_line_not_on_tag(line)
|
42
|
+
return if line.blank_text?
|
43
|
+
|
44
|
+
if line.open_tag?
|
45
|
+
tags << ::Avmtrf1::Openvpn::Config::Parser::Tag.new(line.tag_name)
|
46
|
+
else
|
47
|
+
simple << ::Avmtrf1::Openvpn::Config::Parser::Simple.new(line.simple_parts)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def current_tag
|
52
|
+
tags.last
|
53
|
+
end
|
54
|
+
|
55
|
+
def on_tag?
|
56
|
+
tags.last.if_present(false, &:open?)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Openvpn
|
7
|
+
module Config
|
8
|
+
class Parser < ::Aranha::Parsers::Base
|
9
|
+
class Line
|
10
|
+
OPEN_TAG_PATTERN = /\A<(.+)>\z/.freeze
|
11
|
+
CLOSE_TAG_PATTERN = %r{\A</(.+)>\z}.freeze
|
12
|
+
SIMPLE_PATTERN = /\A(\S+)(?:\s+(\S.*))\z/.freeze
|
13
|
+
|
14
|
+
common_constructor :text do
|
15
|
+
self.text = text.rstrip
|
16
|
+
end
|
17
|
+
|
18
|
+
def simple_parts
|
19
|
+
::Shellwords.split(text)
|
20
|
+
end
|
21
|
+
|
22
|
+
def blank_text?
|
23
|
+
text.blank?
|
24
|
+
end
|
25
|
+
|
26
|
+
def open_tag?
|
27
|
+
OPEN_TAG_PATTERN.match?(text)
|
28
|
+
end
|
29
|
+
|
30
|
+
def close_tag?
|
31
|
+
CLOSE_TAG_PATTERN.match?(text)
|
32
|
+
end
|
33
|
+
|
34
|
+
def tag_name
|
35
|
+
if close_tag?
|
36
|
+
CLOSE_TAG_PATTERN.if_match(text) { |m| m[1] }
|
37
|
+
elsif open_tag?
|
38
|
+
OPEN_TAG_PATTERN.if_match(text) { |m| m[1] }
|
39
|
+
else
|
40
|
+
raise "Unmapped branch in #{__method__}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Openvpn
|
7
|
+
module Config
|
8
|
+
class Parser < ::Aranha::Parsers::Base
|
9
|
+
class Simple
|
10
|
+
common_constructor :parts
|
11
|
+
|
12
|
+
def data
|
13
|
+
{ attribute: attribute, args: args }
|
14
|
+
end
|
15
|
+
|
16
|
+
def attribute
|
17
|
+
parts.first
|
18
|
+
end
|
19
|
+
|
20
|
+
def args
|
21
|
+
parts[1..-1]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Openvpn
|
7
|
+
module Config
|
8
|
+
class Parser < ::Aranha::Parsers::Base
|
9
|
+
class Tag
|
10
|
+
common_constructor :name do
|
11
|
+
@open = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_line(text)
|
15
|
+
lines << text
|
16
|
+
end
|
17
|
+
|
18
|
+
def data
|
19
|
+
{ name: name, content: lines.join("\n") }
|
20
|
+
end
|
21
|
+
|
22
|
+
def open?
|
23
|
+
@open
|
24
|
+
end
|
25
|
+
|
26
|
+
def close
|
27
|
+
@open = false
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def lines
|
33
|
+
@lines ||= []
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -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
|
@@ -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
|
@@ -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 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
|
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
|
@@ -1,18 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
4
3
|
require 'avmtrf1/tools/runner/check_point/login'
|
5
4
|
require 'avmtrf1/inventario_sistemas/parser'
|
5
|
+
require 'eac_cli/core_ext'
|
6
6
|
|
7
7
|
module Avmtrf1
|
8
8
|
module Tools
|
9
|
-
class Runner
|
10
|
-
class InventarioSistemas
|
11
|
-
include ::EacCli::DefaultRunner
|
12
|
-
|
9
|
+
class Runner
|
10
|
+
class InventarioSistemas
|
13
11
|
DEFAULT_OUTPUT_DIR = './inventario-sistemas'
|
14
12
|
|
15
|
-
|
13
|
+
runner_with :help do
|
16
14
|
desc 'Formata a planilha de inventário de sistemas do TRF1.'
|
17
15
|
bool_opt '-w', '--overwrite', 'Sobreescreve diretório de saída se já existir.'
|
18
16
|
arg_opt '-d', '--output-directory', "Diretório de saída [default: #{DEFAULT_OUTPUT_DIR}]."
|
@@ -37,7 +35,7 @@ module Avmtrf1
|
|
37
35
|
end
|
38
36
|
|
39
37
|
def input_file_uncached
|
40
|
-
|
38
|
+
parsed.source_file_path.to_pathname.expand_path
|
41
39
|
end
|
42
40
|
|
43
41
|
def site_build_uncached
|
@@ -45,11 +43,11 @@ module Avmtrf1
|
|
45
43
|
end
|
46
44
|
|
47
45
|
def output_directory_uncached
|
48
|
-
|
46
|
+
parsed.output_directory.if_present(DEFAULT_OUTPUT_DIR).to_pathname.expand_path
|
49
47
|
end
|
50
48
|
|
51
49
|
def overwrite?
|
52
|
-
|
50
|
+
parsed.overwrite?
|
53
51
|
end
|
54
52
|
|
55
53
|
def start_banner
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/ad_user'
|
4
|
+
require 'avmtrf1/executables'
|
5
|
+
require 'avmtrf1/openvpn/config/builder'
|
6
|
+
require 'eac_cli/core_ext'
|
7
|
+
|
8
|
+
module Avmtrf1
|
9
|
+
module Tools
|
10
|
+
class Runner
|
11
|
+
class Openvpn
|
12
|
+
runner_with :help do
|
13
|
+
desc 'Conecta-se utilizando OpenVPN com configurações dinâmicas.'
|
14
|
+
bool_opt '-S', '--no-sudo', 'Não executa com "sudo".'
|
15
|
+
bool_opt '-A', '--no-ad-auth', 'Não utiliza autenticação do Active Directory.'
|
16
|
+
pos_arg :ovpn_path
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
on_temp_files do
|
21
|
+
start_banner
|
22
|
+
infov 'Resultado', command.system
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_accessor :credentials_path, :ovpn_config_path
|
29
|
+
|
30
|
+
def ad_auth?
|
31
|
+
!parsed.no_ad_auth?
|
32
|
+
end
|
33
|
+
|
34
|
+
def command_uncached
|
35
|
+
if parsed.no_sudo?
|
36
|
+
::Avmtrf1::Executables.env.command(*openvpn_args)
|
37
|
+
else
|
38
|
+
::Avmtrf1::Executables.sudo.command(*openvpn_args)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def config_builder_uncached
|
43
|
+
r = ::Avmtrf1::Openvpn::Config::Builder.new(parsed.ovpn_path)
|
44
|
+
r.simple_add_or_update('auth-user-pass', [credentials_path.to_path]) if ad_auth?
|
45
|
+
r
|
46
|
+
end
|
47
|
+
|
48
|
+
def openvpn_args
|
49
|
+
['openvpn', '--config', ovpn_config_path]
|
50
|
+
end
|
51
|
+
|
52
|
+
def start_banner
|
53
|
+
infov 'Arquivo de configuração', parsed.ovpn_path
|
54
|
+
infov 'Linha de comando', ::Shellwords.join(command.args)
|
55
|
+
end
|
56
|
+
|
57
|
+
def on_temp_files
|
58
|
+
on_credentials_file do
|
59
|
+
on_config_file { yield }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def on_credentials_file(&block)
|
64
|
+
if ad_auth?
|
65
|
+
on_temp_file(:credentials_path, -> { credentials_content }, &block)
|
66
|
+
else
|
67
|
+
block.call
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def on_config_file(&block)
|
72
|
+
on_temp_file(:ovpn_config_path, -> { config_builder.data }, &block)
|
73
|
+
end
|
74
|
+
|
75
|
+
def on_temp_file(attr, content_proc)
|
76
|
+
::EacRubyUtils::Fs::Temp.on_file do |file|
|
77
|
+
file.write(content_proc.call)
|
78
|
+
send("#{attr}=", file)
|
79
|
+
yield
|
80
|
+
send("#{attr}=", nil)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def credentials_content
|
85
|
+
[::Avmtrf1.ad_user.username, ::Avmtrf1.ad_user.password]
|
86
|
+
.map { |v| "#{v}\n" }.join
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/console/speaker'
|
|
6
6
|
|
7
7
|
module Avmtrf1
|
8
8
|
module Tools
|
9
|
-
class Runner
|
9
|
+
class Runner
|
10
10
|
class Oracle < ::EacRubyUtils::Console::DocoptRunner
|
11
11
|
class Query < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
include ::EacCli::DefaultRunner
|
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/console/speaker'
|
|
5
5
|
|
6
6
|
module Avmtrf1
|
7
7
|
module Tools
|
8
|
-
class Runner
|
8
|
+
class Runner
|
9
9
|
class Oracle < ::EacRubyUtils::Console::DocoptRunner
|
10
10
|
class SourceGet < ::EacRubyUtils::Console::DocoptRunner
|
11
11
|
include ::EacRubyUtils::Console::Speaker
|
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/console/speaker'
|
|
6
6
|
|
7
7
|
module Avmtrf1
|
8
8
|
module Tools
|
9
|
-
class Runner
|
9
|
+
class Runner
|
10
10
|
class Oracle < ::EacRubyUtils::Console::DocoptRunner
|
11
11
|
class UserClear < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
include ::EacCli::DefaultRunner
|
@@ -1,24 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
3
|
+
require 'eac_cli/core_ext'
|
5
4
|
|
6
5
|
module Avmtrf1
|
7
6
|
module Tools
|
8
|
-
class Runner
|
9
|
-
class Php
|
10
|
-
|
7
|
+
class Runner
|
8
|
+
class Php
|
9
|
+
require_sub __FILE__
|
11
10
|
|
12
|
-
|
13
|
-
Utilidades para PHP.
|
14
|
-
|
15
|
-
|
16
|
-
__PROGRAM__ [options] __SUBCOMMANDS__
|
17
|
-
__PROGRAM__ -h | --help
|
18
|
-
|
19
|
-
Options:
|
20
|
-
-h --help Mostra esta ajuda.
|
21
|
-
DOCOPT
|
11
|
+
runner_with :help, :subcommands do
|
12
|
+
desc 'Utilidades para PHP.'
|
13
|
+
subcommands
|
14
|
+
end
|
22
15
|
end
|
23
16
|
end
|
24
17
|
end
|
@@ -1,33 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/docker/registry'
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
4
|
require 'avmtrf1/php/docker_image'
|
5
|
+
require 'eac_cli/core_ext'
|
7
6
|
|
8
7
|
module Avmtrf1
|
9
8
|
module Tools
|
10
|
-
class Runner
|
11
|
-
class Php
|
12
|
-
class Docker
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Options:
|
24
|
-
-h --help Mostra esta ajuda.
|
25
|
-
-d --default Adiciona as versões padrão.
|
26
|
-
-n --registry-name=<registry-name> Nome do registro.
|
27
|
-
-p --push Envia a imagem.
|
28
|
-
-S --no-snapshot Não adiciona "-snapshot" no nome da imagem.
|
29
|
-
-V --no-version Não adiciona a versão do gerador no nome da imagem.
|
30
|
-
DOCOPT
|
9
|
+
class Runner
|
10
|
+
class Php
|
11
|
+
class Docker
|
12
|
+
runner_with :help do
|
13
|
+
bool_opt '-h', '--help', 'Mostra esta ajuda.'
|
14
|
+
bool_opt '-d', '--default', 'Adiciona as versões padrão.'
|
15
|
+
arg_opt '-n', '--registry-name', 'Nome do registro.'
|
16
|
+
bool_opt '-p', '--push', 'Envia a imagem.'
|
17
|
+
bool_opt '-S', '--no-snapshot', 'Não adiciona "-snapshot" no nome da imagem.'
|
18
|
+
bool_opt '-V', '--no-version', 'Não adiciona a versão do gerador no nome da imagem.'
|
19
|
+
pos_arg :version, repeat: true, optional: true
|
20
|
+
end
|
31
21
|
|
32
22
|
def run
|
33
23
|
infov 'Versions to build', versions_to_s
|
@@ -51,8 +41,8 @@ module Avmtrf1
|
|
51
41
|
|
52
42
|
def versions
|
53
43
|
(
|
54
|
-
|
55
|
-
(
|
44
|
+
parsed.version +
|
45
|
+
(parsed.default? ? default_versions : [])
|
56
46
|
).uniq.sort
|
57
47
|
end
|
58
48
|
|
@@ -60,11 +50,11 @@ module Avmtrf1
|
|
60
50
|
image = build_image(version)
|
61
51
|
infom "Building Docker image \"#{image.tag}\""
|
62
52
|
image.build
|
63
|
-
image.push if
|
53
|
+
image.push if parsed.push?
|
64
54
|
end
|
65
55
|
|
66
56
|
def registry_name
|
67
|
-
|
57
|
+
parsed.registry_name || ::Avmtrf1.configs.read_entry('docker.registry.name')
|
68
58
|
end
|
69
59
|
|
70
60
|
def registry_uncached
|
@@ -73,8 +63,8 @@ module Avmtrf1
|
|
73
63
|
|
74
64
|
def build_image(php_version)
|
75
65
|
r = ::Avmtrf1::Php::DockerImage.new(registry, php_version)
|
76
|
-
r.send('version=', !
|
77
|
-
r.snapshot = !
|
66
|
+
r.send('version=', !parsed.no_version?)
|
67
|
+
r.snapshot = !parsed.no_snapshot?
|
78
68
|
r
|
79
69
|
end
|
80
70
|
end
|
@@ -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 Red < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
include ::EacRubyUtils::Console::Speaker
|
14
14
|
include ::EacRubyUtils::SimpleCache
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avmtrf1/trf1_dspace_base0/deploy'
|
4
|
-
require 'avm/
|
4
|
+
require 'avm/eac_webapp_base0/runner/deploy'
|
5
5
|
|
6
6
|
module Avmtrf1
|
7
7
|
module Tools
|
8
|
-
class Runner
|
8
|
+
class Runner
|
9
9
|
class Trf1DspaceBase0 < ::EacRubyUtils::Console::DocoptRunner
|
10
|
-
class Deploy < ::Avm::
|
10
|
+
class Deploy < ::Avm::EacWebappBase0::Runner::Deploy
|
11
11
|
def stereotype_module
|
12
12
|
::Avmtrf1::Trf1DspaceBase0
|
13
13
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
4
|
-
require 'avm/
|
3
|
+
require 'avm/eac_webapp_base0/deploy'
|
4
|
+
require 'avm/eac_webapp_base0/deploy/file_unit' # To be fixed in gem "avm-tools"
|
5
5
|
|
6
6
|
module Avmtrf1
|
7
7
|
module Trf1DspaceBase0
|
8
|
-
class Deploy < ::Avm::
|
8
|
+
class Deploy < ::Avm::EacWebappBase0::Deploy
|
9
9
|
set_callback :assert_instance_branch, :after do
|
10
10
|
mvn_package
|
11
11
|
ant_update
|
@@ -15,7 +15,10 @@ RUN apt-get install -y libbz2-dev
|
|
15
15
|
RUN docker-php-ext-install bz2
|
16
16
|
|
17
17
|
# Extensão PHP "gd"
|
18
|
-
|
18
|
+
# Referência: https://stackoverflow.com/a/51041727
|
19
|
+
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libwebp-dev libxpm-dev
|
20
|
+
RUN docker-php-ext-configure gd --with-gd --with-webp-dir --with-jpeg-dir --with-png-dir \
|
21
|
+
--with-zlib-dir --with-xpm-dir --with-freetype-dir
|
19
22
|
RUN docker-php-ext-install gd
|
20
23
|
|
21
24
|
# Extensão PHP "intl"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avmtrf1-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -50,14 +50,20 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.76'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.76.1
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
61
|
- - "~>"
|
59
62
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
63
|
+
version: '0.76'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.76.1
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: curb
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,20 +98,20 @@ dependencies:
|
|
92
98
|
requirements:
|
93
99
|
- - "~>"
|
94
100
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0.
|
101
|
+
version: '0.51'
|
96
102
|
- - ">="
|
97
103
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
104
|
+
version: 0.51.1
|
99
105
|
type: :runtime
|
100
106
|
prerelease: false
|
101
107
|
version_requirements: !ruby/object:Gem::Requirement
|
102
108
|
requirements:
|
103
109
|
- - "~>"
|
104
110
|
- !ruby/object:Gem::Version
|
105
|
-
version: '0.
|
111
|
+
version: '0.51'
|
106
112
|
- - ">="
|
107
113
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0.
|
114
|
+
version: 0.51.1
|
109
115
|
- !ruby/object:Gem::Dependency
|
110
116
|
name: filesize
|
111
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,6 +305,12 @@ files:
|
|
299
305
|
- lib/avmtrf1/jira/entities.rb
|
300
306
|
- lib/avmtrf1/jira/entities/issue.rb
|
301
307
|
- lib/avmtrf1/jira/instance.rb
|
308
|
+
- lib/avmtrf1/openvpn/config/builder.rb
|
309
|
+
- lib/avmtrf1/openvpn/config/parser.rb
|
310
|
+
- lib/avmtrf1/openvpn/config/parser/builder.rb
|
311
|
+
- lib/avmtrf1/openvpn/config/parser/line.rb
|
312
|
+
- lib/avmtrf1/openvpn/config/parser/simple.rb
|
313
|
+
- lib/avmtrf1/openvpn/config/parser/tag.rb
|
302
314
|
- lib/avmtrf1/oracle.rb
|
303
315
|
- lib/avmtrf1/oracle/connection.rb
|
304
316
|
- lib/avmtrf1/oracle/connection/base.rb
|
@@ -343,6 +355,7 @@ files:
|
|
343
355
|
- lib/avmtrf1/ruby/gems/not_found_error.rb
|
344
356
|
- lib/avmtrf1/template.rb
|
345
357
|
- lib/avmtrf1/tools.rb
|
358
|
+
- lib/avmtrf1/tools/application.rb
|
346
359
|
- lib/avmtrf1/tools/runner.rb
|
347
360
|
- lib/avmtrf1/tools/runner/check_point.rb
|
348
361
|
- lib/avmtrf1/tools/runner/check_point/login.rb
|
@@ -359,6 +372,7 @@ files:
|
|
359
372
|
- lib/avmtrf1/tools/runner/git/issues_check.rb
|
360
373
|
- lib/avmtrf1/tools/runner/git/push_large.rb
|
361
374
|
- lib/avmtrf1/tools/runner/inventario_sistemas.rb
|
375
|
+
- lib/avmtrf1/tools/runner/openvpn.rb
|
362
376
|
- lib/avmtrf1/tools/runner/oracle.rb
|
363
377
|
- lib/avmtrf1/tools/runner/oracle/query.rb
|
364
378
|
- lib/avmtrf1/tools/runner/oracle/source_get.rb
|