pd1_tools 0.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +12 -0
- data/exe/pd1 +8 -0
- data/lib/avmtrf1/active_directory/user.rb +28 -0
- data/lib/avmtrf1/active_directory.rb +8 -0
- data/lib/avmtrf1/ad_user.rb +11 -0
- data/lib/avmtrf1/check_point/session/login.rb +57 -0
- data/lib/avmtrf1/check_point/session.rb +60 -0
- data/lib/avmtrf1/check_point.rb +3 -0
- data/lib/avmtrf1/default_esosti.rb +20 -0
- data/lib/avmtrf1/default_jira.rb +18 -0
- data/lib/avmtrf1/default_redmine.rb +16 -0
- data/lib/avmtrf1/docker/image.rb +49 -0
- data/lib/avmtrf1/docker/image_runner.rb +83 -0
- data/lib/avmtrf1/docker.rb +9 -0
- data/lib/avmtrf1/esosti/entities/issue.rb +24 -0
- data/lib/avmtrf1/esosti/entities.rb +9 -0
- data/lib/avmtrf1/esosti/instance/changed.rb +33 -0
- data/lib/avmtrf1/esosti/instance.rb +22 -0
- data/lib/avmtrf1/esosti/raw_data_sanitizer.rb +47 -0
- data/lib/avmtrf1/esosti/session/action_base.rb +34 -0
- data/lib/avmtrf1/esosti/session/atividades.rb +35 -0
- data/lib/avmtrf1/esosti/session/login.rb +47 -0
- data/lib/avmtrf1/esosti/session/solicitacao/main.rb +49 -0
- data/lib/avmtrf1/esosti/session/solicitacao.rb +81 -0
- data/lib/avmtrf1/esosti/session.rb +36 -0
- data/lib/avmtrf1/esosti.rb +8 -0
- data/lib/avmtrf1/executables.rb +23 -0
- data/lib/avmtrf1/forponto/parsers/day_registers.rb +19 -0
- data/lib/avmtrf1/forponto/parsers/espelho/day_node.rb +50 -0
- data/lib/avmtrf1/forponto/parsers/espelho/methods_as_fields.rb +21 -0
- data/lib/avmtrf1/forponto/parsers/espelho/row_node.rb +34 -0
- data/lib/avmtrf1/forponto/parsers/espelho/rows_consumer.rb +71 -0
- data/lib/avmtrf1/forponto/parsers/espelho/sub_node.rb +20 -0
- data/lib/avmtrf1/forponto/parsers/espelho/summary_node.rb +55 -0
- data/lib/avmtrf1/forponto/parsers/espelho/utils.rb +32 -0
- data/lib/avmtrf1/forponto/parsers/espelho.rb +26 -0
- data/lib/avmtrf1/forponto/session/day_registers.rb +39 -0
- data/lib/avmtrf1/forponto/session/interval.rb +27 -0
- data/lib/avmtrf1/forponto/session/login.rb +45 -0
- data/lib/avmtrf1/forponto/session.rb +32 -0
- data/lib/avmtrf1/forponto/user/balance.rb +155 -0
- data/lib/avmtrf1/forponto/user/day_registers.rb +32 -0
- data/lib/avmtrf1/forponto/user/month.rb +141 -0
- data/lib/avmtrf1/forponto/user.rb +22 -0
- data/lib/avmtrf1/git/cached_repository.rb +27 -0
- data/lib/avmtrf1/git/gitlab.rb +11 -0
- data/lib/avmtrf1/git/issue_on_repository.rb +100 -0
- data/lib/avmtrf1/git/push_large/_utils.rb +16 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/cache.rb +21 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/checkout_previous_revision.rb +35 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/commit_changes.rb +48 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/helpers.rb +29 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/pick_source_revision.rb +103 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/push.rb +90 -0
- data/lib/avmtrf1/git/push_large/lfs_commit/track_large_files.rb +53 -0
- data/lib/avmtrf1/git/push_large/lfs_commit.rb +47 -0
- data/lib/avmtrf1/git/push_large/source_commit/push.rb +42 -0
- data/lib/avmtrf1/git/push_large/source_commit.rb +58 -0
- data/lib/avmtrf1/git/push_large.rb +69 -0
- data/lib/avmtrf1/git/reference.rb +34 -0
- data/lib/avmtrf1/git.rb +10 -0
- data/lib/avmtrf1/gitlab/commit.rb +37 -0
- data/lib/avmtrf1/gitlab/repository.rb +41 -0
- data/lib/avmtrf1/ini/profile.rb +42 -0
- data/lib/avmtrf1/ini.rb +55 -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/parser.rb +40 -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/html_page_base.rb +41 -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/inventario_sistemas/site_build.rb +71 -0
- data/lib/avmtrf1/inventario_sistemas.rb +38 -0
- data/lib/avmtrf1/issues/factory.rb +22 -0
- data/lib/avmtrf1/issues.rb +7 -0
- data/lib/avmtrf1/jira/entities/issue.rb +30 -0
- data/lib/avmtrf1/jira/entities.rb +9 -0
- data/lib/avmtrf1/jira/instance.rb +28 -0
- data/lib/avmtrf1/jira.rb +8 -0
- data/lib/avmtrf1/node_js/docker_image.rb +14 -0
- data/lib/avmtrf1/node_js.rb +9 -0
- data/lib/avmtrf1/openvpn/config/builder.rb +59 -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/openvpn/config/parser.rb +20 -0
- data/lib/avmtrf1/oracle/connection/base.rb +66 -0
- data/lib/avmtrf1/oracle/connection/string_builder.rb +44 -0
- data/lib/avmtrf1/oracle/connection.rb +12 -0
- data/lib/avmtrf1/oracle/object/base.rb +39 -0
- data/lib/avmtrf1/oracle/object/table.rb +15 -0
- data/lib/avmtrf1/oracle/object/user.rb +15 -0
- data/lib/avmtrf1/oracle/object/view.rb +15 -0
- data/lib/avmtrf1/oracle/object.rb +25 -0
- data/lib/avmtrf1/oracle/objects/relation.rb +23 -0
- data/lib/avmtrf1/oracle/objects/sql_builder.rb +64 -0
- data/lib/avmtrf1/oracle/objects.rb +53 -0
- data/lib/avmtrf1/oracle/oci8.rb +29 -0
- data/lib/avmtrf1/oracle.rb +10 -0
- data/lib/avmtrf1/patches/avm/git/issue/complete.rb +50 -0
- data/lib/avmtrf1/patches/avm/git/issue.rb +4 -0
- data/lib/avmtrf1/patches/avm/git/launcher/base.rb +46 -0
- data/lib/avmtrf1/patches/avm/git/launcher.rb +4 -0
- data/lib/avmtrf1/patches/avm/git.rb +4 -0
- data/lib/avmtrf1/patches/avm.rb +4 -0
- data/lib/avmtrf1/patches/inifile.rb +13 -0
- data/lib/avmtrf1/patches.rb +4 -0
- data/lib/avmtrf1/php/docker_images/base.rb +49 -0
- data/lib/avmtrf1/php/docker_images/factory.rb +37 -0
- data/lib/avmtrf1/php/docker_images/v5.rb +47 -0
- data/lib/avmtrf1/php/docker_images/v7.rb +27 -0
- data/lib/avmtrf1/php/docker_images/v7_v4.rb +30 -0
- data/lib/avmtrf1/php/docker_images/v8.rb +19 -0
- data/lib/avmtrf1/php/docker_images.rb +11 -0
- data/lib/avmtrf1/php.rb +9 -0
- data/lib/avmtrf1/red/client/authorization.xml.erb +4 -0
- data/lib/avmtrf1/red/client.rb +38 -0
- data/lib/avmtrf1/red/helper.rb +35 -0
- data/lib/avmtrf1/red/profile/put_file.xml.erb +19 -0
- data/lib/avmtrf1/red/profile.rb +58 -0
- data/lib/avmtrf1/red/server.rb +33 -0
- data/lib/avmtrf1/red.rb +5 -0
- data/lib/avmtrf1/redmine/entities/issue.rb +29 -0
- data/lib/avmtrf1/redmine/entities/issue_status.rb +23 -0
- data/lib/avmtrf1/redmine/entities.rb +10 -0
- data/lib/avmtrf1/redmine/instance.rb +41 -0
- data/lib/avmtrf1/redmine.rb +7 -0
- data/lib/avmtrf1/rest_provider/entity.rb +18 -0
- data/lib/avmtrf1/rest_provider/instance/issues.rb +30 -0
- data/lib/avmtrf1/rest_provider/instance.rb +30 -0
- data/lib/avmtrf1/rest_provider/request.rb +44 -0
- data/lib/avmtrf1/rest_provider/response.rb +73 -0
- data/lib/avmtrf1/rest_provider.rb +7 -0
- data/lib/avmtrf1/result.rb +44 -0
- data/lib/avmtrf1/ruby.rb +9 -0
- data/lib/avmtrf1/tools/application.rb +13 -0
- data/lib/avmtrf1/tools/core_ext.rb +4 -0
- data/lib/avmtrf1/tools/msgraph/api/entity.rb +35 -0
- data/lib/avmtrf1/tools/msgraph/api/member.rb +31 -0
- data/lib/avmtrf1/tools/msgraph/api/root.rb +27 -0
- data/lib/avmtrf1/tools/msgraph/api/team/member_add.rb +36 -0
- data/lib/avmtrf1/tools/msgraph/api/team.rb +40 -0
- data/lib/avmtrf1/tools/msgraph/api.rb +55 -0
- data/lib/avmtrf1/tools/msgraph/error.rb +31 -0
- data/lib/avmtrf1/tools/msgraph/request_mixin.rb +18 -0
- data/lib/avmtrf1/tools/msgraph/response_mixin.rb +23 -0
- data/lib/avmtrf1/tools/msgraph/token_retrieve.rb +42 -0
- data/lib/avmtrf1/tools/msgraph.rb +11 -0
- data/lib/avmtrf1/tools/rubygems/dependency.rb +20 -0
- data/lib/avmtrf1/tools/rubygems/not_found_error.rb +17 -0
- data/lib/avmtrf1/tools/rubygems.rb +11 -0
- data/lib/avmtrf1/tools/runner/check_point/login.rb +33 -0
- data/lib/avmtrf1/tools/runner/check_point.rb +17 -0
- data/lib/avmtrf1/tools/runner/esosti/changed.rb +39 -0
- data/lib/avmtrf1/tools/runner/esosti/fetch.rb +39 -0
- data/lib/avmtrf1/tools/runner/esosti/request.rb +76 -0
- data/lib/avmtrf1/tools/runner/esosti.rb +27 -0
- data/lib/avmtrf1/tools/runner/forponto/espelho.rb +47 -0
- data/lib/avmtrf1/tools/runner/forponto/marcacoes.rb +32 -0
- data/lib/avmtrf1/tools/runner/forponto/resumos.rb +87 -0
- data/lib/avmtrf1/tools/runner/forponto/saldo.rb +91 -0
- data/lib/avmtrf1/tools/runner/forponto.rb +70 -0
- data/lib/avmtrf1/tools/runner/git/gitlab/commit_link.rb +81 -0
- data/lib/avmtrf1/tools/runner/git/gitlab.rb +20 -0
- data/lib/avmtrf1/tools/runner/git/issues_check.rb +59 -0
- data/lib/avmtrf1/tools/runner/git/push_large.rb +46 -0
- data/lib/avmtrf1/tools/runner/git.rb +14 -0
- data/lib/avmtrf1/tools/runner/inventario_sistemas.rb +71 -0
- data/lib/avmtrf1/tools/runner/msgraph/joined_teams.rb +39 -0
- data/lib/avmtrf1/tools/runner/msgraph/request.rb +45 -0
- data/lib/avmtrf1/tools/runner/msgraph/team/member/add.rb +48 -0
- data/lib/avmtrf1/tools/runner/msgraph/team/member.rb +25 -0
- data/lib/avmtrf1/tools/runner/msgraph/team/members.rb +38 -0
- data/lib/avmtrf1/tools/runner/msgraph/team.rb +27 -0
- data/lib/avmtrf1/tools/runner/msgraph/token.rb +31 -0
- data/lib/avmtrf1/tools/runner/msgraph.rb +43 -0
- data/lib/avmtrf1/tools/runner/node_js/docker.rb +15 -0
- data/lib/avmtrf1/tools/runner/node_js.rb +18 -0
- data/lib/avmtrf1/tools/runner/openvpn.rb +91 -0
- data/lib/avmtrf1/tools/runner/oracle/query.rb +71 -0
- data/lib/avmtrf1/tools/runner/oracle/source_get.rb +51 -0
- data/lib/avmtrf1/tools/runner/oracle/user_clear.rb +59 -0
- data/lib/avmtrf1/tools/runner/oracle.rb +37 -0
- data/lib/avmtrf1/tools/runner/php/docker.rb +20 -0
- data/lib/avmtrf1/tools/runner/php.rb +18 -0
- data/lib/avmtrf1/tools/runner/red.rb +83 -0
- data/lib/avmtrf1/tools/runner/source.rb +14 -0
- data/lib/avmtrf1/tools/runner.rb +43 -0
- data/lib/avmtrf1/tools.rb +4 -0
- data/lib/pd1_tools/version.rb +5 -0
- data/lib/pd1_tools.rb +7 -0
- data/template/avmtrf1/node_js/docker_image/Dockerfile.template +25 -0
- data/template/avmtrf1/node_js/docker_image/auxiliary/config_banner.sh +15 -0
- data/template/avmtrf1/node_js/docker_image/auxiliary/init.sh +18 -0
- data/template/avmtrf1/node_js/docker_image/auxiliary/lib.sh +30 -0
- data/template/avmtrf1/node_js/docker_image/auxiliary/ng_serve.sh +16 -0
- data/template/avmtrf1/node_js/docker_image/auxiliary/npm_install.sh +21 -0
- data/template/avmtrf1/node_js/docker_image/auxiliary/start.sh +17 -0
- data/template/avmtrf1/php/docker_images/base/Dockerfile.template +104 -0
- data/template/avmtrf1/php/docker_images/base/aux/apache_foreground.sh +16 -0
- data/template/avmtrf1/php/docker_images/base/aux/apache_user.sh +54 -0
- data/template/avmtrf1/php/docker_images/base/aux/app_user_run.sh +17 -0
- data/template/avmtrf1/php/docker_images/base/aux/config_banner.sh +20 -0
- data/template/avmtrf1/php/docker_images/base/aux/init.sh +39 -0
- data/template/avmtrf1/php/docker_images/base/aux/laravel.sh +58 -0
- data/template/avmtrf1/php/docker_images/base/aux/lib.sh +70 -0
- data/template/avmtrf1/php/docker_images/base/aux/pear.sh +35 -0
- data/template/avmtrf1/php/docker_images/base/aux/php_composer.sh +31 -0
- data/template/avmtrf1/php/docker_images/base/aux/php_values.sh +41 -0
- data/template/avmtrf1/php/docker_images/base/aux/setup_apache_site.sh +16 -0
- data/template/avmtrf1/php/docker_images/base/aux/start.sh +26 -0
- data/template/avmtrf1/php/docker_images/base/aux/templates/apache_site.conf +12 -0
- data/template/avmtrf1/tools/msgraph/token_retrieve/python_retriever.py +85 -0
- metadata +460 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eff76cb7620d40f8d5f6bc74379730b29eaffe4193d4d2fe528a438890221670
|
4
|
+
data.tar.gz: 02e3be6a9c997e419ea8857d9aa71084566b1d49acb36ad6c9cf2c994b9bd603
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 29e3017c0902742ff7a3ad56b2fbb58ce5917869750dcf21b81fe2c7df9afeef25b7d2daca8bc400aa452ef9483cf052b2ace002bcf480528b745e58519f9e91
|
7
|
+
data.tar.gz: 29379ab4c1c0fa7161d46ae590506214e2543e301b941d59b8a19b4b84abba928e0dd9d907e8dea96e2d829c0ca52f8831d3039893e7064f857259990c8d5d16
|
data/Gemfile
ADDED
data/exe/pd1
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avmtrf1
|
4
|
+
module ActiveDirectory
|
5
|
+
class User
|
6
|
+
class << self
|
7
|
+
def by_configs(path_prefix)
|
8
|
+
new(
|
9
|
+
::EacConfig::Node.context.current.entry("#{path_prefix}.domain").value,
|
10
|
+
::EacConfig::Node.context.current.entry("#{path_prefix}.username").value,
|
11
|
+
::EacConfig::Node.context.current.entry("#{path_prefix}.password").secret_value
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
attr_reader :domain, :username, :password
|
16
|
+
|
17
|
+
def initialize(domain, username, password)
|
18
|
+
@domain = domain
|
19
|
+
@username = username
|
20
|
+
@password = password
|
21
|
+
end
|
22
|
+
|
23
|
+
def username_with_domain
|
24
|
+
"#{domain}\\#{username}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avmtrf1
|
4
|
+
module CheckPoint
|
5
|
+
class Session
|
6
|
+
class Login
|
7
|
+
def initialize(parent)
|
8
|
+
@parent = parent
|
9
|
+
run
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :parent
|
15
|
+
|
16
|
+
def session
|
17
|
+
parent.session
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
go_to_login_form
|
22
|
+
fill_username
|
23
|
+
fill_password
|
24
|
+
click_login_button
|
25
|
+
wait_for_result_page
|
26
|
+
end
|
27
|
+
|
28
|
+
def go_to_login_form
|
29
|
+
session.navigate.to ::Avmtrf1::CheckPoint::Session::LOGIN_URL
|
30
|
+
end
|
31
|
+
|
32
|
+
def fill_username
|
33
|
+
element_send_keys('sg_username_input', parent.username)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fill_password
|
37
|
+
element_send_keys('sg_password_input', parent.password)
|
38
|
+
end
|
39
|
+
|
40
|
+
def click_login_button
|
41
|
+
session.wait_for_element(id: 'sg_login_button').click
|
42
|
+
end
|
43
|
+
|
44
|
+
def element_send_keys(element_id, text)
|
45
|
+
session.wait_for_click(id: element_id).send_keys(text)
|
46
|
+
end
|
47
|
+
|
48
|
+
def wait_for_result_page
|
49
|
+
session.wait.until do
|
50
|
+
element = session.find_element(id: 'sg_login_button')
|
51
|
+
element && element != ::Avmtrf1::CheckPoint::Session::LOGGED_TITLE_TEXT
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/ad_user'
|
4
|
+
require 'avmtrf1/check_point/session/login'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module CheckPoint
|
9
|
+
class Session
|
10
|
+
enable_simple_cache
|
11
|
+
|
12
|
+
ROOT_URL = 'https://cp.trf1.jus.br'
|
13
|
+
LOGIN_URL = "#{ROOT_URL}/"
|
14
|
+
LOGGED_TITLE_TEXT = 'Re-Authenticate'
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def by_ad_user(ad_user, driver_options = {})
|
18
|
+
new(
|
19
|
+
ad_user.username,
|
20
|
+
ad_user.password,
|
21
|
+
driver_options
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def by_default_ad_user(driver_options = {})
|
26
|
+
by_ad_user(::Avmtrf1.ad_user, driver_options.merge(driver: :firefox))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
common_constructor :username, :password, :driver_options, default: [{}]
|
31
|
+
|
32
|
+
def logged?
|
33
|
+
session.navigate.to LOGIN_URL
|
34
|
+
title_text == LOGGED_TITLE_TEXT
|
35
|
+
end
|
36
|
+
|
37
|
+
def login
|
38
|
+
::Avmtrf1::CheckPoint::Session::Login.new(self)
|
39
|
+
end
|
40
|
+
|
41
|
+
def title_text
|
42
|
+
result_text = nil
|
43
|
+
session.wait.until do
|
44
|
+
element = session.find_element(id: 'sg_login_button')
|
45
|
+
return false unless element
|
46
|
+
|
47
|
+
result_text = element.text.strip
|
48
|
+
result_text.present?
|
49
|
+
end
|
50
|
+
result_text
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def session_uncached
|
56
|
+
::Aranha::Selenium::Session.new(driver_options.merge(accept_insecure_certs: true))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/esosti/instance'
|
4
|
+
require 'avmtrf1/ad_user'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
class << self
|
8
|
+
def default_esosti
|
9
|
+
@default_esosti ||= trf1_esosti('https://esosti.trf1.jus.br')
|
10
|
+
end
|
11
|
+
|
12
|
+
def trf1_esosti(url)
|
13
|
+
::Avmtrf1::Esosti::Instance.new(
|
14
|
+
url,
|
15
|
+
"#{::Avmtrf1.ad_user.username}@#{::Avmtrf1.ad_user.domain.downcase}.gov.br",
|
16
|
+
::Avmtrf1.ad_user.password
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/jira/instance'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
DEFAULT_JIRA_PATH_PREFIX = 'default.jira'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def default_jira
|
10
|
+
@default_jira ||= ::Avmtrf1::Jira::Instance.new(
|
11
|
+
'https://jira.engesoftware.com.br',
|
12
|
+
::EacConfig::Node.context.current.entry("#{DEFAULT_JIRA_PATH_PREFIX}.username").value,
|
13
|
+
::EacConfig::Node.context.current
|
14
|
+
.entry("#{DEFAULT_JIRA_PATH_PREFIX}.password").secret_value
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/ad_user'
|
4
|
+
require 'avmtrf1/redmine/instance'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
class << self
|
8
|
+
def default_redmine
|
9
|
+
@default_redmine ||= ::Avmtrf1::Redmine::Instance.new(
|
10
|
+
'http://redmine.trf1.gov.br',
|
11
|
+
::Avmtrf1.ad_user.username,
|
12
|
+
::Avmtrf1.ad_user.password
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/docker/image'
|
5
|
+
require 'pd1_tools/version'
|
6
|
+
require 'eac_templates/sources/from_all_gems'
|
7
|
+
|
8
|
+
module Avmtrf1
|
9
|
+
module Docker
|
10
|
+
class Image < ::Avm::Docker::Image
|
11
|
+
enable_simple_cache
|
12
|
+
|
13
|
+
common_constructor :registry, :platform_version
|
14
|
+
|
15
|
+
APT_SETUP = <<~CODE
|
16
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
17
|
+
RUN apt-get -y update
|
18
|
+
RUN apt-get -y dist-upgrade
|
19
|
+
CODE
|
20
|
+
DEBIAN_STRETCH_FIX_SOURCES = <<~CODE
|
21
|
+
RUN echo 'deb http://security.debian.org/debian-security stable-security/updates main' > /etc/apt/sources.list
|
22
|
+
RUN echo 'deb http://archive.debian.org/debian stretch main' >> /etc/apt/sources.list
|
23
|
+
CODE
|
24
|
+
DEBIAN_STRETCH_APT_SETUP = DEBIAN_STRETCH_FIX_SOURCES + APT_SETUP
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def apt_setup
|
28
|
+
APT_SETUP
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def debian_stretch_apt_setup
|
33
|
+
DEBIAN_STRETCH_APT_SETUP
|
34
|
+
end
|
35
|
+
|
36
|
+
def platform_stereotype_tag
|
37
|
+
self.class.name.split('::')[-2].underscore.dasherize
|
38
|
+
end
|
39
|
+
|
40
|
+
def stereotype_tag
|
41
|
+
"#{platform_stereotype_tag}-#{platform_version}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def generator_version
|
45
|
+
::Pd1Tools::VERSION
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_config/node'
|
4
|
+
require 'eac_ruby_base0/core_ext'
|
5
|
+
require 'eac_docker/registry'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Docker
|
9
|
+
class ImageRunner
|
10
|
+
runner_with :help do
|
11
|
+
bool_opt '-h', '--help', 'Mostra esta ajuda.'
|
12
|
+
bool_opt '-d', '--default', 'Adiciona as versões padrão.'
|
13
|
+
arg_opt '-n', '--registry-name', 'Nome do registro.'
|
14
|
+
bool_opt '-p', '--push', 'Envia a imagem.'
|
15
|
+
bool_opt '-S', '--no-snapshot', 'Não adiciona "-snapshot" no nome da imagem.'
|
16
|
+
bool_opt '-V', '--no-version', 'Não adiciona a versão do gerador no nome da imagem.'
|
17
|
+
pos_arg :version, repeat: true, optional: true
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
infov 'Versions to build', versions_to_s
|
22
|
+
versions.each do |version|
|
23
|
+
process_version(version)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_versions
|
28
|
+
::EacConfig::Node.context.current.entry(default_versions_config_key).value.split(',')
|
29
|
+
.map(&:strip).reject(&:blank?)
|
30
|
+
end
|
31
|
+
|
32
|
+
def versions_to_s
|
33
|
+
if versions.any?
|
34
|
+
versions.join(', ')
|
35
|
+
else
|
36
|
+
'-- NONE --'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def versions
|
41
|
+
(
|
42
|
+
parsed.version +
|
43
|
+
(parsed.default? ? default_versions : [])
|
44
|
+
).uniq.sort
|
45
|
+
end
|
46
|
+
|
47
|
+
def process_version(version)
|
48
|
+
image = build_image(version)
|
49
|
+
infom "Building Docker image \"#{image.tag}\""
|
50
|
+
image.build
|
51
|
+
image.push if parsed.push?
|
52
|
+
end
|
53
|
+
|
54
|
+
def registry_name
|
55
|
+
parsed.registry_name || ::EacConfig::Node.context.current.entry('docker.registry.name')
|
56
|
+
.value
|
57
|
+
end
|
58
|
+
|
59
|
+
def registry_uncached
|
60
|
+
::EacDocker::Registry.new(registry_name)
|
61
|
+
end
|
62
|
+
|
63
|
+
def build_image(platform_version)
|
64
|
+
r = docker_image_class(platform_version).new(registry, platform_version)
|
65
|
+
r.send('version=', !parsed.no_version?)
|
66
|
+
r.snapshot = !parsed.no_snapshot?
|
67
|
+
r
|
68
|
+
end
|
69
|
+
|
70
|
+
def default_versions_config_key
|
71
|
+
"#{platform_name.underscore}.default_versions"
|
72
|
+
end
|
73
|
+
|
74
|
+
def docker_image_class(_platform_version)
|
75
|
+
"Avmtrf1::#{platform_name}::DockerImage".constantize
|
76
|
+
end
|
77
|
+
|
78
|
+
def platform_name
|
79
|
+
self.class.name.split('::')[-2]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/esosti/raw_data_sanitizer'
|
4
|
+
require 'avmtrf1/rest_provider/entity'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Esosti
|
8
|
+
module Entities
|
9
|
+
class Issue < ::Avmtrf1::RestProvider::Entity
|
10
|
+
class << self
|
11
|
+
def parse_data(data)
|
12
|
+
data.fetch('QueryMS_RMTICKETResponse')['MS_RMTICKETSet'].if_present(nil) do |v|
|
13
|
+
::Avmtrf1::Esosti::RawDataSanitizer.sanitize(v.fetch('TICKET'))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(instance, data) # rubocop:disable Lint/UselessMethodDefinition, Style/RedundantInitialize
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/esosti/raw_data_sanitizer'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Esosti
|
8
|
+
class Instance < ::Avmtrf1::RestProvider::Instance
|
9
|
+
module Changed
|
10
|
+
def changed(since)
|
11
|
+
changed_request(since).response.body_data_or_raise
|
12
|
+
end
|
13
|
+
|
14
|
+
def changed_request(since)
|
15
|
+
request_json(changed_url_suffix(since)) do |data|
|
16
|
+
::Avmtrf1::Esosti::RawDataSanitizer.sanitize(
|
17
|
+
data.fetch('TICKETMboSet').fetch('TICKET')
|
18
|
+
).map { |ticket| ticket.fetch('Attributes').fetch('TICKETID').downcase }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def changed_url_suffix(since)
|
23
|
+
'/mbo/ticket?_includecols=ticketid&changedate=~gt~' + # rubocop:disable Style/StringConcatenation
|
24
|
+
::CGI.escape(formatted_time(since))
|
25
|
+
end
|
26
|
+
|
27
|
+
def formatted_time(time)
|
28
|
+
time.strftime('%FT%T%:z')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avmtrf1/esosti/entities/issue'
|
5
|
+
require 'avmtrf1/rest_provider/instance'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Esosti
|
9
|
+
class Instance < ::Avmtrf1::RestProvider::Instance
|
10
|
+
require_sub __FILE__
|
11
|
+
include ::Avmtrf1::Esosti::Instance::Changed
|
12
|
+
|
13
|
+
def build_service_url(service_url_suffix)
|
14
|
+
"#{root_url}/maxrest/rest#{service_url_suffix}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def issue_get_url_suffix(provider_issue_id)
|
18
|
+
"/os/MS_RMTICKET/?ticketid=#{provider_issue_id}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Esosti
|
7
|
+
class RawDataSanitizer
|
8
|
+
class << self
|
9
|
+
def sanitize(raw_data)
|
10
|
+
new(raw_data).sanitized
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
CONTENT_KEY = 'content'
|
15
|
+
|
16
|
+
common_constructor :raw_data
|
17
|
+
|
18
|
+
def sanitized
|
19
|
+
if raw_data.is_a?(Array)
|
20
|
+
array_sanitized
|
21
|
+
elsif raw_data.is_a?(Hash)
|
22
|
+
hash_sanitized
|
23
|
+
else
|
24
|
+
raw_data
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def array_sanitized
|
31
|
+
raw_data.map { |v| self.class.sanitize(v) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def hash_sanitized
|
35
|
+
if content_hash?
|
36
|
+
self.class.sanitize(raw_data.fetch(CONTENT_KEY))
|
37
|
+
else
|
38
|
+
raw_data.transform_values { |v| self.class.sanitize(v) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def content_hash?
|
43
|
+
raw_data.is_a?(Hash) && raw_data.count == 1 && raw_data.key?(CONTENT_KEY)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Esosti
|
7
|
+
class Session
|
8
|
+
class ActionBase
|
9
|
+
attr_reader :data
|
10
|
+
|
11
|
+
def initialize(parent)
|
12
|
+
@parent = parent
|
13
|
+
run
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
attr_reader :parent
|
19
|
+
|
20
|
+
def session
|
21
|
+
parent.session
|
22
|
+
end
|
23
|
+
|
24
|
+
def build_data
|
25
|
+
@data = {}.with_indifferent_access
|
26
|
+
data_keys.each do |key|
|
27
|
+
@data[key] = send("#{key}_data")
|
28
|
+
end
|
29
|
+
@data.freeze
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avmtrf1
|
4
|
+
module Esosti
|
5
|
+
class Session
|
6
|
+
module Atividades
|
7
|
+
def go_to_activities # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
8
|
+
session.wait_for_click(id: 'titlebar-tb_gotoButton')
|
9
|
+
el = session.find_element(
|
10
|
+
xpath: "//*[@id = 'menuholder']//*[contains(text(), 'Central de Serv')]"
|
11
|
+
)
|
12
|
+
session.action.move_to(el).perform
|
13
|
+
el = session.find_element(
|
14
|
+
xpath: "//*[@id = 'menuholder']//*[contains(text(), 'Atividades')]"
|
15
|
+
)
|
16
|
+
session.action.move_to(el).perform
|
17
|
+
el.click
|
18
|
+
session.wait_for_element(id: 'SystemNavAppContent-chld')
|
19
|
+
end
|
20
|
+
|
21
|
+
def refresh_activities
|
22
|
+
session.wait_for_click(xpath: "//img[contains(@title, 'Recarregar para atualizar')]")
|
23
|
+
end
|
24
|
+
|
25
|
+
def route_activity_and_back
|
26
|
+
session.wait_for_click(
|
27
|
+
xpath: "//a[@id = 'ROUTEWF__-tbb_anchor' and contains(@class, 'on')]"
|
28
|
+
)
|
29
|
+
session.wait_for_click(xpath: "//table[@id = 'completewf-mesh']//button[text() = 'OK']")
|
30
|
+
session.wait_for_click(xpath: "//*[text() = 'Visualizar Lista']")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'action_base'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Esosti
|
7
|
+
class Session
|
8
|
+
class Login < ::Avmtrf1::Esosti::Session::ActionBase
|
9
|
+
private
|
10
|
+
|
11
|
+
def run
|
12
|
+
try_go_to_root_url
|
13
|
+
fill_username
|
14
|
+
fill_password
|
15
|
+
fill_uf
|
16
|
+
click_on_login
|
17
|
+
wait_for_home_page
|
18
|
+
end
|
19
|
+
|
20
|
+
def try_go_to_root_url
|
21
|
+
session.navigate.to parent.url
|
22
|
+
end
|
23
|
+
|
24
|
+
def fill_username
|
25
|
+
session.wait_for_element(id: 'j_username').send_keys(parent.user)
|
26
|
+
end
|
27
|
+
|
28
|
+
def fill_password
|
29
|
+
session.wait_for_element(id: 'j_password').send_keys(parent.password)
|
30
|
+
end
|
31
|
+
|
32
|
+
def fill_uf
|
33
|
+
session.wait_for_element(id: 'uf')
|
34
|
+
.find_element(xpath: "//option[text()='#{parent.uf}']").click
|
35
|
+
end
|
36
|
+
|
37
|
+
def click_on_login
|
38
|
+
session.wait_for_element(id: 'loginbutton').click
|
39
|
+
end
|
40
|
+
|
41
|
+
def wait_for_home_page
|
42
|
+
session.wait_for_element(id: 'titlebar-tb_username')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|