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
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/issue/complete'
|
4
|
+
require 'eac_ruby_utils/patch'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Patches
|
9
|
+
module Avm
|
10
|
+
module Git
|
11
|
+
module Issue
|
12
|
+
module Complete
|
13
|
+
extend ::ActiveSupport::Concern
|
14
|
+
|
15
|
+
REDMINE_ISSUE_ID_PATTERN = /\Aredmine_(\d+)\z/.freeze
|
16
|
+
JIRA_ISSUE_ID_PATTERN = /\A([a-z][a-z0-9]*-\d+)\z/.freeze
|
17
|
+
ESOSTI_ISSUE_ID_PATTERN = /\A((?:ss|in)\d+)\z/.freeze
|
18
|
+
|
19
|
+
included do
|
20
|
+
prepend InstanceMethods
|
21
|
+
end
|
22
|
+
|
23
|
+
module InstanceMethods
|
24
|
+
def issue_id
|
25
|
+
%w[redmine esosti jira].find do |provider|
|
26
|
+
issue_id_by_provider(provider)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def issue_id_by_provider(provider)
|
31
|
+
issue_id_pattern_by_provider(provider).match(branch_name).if_present do |m|
|
32
|
+
[provider, m[1]]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def issue_id_pattern_by_provider(provider)
|
37
|
+
self.class.const_get("#{provider}_issue_id_pattern".upcase)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
EacRubyUtils.patch(
|
48
|
+
Avm::Git::Issue::Complete,
|
49
|
+
Avmtrf1::Patches::Avm::Git::Issue::Complete
|
50
|
+
)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/launcher/base'
|
4
|
+
require 'eac_ruby_utils/patch'
|
5
|
+
require 'active_support/concern'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Patches
|
9
|
+
module Avm
|
10
|
+
module Git
|
11
|
+
module Launcher
|
12
|
+
module Base
|
13
|
+
extend ActiveSupport::Concern
|
14
|
+
|
15
|
+
included do
|
16
|
+
include InstanceMethods
|
17
|
+
end
|
18
|
+
|
19
|
+
module InstanceMethods
|
20
|
+
def status_files
|
21
|
+
execute!('-c', 'core.quotepath=off', 'status', '--porcelain')
|
22
|
+
.each_line.map do |line|
|
23
|
+
parse_status_file(line)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def parse_status_file(line)
|
30
|
+
m = /\A(.)(.)\s*(\S.*)\z/.match(line.strip)
|
31
|
+
return ::OpenStruct.new(stage: m[1], dirty: m[2], path: m[3]) if m # rubocop:disable Style/OpenStructUse
|
32
|
+
|
33
|
+
raise "\"#{line.strip}\" did not match pattern"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
EacRubyUtils.patch(
|
44
|
+
Avm::Git::Launcher::Base,
|
45
|
+
Avmtrf1::Patches::Avm::Git::Launcher::Base
|
46
|
+
)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'avmtrf1/docker/image'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Php
|
9
|
+
module DockerImages
|
10
|
+
class Base < ::Avmtrf1::Docker::Image
|
11
|
+
enable_abstract_methods
|
12
|
+
abstract_methods :mcrypt_install, :xdebug_pecl_package
|
13
|
+
|
14
|
+
GD_OPTIONS = %w[--with-gd --with-webp-dir --with-jpeg-dir --with-png-dir --with-zlib-dir
|
15
|
+
--with-xpm-dir --with-freetype-dir].freeze
|
16
|
+
PLATFORM_STEREOTYPE_TAG = 'php'
|
17
|
+
|
18
|
+
class << self
|
19
|
+
# @return [Gem::Version]
|
20
|
+
def php_version
|
21
|
+
const_get('PHP_VERSION')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
def php_dist_curl_args
|
27
|
+
'-sS "https://www.php.net/distributions/php-$PHP_VERSION.tar.gz"'
|
28
|
+
end
|
29
|
+
|
30
|
+
def platform_stereotype_tag
|
31
|
+
PLATFORM_STEREOTYPE_TAG
|
32
|
+
end
|
33
|
+
|
34
|
+
def write_in_provide_dir
|
35
|
+
::Avmtrf1::Php::DockerImages::Base.template.apply(self, provide_dir)
|
36
|
+
end
|
37
|
+
|
38
|
+
def gd_options
|
39
|
+
GD_OPTIONS.join(' ')
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [String]
|
43
|
+
def xdebug_install
|
44
|
+
"RUN pecl install #{xdebug_pecl_package}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/php/docker_images/v5'
|
4
|
+
require 'avmtrf1/php/docker_images/v7'
|
5
|
+
require 'avmtrf1/php/docker_images/v7_v4'
|
6
|
+
require 'avmtrf1/php/docker_images/v8'
|
7
|
+
require 'eac_ruby_utils/core_ext'
|
8
|
+
require 'rubygems'
|
9
|
+
|
10
|
+
module Avmtrf1
|
11
|
+
module Php
|
12
|
+
module DockerImages
|
13
|
+
class Factory
|
14
|
+
VERSIONS = [
|
15
|
+
::Avmtrf1::Php::DockerImages::V8,
|
16
|
+
::Avmtrf1::Php::DockerImages::V7V4,
|
17
|
+
::Avmtrf1::Php::DockerImages::V7,
|
18
|
+
::Avmtrf1::Php::DockerImages::V5
|
19
|
+
].freeze
|
20
|
+
|
21
|
+
common_constructor :platform_version do
|
22
|
+
self.platform_version = ::Gem::Version.new(platform_version)
|
23
|
+
end
|
24
|
+
|
25
|
+
def result
|
26
|
+
versions = VERSIONS.dup
|
27
|
+
lesser_version = versions.pop
|
28
|
+
versions.each do |version|
|
29
|
+
return version if platform_version >= version.php_version
|
30
|
+
end
|
31
|
+
|
32
|
+
lesser_version
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/php/docker_images/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Php
|
8
|
+
module DockerImages
|
9
|
+
class V5 < ::Avmtrf1::Php::DockerImages::Base
|
10
|
+
MCRYPT_INSTALL = <<~CODE
|
11
|
+
RUN docker-php-ext-install mcrypt
|
12
|
+
CODE
|
13
|
+
XDEBUG_INSTALL = <<~CODE
|
14
|
+
RUN apt-get install -y git
|
15
|
+
RUN cd /tmp && \
|
16
|
+
git clone https://github.com/xdebug/xdebug.git && \
|
17
|
+
cd xdebug && \
|
18
|
+
git checkout XDEBUG_2_5_5 && \
|
19
|
+
phpize && \
|
20
|
+
./configure --enable-xdebug && \
|
21
|
+
make && \
|
22
|
+
make install && \
|
23
|
+
rm -rf /tmp/xdebug
|
24
|
+
CODE
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def apt_setup
|
28
|
+
debian_stretch_apt_setup
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def php_dist_curl_args
|
33
|
+
"--insecure #{super}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def mcrypt_install
|
37
|
+
MCRYPT_INSTALL
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
def xdebug_install
|
42
|
+
XDEBUG_INSTALL
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/php/docker_images/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Php
|
8
|
+
module DockerImages
|
9
|
+
class V7 < ::Avmtrf1::Php::DockerImages::Base
|
10
|
+
MCRYPT_INSTALL = <<~CODE
|
11
|
+
RUN pecl install mcrypt
|
12
|
+
RUN echo extension=mcrypt.so > "$PHP_INI_DIR/conf.d/mcrypt.ini"
|
13
|
+
CODE
|
14
|
+
PHP_VERSION = ::Gem::Version.new('7')
|
15
|
+
XDEBUG_PECL_PACKAGE = 'xdebug-3.1.6'
|
16
|
+
|
17
|
+
def mcrypt_install
|
18
|
+
MCRYPT_INSTALL
|
19
|
+
end
|
20
|
+
|
21
|
+
def xdebug_pecl_package
|
22
|
+
XDEBUG_PECL_PACKAGE
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/php/docker_images/v7'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Php
|
8
|
+
module DockerImages
|
9
|
+
class V7V4 < ::Avmtrf1::Php::DockerImages::V7
|
10
|
+
GD_OPTION_PARSER = /\A(.+)-dir\z/.to_parser do |m|
|
11
|
+
m[1]
|
12
|
+
end
|
13
|
+
GD_OPTION_REJECT = %w[--with-gd --with-png --with-zlib].freeze
|
14
|
+
PHP_VERSION = ::Gem::Version.new('7.4')
|
15
|
+
|
16
|
+
# Referência: https://github.com/docker-library/php/issues/912
|
17
|
+
def gd_options
|
18
|
+
GD_OPTIONS
|
19
|
+
.map { |option| gd_option_replace(option) }
|
20
|
+
.reject { |option| GD_OPTION_REJECT.include?(option) }
|
21
|
+
.join(' ')
|
22
|
+
end
|
23
|
+
|
24
|
+
def gd_option_replace(option)
|
25
|
+
GD_OPTION_PARSER.parse(option).if_present(option)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/php/docker_images/v7_v4'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avmtrf1
|
7
|
+
module Php
|
8
|
+
module DockerImages
|
9
|
+
class V8 < ::Avmtrf1::Php::DockerImages::V7V4
|
10
|
+
PHP_VERSION = ::Gem::Version.new('8')
|
11
|
+
XDEBUG_PECL_PACKAGE = 'xdebug'
|
12
|
+
|
13
|
+
def xdebug_pecl_package
|
14
|
+
XDEBUG_PECL_PACKAGE
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/avmtrf1/php.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/red/server'
|
4
|
+
require 'avmtrf1/red/helper'
|
5
|
+
require 'pp' # rubocop:disable Lint/RedundantRequireStatement
|
6
|
+
require 'tempfile'
|
7
|
+
|
8
|
+
module Avmtrf1
|
9
|
+
module Red
|
10
|
+
class Client
|
11
|
+
include ::Avmtrf1::Red::Helper
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def by_ini_profile(ini_profile)
|
15
|
+
::Avmtrf1::Red::Client.new(
|
16
|
+
::Avmtrf1::Red::Server.by_ini_profile(ini_profile),
|
17
|
+
ini_profile.to_h('parametros.')
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :server, :login, :ip, :sistema, :nome_maquina
|
23
|
+
|
24
|
+
def initialize(server, parametros)
|
25
|
+
@server = server
|
26
|
+
@login = parametros.fetch('login')
|
27
|
+
@ip = parametros.fetch('ip')
|
28
|
+
@sistema = parametros.fetch('sistema')
|
29
|
+
@nome_maquina = parametros.fetch('nomeMaquina')
|
30
|
+
end
|
31
|
+
|
32
|
+
def authorization_url
|
33
|
+
xml = post_xml('/REDCentral/autorizacaoinclusao', xml_content('authorization'))
|
34
|
+
xml.at_xpath('/root/retornoSolicitacaoInclusao/@url')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_envs/http/request'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'erb'
|
6
|
+
require 'nokogiri'
|
7
|
+
|
8
|
+
module Avmtrf1
|
9
|
+
module Red
|
10
|
+
module Helper
|
11
|
+
common_concern do
|
12
|
+
enable_speaker
|
13
|
+
end
|
14
|
+
|
15
|
+
def post(url, *post_args)
|
16
|
+
infom "Requesting \"#{url}\""
|
17
|
+
::EacEnvs::Http::Request.new.url(url.to_s).verb(:post).body_data(post_args.first).response
|
18
|
+
.body_str_or_raise
|
19
|
+
end
|
20
|
+
|
21
|
+
def post_xml(url_suffix, xml_body)
|
22
|
+
url = server.resource_url(url_suffix)
|
23
|
+
::Nokogiri::XML(post(url, xml_body))
|
24
|
+
end
|
25
|
+
|
26
|
+
def xml_content(name)
|
27
|
+
::ERB.new(::File.read(xml_path(name))).result(binding)
|
28
|
+
end
|
29
|
+
|
30
|
+
def xml_path(name)
|
31
|
+
::File.join(__dir__, self.class.name.demodulize.underscore, "#{name}.xml.erb")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<root>
|
2
|
+
<MetadadosInclusao
|
3
|
+
dataHoraProducaoConteudo="<%= Time.now.strftime('%d/%m/%Y %H:%I:%S') %>"
|
4
|
+
numeroPasta="<%= metadados.fetch('numeroPasta') %>"
|
5
|
+
descricaoTituloDocumento="<%= metadados.fetch('descricaoTituloDocumento') %>"
|
6
|
+
numeroTipoSigilo="<%= metadados.fetch('numeroSigiloPublico') %>"
|
7
|
+
nomeSistemaIntrodutor="<%= client.sistema %>"
|
8
|
+
ipMaquinaResponsavelIntervencao = "<%= client.ip %>"
|
9
|
+
secaoOrigemDocumento ="<%= metadados.fetch('secaoOrigemDocumento') %>"
|
10
|
+
prioridadeReplicacao="<%= metadados.fetch('prioridadeReplicacaoNormal') %>"
|
11
|
+
espacoDocumento="<%= metadados.fetch('espacoDocumento') %>"
|
12
|
+
indicadorAnotacao="<%= metadados.fetch('indicadorAnotacaoMinutaTemporario') %>"
|
13
|
+
nomeMaquinaResponsavelIntervensao="<%= metadados.fetch('nomeMaquinaResponsavelIntervensao') %>"
|
14
|
+
>
|
15
|
+
|
16
|
+
<SecaoDestino idSecao = "<%= metadados.fetch('secaoDestinoIdSecao') %>"/>
|
17
|
+
|
18
|
+
</MetadadosInclusao>
|
19
|
+
</root>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/red/client'
|
4
|
+
require 'avmtrf1/red/helper'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avmtrf1
|
8
|
+
module Red
|
9
|
+
class Profile
|
10
|
+
include ::Avmtrf1::Red::Helper
|
11
|
+
enable_simple_cache
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def by_ini_profile(ini_profile)
|
15
|
+
new(
|
16
|
+
::Avmtrf1::Red::Client.by_ini_profile(ini_profile),
|
17
|
+
ini_profile.to_h('metadados.')
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# @!method initialize(client, metadados)
|
23
|
+
# @param client [Avmtrf1::Red::Client]
|
24
|
+
# @param metadados [Hash]
|
25
|
+
common_constructor :client, :metadados
|
26
|
+
|
27
|
+
def put_file(file_path)
|
28
|
+
auth_url = client.authorization_url
|
29
|
+
infov 'Authorization URL', auth_url
|
30
|
+
put_file_request(auth_url, file_path)
|
31
|
+
end
|
32
|
+
|
33
|
+
delegate :server, to: :client
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def put_file_request(auth_url, file_path)
|
38
|
+
post(auth_url, put_file_body(file_path))
|
39
|
+
end
|
40
|
+
|
41
|
+
def metadados_file_path_uncached
|
42
|
+
file = Tempfile.new(['red_metadados', '.xml'])
|
43
|
+
::File.write(file.path, xml_content('put_file'))
|
44
|
+
file.path
|
45
|
+
end
|
46
|
+
|
47
|
+
def put_file_body(file_path)
|
48
|
+
infov 'Metadados', ::File.read(metadados_file_path)
|
49
|
+
{
|
50
|
+
'ip' => client.ip,
|
51
|
+
'login' => client.login,
|
52
|
+
'metadado' => ::File.open(metadados_file_path, 'r'),
|
53
|
+
'conteudo' => ::File.open(file_path, 'r')
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/red/client'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Red
|
7
|
+
class Server
|
8
|
+
class << self
|
9
|
+
def by_ini_profile(ini_profile)
|
10
|
+
new(ini_profile.fetch('red.server'))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :host
|
15
|
+
|
16
|
+
def initialize(host)
|
17
|
+
@host = host
|
18
|
+
end
|
19
|
+
|
20
|
+
def client(login, ip, sistema, nome_maquina)
|
21
|
+
::Avmtrf1::Red::Client.new(self, login, ip, sistema, nome_maquina)
|
22
|
+
end
|
23
|
+
|
24
|
+
def root_url
|
25
|
+
"http://#{host}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def resource_url(url_suffix)
|
29
|
+
"#{root_url}#{url_suffix}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/avmtrf1/red.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/rest_provider/entity'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Redmine
|
7
|
+
module Entities
|
8
|
+
class Issue < ::Avmtrf1::RestProvider::Entity
|
9
|
+
delegate :closed?, to: :status
|
10
|
+
|
11
|
+
def data
|
12
|
+
super.fetch('issue')
|
13
|
+
end
|
14
|
+
|
15
|
+
def status
|
16
|
+
@status ||= instance.issue_status(status_id)
|
17
|
+
end
|
18
|
+
|
19
|
+
def status_name
|
20
|
+
data.fetch('status').fetch('name')
|
21
|
+
end
|
22
|
+
|
23
|
+
def status_id
|
24
|
+
data.fetch('status').fetch('id')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avmtrf1/rest_provider/entity'
|
4
|
+
|
5
|
+
module Avmtrf1
|
6
|
+
module Redmine
|
7
|
+
module Entities
|
8
|
+
class IssueStatus < ::Avmtrf1::RestProvider::Entity
|
9
|
+
def id
|
10
|
+
data.fetch('id')
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
data.fetch('name')
|
15
|
+
end
|
16
|
+
|
17
|
+
def closed?
|
18
|
+
data.fetch('is_closed')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|