avmtrf1-tools 0.31.1 → 0.33.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avmtrf1/active_directory/user.rb +3 -3
- data/lib/avmtrf1/check_point/session.rb +10 -9
- data/lib/avmtrf1/core_ext.rb +4 -0
- data/lib/avmtrf1/default_jira.rb +2 -2
- data/lib/avmtrf1/executables.rb +10 -2
- data/lib/avmtrf1/git/cached_repository.rb +2 -2
- data/lib/avmtrf1/git/issue_on_repository.rb +2 -2
- data/lib/avmtrf1/git/push_large.rb +4 -4
- data/lib/avmtrf1/git/push_large/lfs_commit.rb +5 -10
- data/lib/avmtrf1/git/push_large/lfs_commit/cache.rb +19 -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/source_commit.rb +4 -7
- data/lib/avmtrf1/git/push_large/source_commit/push.rb +42 -0
- data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base.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/patches.rb +3 -0
- data/lib/avmtrf1/patches/avm.rb +4 -0
- data/lib/avmtrf1/patches/avm/git.rb +4 -0
- data/lib/avmtrf1/patches/avm/git/issue.rb +4 -0
- data/lib/avmtrf1/patches/avm/launcher.rb +4 -0
- data/lib/avmtrf1/patches/avm/launcher/git.rb +4 -0
- data/lib/avmtrf1/patches/avm/launcher/git/base.rb +46 -0
- data/lib/avmtrf1/red/helper.rb +2 -2
- data/lib/avmtrf1/template.rb +2 -2
- data/lib/avmtrf1/tools/application.rb +13 -0
- data/lib/avmtrf1/tools/runner.rb +18 -25
- data/lib/avmtrf1/tools/runner/check_point.rb +3 -3
- data/lib/avmtrf1/tools/runner/check_point/login.rb +6 -6
- data/lib/avmtrf1/tools/runner/esosti.rb +4 -4
- data/lib/avmtrf1/tools/runner/esosti/changed.rb +5 -5
- data/lib/avmtrf1/tools/runner/esosti/fetch.rb +5 -5
- data/lib/avmtrf1/tools/runner/esosti/request.rb +5 -5
- data/lib/avmtrf1/tools/runner/forponto.rb +7 -7
- data/lib/avmtrf1/tools/runner/forponto/espelho.rb +6 -6
- data/lib/avmtrf1/tools/runner/forponto/marcacoes.rb +5 -5
- data/lib/avmtrf1/tools/runner/forponto/resumos.rb +6 -6
- data/lib/avmtrf1/tools/runner/forponto/saldo.rb +6 -6
- data/lib/avmtrf1/tools/runner/git.rb +2 -2
- data/lib/avmtrf1/tools/runner/git/issues_check.rb +8 -19
- data/lib/avmtrf1/tools/runner/git/push_large.rb +28 -19
- 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 +16 -23
- data/lib/avmtrf1/tools/runner/oracle/query.rb +11 -13
- data/lib/avmtrf1/tools/runner/oracle/source_get.rb +18 -19
- data/lib/avmtrf1/tools/runner/oracle/user_clear.rb +8 -16
- data/lib/avmtrf1/tools/runner/php.rb +8 -15
- data/lib/avmtrf1/tools/runner/php/docker.rb +21 -31
- data/lib/avmtrf1/tools/runner/red.rb +22 -26
- data/lib/avmtrf1/tools/runner/trf1_dspace_base0.rb +10 -19
- data/lib/avmtrf1/tools/runner/trf1_dspace_base0/deploy.rb +2 -2
- data/lib/avmtrf1/tools/version.rb +1 -1
- data/template/avmtrf1/php/docker_image/Dockerfile.template +4 -1
- metadata +30 -93
- data/lib/avmtrf1/configs.rb +0 -24
- data/lib/avmtrf1/git/push_large/lfs_commit/_00_checkout_previous_revision.rb +0 -33
- data/lib/avmtrf1/git/push_large/lfs_commit/_01_cherry_pick_source_revision.rb +0 -89
- data/lib/avmtrf1/git/push_large/lfs_commit/_02_track_large_files.rb +0 -51
- data/lib/avmtrf1/git/push_large/lfs_commit/_03_commit_changes.rb +0 -46
- data/lib/avmtrf1/git/push_large/lfs_commit/_04_push.rb +0 -88
- data/lib/avmtrf1/git/push_large/lfs_commit/_cache.rb +0 -17
- data/lib/avmtrf1/git/push_large/lfs_commit/_helpers.rb +0 -27
- data/lib/avmtrf1/git/push_large/source_commit/_push.rb +0 -40
- data/lib/avmtrf1/patches/eac_launcher/git/base.rb +0 -43
@@ -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
|
@@ -1,29 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avmtrf1/core_ext'
|
3
4
|
require 'avmtrf1/oracle/connection/base.rb'
|
4
5
|
require 'avmtrf1/oracle/connection/string_builder.rb'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
6
|
|
7
7
|
module Avmtrf1
|
8
8
|
module Tools
|
9
|
-
class Runner
|
10
|
-
class Oracle
|
9
|
+
class Runner
|
10
|
+
class Oracle
|
11
11
|
require_sub __FILE__
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
-h --help Show this screen
|
21
|
-
-H --host=<host> Host Oracle (Ex.: 172.16.3.3)
|
22
|
-
-p --port=<port> Porta Oracle (Ex.: 1521) (Padrão: 1521).
|
23
|
-
-s --service-name=<service> Serviço Oracle (Ex.: trf1.trf1.gov.br)
|
24
|
-
-u --user=<user> Usuário Oracle
|
25
|
-
-w --password=<password> Senha Oracle
|
26
|
-
DOCOPT
|
12
|
+
runner_with :help, :subcommands do
|
13
|
+
arg_opt '-H', '--host', 'Host Oracle (Ex.: 172.16.3.3)'
|
14
|
+
arg_opt '-p', '--port', 'Porta Oracle (Ex.: 1521) (Padrão: 1521)'
|
15
|
+
arg_opt '-s', '--service-name', 'Serviço Oracle (Ex.: trf1.trf1.gov.br)'
|
16
|
+
arg_opt '-u', '--user', 'Usuário Oracle'
|
17
|
+
arg_opt '-w', '--password', 'Senha Oracle'
|
18
|
+
subcommands
|
19
|
+
end
|
27
20
|
|
28
21
|
def connection
|
29
22
|
@connection ||= ::Avmtrf1::Oracle::Connection::Base.new(connection_string)
|
@@ -31,11 +24,11 @@ module Avmtrf1
|
|
31
24
|
|
32
25
|
def connection_string
|
33
26
|
::Avmtrf1::Oracle::Connection::StringBuilder.new(
|
34
|
-
host:
|
35
|
-
port:
|
36
|
-
user:
|
37
|
-
password:
|
38
|
-
service_name:
|
27
|
+
host: parsed.host,
|
28
|
+
port: parsed.port,
|
29
|
+
user: parsed.user,
|
30
|
+
password: parsed.password,
|
31
|
+
service_name: parsed.service_name
|
39
32
|
).build
|
40
33
|
end
|
41
34
|
end
|
@@ -1,20 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/default_runner'
|
4
|
-
require '
|
5
|
-
require 'eac_ruby_utils/
|
4
|
+
require 'eac_cli/docopt_runner'
|
5
|
+
require 'eac_ruby_utils/patches/module/speaker'
|
6
6
|
|
7
7
|
module Avmtrf1
|
8
8
|
module Tools
|
9
|
-
class Runner
|
10
|
-
class Oracle
|
11
|
-
class Query
|
12
|
-
include ::EacCli::DefaultRunner
|
13
|
-
|
9
|
+
class Runner
|
10
|
+
class Oracle
|
11
|
+
class Query
|
14
12
|
DEFAULT_COLUMN_SEPARATOR = "\t"
|
15
13
|
DEFAULT_ROW_SEPARATOR = "\n"
|
16
14
|
|
17
|
-
|
15
|
+
runner_with :help do
|
18
16
|
desc 'Executa queries Oracle.'
|
19
17
|
arg_opt '-c', '--column-sep', 'Separator de colunas.'
|
20
18
|
bool_opt '-C', '--columns', 'Imprime o nome das colunas.'
|
@@ -32,7 +30,7 @@ module Avmtrf1
|
|
32
30
|
end
|
33
31
|
|
34
32
|
def print_header
|
35
|
-
return unless
|
33
|
+
return unless parsed.columns?
|
36
34
|
|
37
35
|
print_row(cursor.column_metadata.map(&:name))
|
38
36
|
end
|
@@ -46,7 +44,7 @@ module Avmtrf1
|
|
46
44
|
end
|
47
45
|
|
48
46
|
def print_footer
|
49
|
-
return unless
|
47
|
+
return unless parsed.count?
|
50
48
|
|
51
49
|
print_row(["Count: #{count}"])
|
52
50
|
end
|
@@ -54,11 +52,11 @@ module Avmtrf1
|
|
54
52
|
private
|
55
53
|
|
56
54
|
def column_separator_uncached
|
57
|
-
|
55
|
+
parsed.column_sep.if_present(DEFAULT_COLUMN_SEPARATOR)
|
58
56
|
end
|
59
57
|
|
60
58
|
def cursor_uncached
|
61
|
-
|
59
|
+
runner_context.call(:connection).query(parsed.sql)
|
62
60
|
end
|
63
61
|
|
64
62
|
def print_row(array)
|
@@ -66,7 +64,7 @@ module Avmtrf1
|
|
66
64
|
end
|
67
65
|
|
68
66
|
def row_separator_uncached
|
69
|
-
|
67
|
+
parsed.row_sep.if_present(DEFAULT_ROW_SEPARATOR)
|
70
68
|
end
|
71
69
|
end
|
72
70
|
end
|
@@ -1,32 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/console/speaker'
|
3
|
+
require 'avmtrf1/core_ext'
|
5
4
|
|
6
5
|
module Avmtrf1
|
7
6
|
module Tools
|
8
|
-
class Runner
|
9
|
-
class Oracle
|
10
|
-
class SourceGet
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
__PROGRAM__ [options] <name> <type>
|
16
|
-
__PROGRAM__ -h | --help
|
17
|
-
|
18
|
-
Options:
|
19
|
-
-h --help Show this screen
|
20
|
-
DOCOPT
|
7
|
+
class Runner
|
8
|
+
class Oracle
|
9
|
+
class SourceGet
|
10
|
+
runner_with :help do
|
11
|
+
pos_arg :name
|
12
|
+
pos_arg :type
|
13
|
+
end
|
21
14
|
|
22
15
|
TABLE = 'all_source'
|
23
16
|
|
24
17
|
def name
|
25
|
-
|
18
|
+
parsed.name
|
26
19
|
end
|
27
20
|
|
28
21
|
def type
|
29
|
-
|
22
|
+
parsed.type
|
30
23
|
end
|
31
24
|
|
32
25
|
def run
|
@@ -34,13 +27,13 @@ module Avmtrf1
|
|
34
27
|
infov('Type', type)
|
35
28
|
infov('Found', found_count)
|
36
29
|
infov('Enconding', OCI8.encoding)
|
37
|
-
|
30
|
+
connection.query(sql(false)) do |row|
|
38
31
|
out(row['TEXT'].encode('UTF-8').to_s)
|
39
32
|
end
|
40
33
|
end
|
41
34
|
|
42
35
|
def found_count
|
43
|
-
|
36
|
+
connection.unique_value(sql(true)).to_i
|
44
37
|
end
|
45
38
|
|
46
39
|
def sql(count)
|
@@ -49,6 +42,12 @@ module Avmtrf1
|
|
49
42
|
selection += " and lower(type) = lower('#{type}')" if type.present?
|
50
43
|
"select #{projection} from #{TABLE} where #{selection} order by line"
|
51
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def connection
|
49
|
+
runner_context.call(:connection)
|
50
|
+
end
|
52
51
|
end
|
53
52
|
end
|
54
53
|
end
|
@@ -1,19 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
-
require 'eac_ruby_utils/console/speaker'
|
3
|
+
require 'avmtrf1/core_ext'
|
6
4
|
|
7
5
|
module Avmtrf1
|
8
6
|
module Tools
|
9
|
-
class Runner
|
10
|
-
class Oracle
|
11
|
-
class UserClear
|
12
|
-
include ::EacCli::DefaultRunner
|
13
|
-
|
7
|
+
class Runner
|
8
|
+
class Oracle
|
9
|
+
class UserClear
|
14
10
|
SELECTED_TYPES = %w[FUNCTION PACKAGE PROCEDURE SEQUENCE TABLE VIEW].freeze
|
15
11
|
|
16
|
-
|
12
|
+
runner_with :confirmation, :help do
|
17
13
|
desc 'Remove todos os objetos (Tabelas, views, etc) de um usuário Oracle.'
|
18
14
|
bool_opt '-y', '--yes', 'Remove sem perguntar.'
|
19
15
|
bool_opt '-d', '--drop', 'Remove os objetos.'
|
@@ -39,8 +35,8 @@ module Avmtrf1
|
|
39
35
|
end
|
40
36
|
|
41
37
|
def drop_objects
|
42
|
-
return unless
|
43
|
-
return unless confirm?
|
38
|
+
return unless parsed.drop
|
39
|
+
return unless confirm?('Confirma a remoção?')
|
44
40
|
|
45
41
|
infom 'Removendo objetos...'
|
46
42
|
objects.each do |object|
|
@@ -49,12 +45,8 @@ module Avmtrf1
|
|
49
45
|
end
|
50
46
|
end
|
51
47
|
|
52
|
-
def confirm?
|
53
|
-
options.fetch('--yes') || request_input('Confirma a remoção?', bool: true)
|
54
|
-
end
|
55
|
-
|
56
48
|
def owner_uncached
|
57
|
-
|
49
|
+
runner_context.call(:connection).objects.first(name: parsed.owner_name, type: :user)
|
58
50
|
end
|
59
51
|
|
60
52
|
def objects_uncached
|
@@ -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
|
@@ -37,8 +27,8 @@ module Avmtrf1
|
|
37
27
|
end
|
38
28
|
|
39
29
|
def default_versions
|
40
|
-
::
|
41
|
-
|
30
|
+
::Avm::Apps::Config.current.read_entry('php.default_versions').split(',').map(&:strip)
|
31
|
+
.reject(&:blank?)
|
42
32
|
end
|
43
33
|
|
44
34
|
def 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 || ::Avm::Apps::Config.current.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
|