avmtrf1-tools 0.31.2 → 0.33.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avmtrf1/active_directory/user.rb +3 -3
  3. data/lib/avmtrf1/core_ext.rb +4 -0
  4. data/lib/avmtrf1/default_jira.rb +2 -2
  5. data/lib/avmtrf1/executables.rb +10 -2
  6. data/lib/avmtrf1/git/cached_repository.rb +2 -2
  7. data/lib/avmtrf1/git/issue_on_repository.rb +2 -2
  8. data/lib/avmtrf1/git/push_large.rb +4 -4
  9. data/lib/avmtrf1/git/push_large/lfs_commit.rb +5 -10
  10. data/lib/avmtrf1/git/push_large/lfs_commit/cache.rb +19 -0
  11. data/lib/avmtrf1/git/push_large/lfs_commit/checkout_previous_revision.rb +35 -0
  12. data/lib/avmtrf1/git/push_large/lfs_commit/commit_changes.rb +48 -0
  13. data/lib/avmtrf1/git/push_large/lfs_commit/helpers.rb +29 -0
  14. data/lib/avmtrf1/git/push_large/lfs_commit/pick_source_revision.rb +103 -0
  15. data/lib/avmtrf1/git/push_large/lfs_commit/push.rb +90 -0
  16. data/lib/avmtrf1/git/push_large/lfs_commit/track_large_files.rb +53 -0
  17. data/lib/avmtrf1/git/push_large/source_commit.rb +4 -7
  18. data/lib/avmtrf1/git/push_large/source_commit/push.rb +42 -0
  19. data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base.rb +1 -1
  20. data/lib/avmtrf1/openvpn/config/builder.rb +59 -0
  21. data/lib/avmtrf1/openvpn/config/parser.rb +20 -0
  22. data/lib/avmtrf1/openvpn/config/parser/builder.rb +62 -0
  23. data/lib/avmtrf1/openvpn/config/parser/line.rb +47 -0
  24. data/lib/avmtrf1/openvpn/config/parser/simple.rb +27 -0
  25. data/lib/avmtrf1/openvpn/config/parser/tag.rb +39 -0
  26. data/lib/avmtrf1/patches.rb +3 -0
  27. data/lib/avmtrf1/patches/avm.rb +4 -0
  28. data/lib/avmtrf1/patches/avm/git.rb +4 -0
  29. data/lib/avmtrf1/patches/avm/git/issue.rb +4 -0
  30. data/lib/avmtrf1/patches/avm/launcher.rb +4 -0
  31. data/lib/avmtrf1/patches/avm/launcher/git.rb +4 -0
  32. data/lib/avmtrf1/patches/avm/launcher/git/base.rb +46 -0
  33. data/lib/avmtrf1/red/helper.rb +2 -2
  34. data/lib/avmtrf1/template.rb +2 -2
  35. data/lib/avmtrf1/tools/application.rb +13 -0
  36. data/lib/avmtrf1/tools/runner.rb +18 -25
  37. data/lib/avmtrf1/tools/runner/check_point.rb +8 -14
  38. data/lib/avmtrf1/tools/runner/check_point/login.rb +7 -20
  39. data/lib/avmtrf1/tools/runner/esosti.rb +9 -21
  40. data/lib/avmtrf1/tools/runner/esosti/changed.rb +10 -23
  41. data/lib/avmtrf1/tools/runner/esosti/fetch.rb +10 -23
  42. data/lib/avmtrf1/tools/runner/esosti/request.rb +18 -30
  43. data/lib/avmtrf1/tools/runner/forponto.rb +14 -24
  44. data/lib/avmtrf1/tools/runner/forponto/espelho.rb +12 -22
  45. data/lib/avmtrf1/tools/runner/forponto/marcacoes.rb +8 -19
  46. data/lib/avmtrf1/tools/runner/forponto/resumos.rb +8 -20
  47. data/lib/avmtrf1/tools/runner/forponto/saldo.rb +11 -22
  48. data/lib/avmtrf1/tools/runner/git.rb +3 -5
  49. data/lib/avmtrf1/tools/runner/git/issues_check.rb +8 -19
  50. data/lib/avmtrf1/tools/runner/git/push_large.rb +28 -19
  51. data/lib/avmtrf1/tools/runner/inventario_sistemas.rb +7 -9
  52. data/lib/avmtrf1/tools/runner/openvpn.rb +91 -0
  53. data/lib/avmtrf1/tools/runner/oracle.rb +16 -23
  54. data/lib/avmtrf1/tools/runner/oracle/query.rb +10 -14
  55. data/lib/avmtrf1/tools/runner/oracle/source_get.rb +18 -19
  56. data/lib/avmtrf1/tools/runner/oracle/user_clear.rb +8 -16
  57. data/lib/avmtrf1/tools/runner/php.rb +8 -15
  58. data/lib/avmtrf1/tools/runner/php/docker.rb +21 -31
  59. data/lib/avmtrf1/tools/runner/red.rb +22 -26
  60. data/lib/avmtrf1/tools/runner/trf1_dspace_base0.rb +10 -19
  61. data/lib/avmtrf1/tools/runner/trf1_dspace_base0/deploy.rb +2 -2
  62. data/lib/avmtrf1/tools/version.rb +1 -1
  63. data/template/avmtrf1/php/docker_image/Dockerfile.template +4 -1
  64. metadata +30 -93
  65. data/lib/avmtrf1/configs.rb +0 -24
  66. data/lib/avmtrf1/git/push_large/lfs_commit/_00_checkout_previous_revision.rb +0 -33
  67. data/lib/avmtrf1/git/push_large/lfs_commit/_01_cherry_pick_source_revision.rb +0 -89
  68. data/lib/avmtrf1/git/push_large/lfs_commit/_02_track_large_files.rb +0 -51
  69. data/lib/avmtrf1/git/push_large/lfs_commit/_03_commit_changes.rb +0 -46
  70. data/lib/avmtrf1/git/push_large/lfs_commit/_04_push.rb +0 -88
  71. data/lib/avmtrf1/git/push_large/lfs_commit/_cache.rb +0 -17
  72. data/lib/avmtrf1/git/push_large/lfs_commit/_helpers.rb +0 -27
  73. data/lib/avmtrf1/git/push_large/source_commit/_push.rb +0 -40
  74. data/lib/avmtrf1/patches/eac_launcher/git/base.rb +0 -43
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'active_support/concern'
4
4
  require 'active_support/core_ext/string'
5
- require 'eac_ruby_utils/console/speaker'
5
+ require 'eac_ruby_utils/patches/module/speaker'
6
6
  require 'erb'
7
7
  require 'httpclient'
8
8
  require 'nokogiri'
@@ -13,7 +13,7 @@ module Avmtrf1
13
13
  extend ::ActiveSupport::Concern
14
14
 
15
15
  included do
16
- include ::EacRubyUtils::Console::Speaker
16
+ enable_speaker
17
17
  end
18
18
 
19
19
  def http_client
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/templates/searcher'
3
+ require 'eac_templates/searcher'
4
4
 
5
- ::EacRubyUtils::Templates::Searcher.default.included_paths <<
5
+ ::EacTemplates::Searcher.default.included_paths <<
6
6
  ::File.expand_path('../../template', __dir__)
@@ -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
@@ -1,38 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/apps/config'
3
4
  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
5
  require 'avmtrf1/ruby/gems/not_found_error'
8
- require 'eac_ruby_utils/console/speaker'
6
+ require 'avmtrf1/tools/application'
7
+ require 'eac_ruby_base0/runner'
9
8
 
10
9
  module Avmtrf1
11
10
  module Tools
12
- class Runner < ::EacRubyUtils::Console::DocoptRunner
13
- ::EacRubyUtils.require_sub(__FILE__)
14
- include ::EacRubyUtils::Console::Speaker
15
-
16
- DOC = <<~DOCOPT
17
- Utilidades para AVM-TRF1 (http://redmine.trf1.gov.br/projects/avm-trf1).
18
-
19
- Usage:
20
- __PROGRAM__ [options] __SUBCOMMANDS__
21
- __PROGRAM__ -h | --help
22
- __PROGRAM__ --version
11
+ class Runner
12
+ require_sub __FILE__
13
+ include ::EacRubyBase0::Runner
14
+
15
+ runner_definition do
16
+ desc 'Utilidades para AVM-TRF1 (http://redmine.trf1.gov.br/projects/avm-trf1).'
17
+ bool_opt '-H', '--headless',
18
+ 'Quando usando Selenium não mostra a interface gráfica do navegador web.'
19
+ end
23
20
 
24
- Options:
25
- -h --help Show this screen.
26
- -v --version Show version.
27
- -H --headless Quando usando Selenium não mostra a interface gráfica do navegador web.
28
- DOCOPT
21
+ def application
22
+ ::Avmtrf1::Tools.application
23
+ end
29
24
 
30
25
  def run
31
- ::Aranha::Selenium::DriverFactory::Base.default_headless = options.fetch('--headless')
32
- if options.fetch('--version')
33
- out(::Avmtrf1::Tools::VERSION + "\n")
34
- else
35
- run_with_subcommand
26
+ ::Avm::Apps::Config.context.on(application.build_config) do
27
+ ::Aranha::Selenium::DriverFactory::Base.default_headless = parsed.headless?
28
+ super
36
29
  end
37
30
  rescue ::Avmtrf1::Ruby::Gems::NotFoundError => e
38
31
  on_gem_not_found(e.dependency)
@@ -1,22 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'avmtrf1/tools/runner/check_point/login'
3
+ require 'avmtrf1/core_ext'
5
4
 
6
5
  module Avmtrf1
7
6
  module Tools
8
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
- class CheckPoint < ::EacRubyUtils::Console::DocoptRunner
10
- DOC = <<~DOCOPT
11
- Utilidades para Check Point (https://cp.trf1.jus.br).
12
-
13
- Usage:
14
- __PROGRAM__ __SUBCOMMANDS__
15
- __PROGRAM__ -h | --help
16
-
17
- Options:
18
- -h --help Mostra esta ajuda.
19
- DOCOPT
7
+ class Runner
8
+ class CheckPoint
9
+ require_sub __FILE__
10
+ runner_with :help, :subcommands do
11
+ desc 'Utilidades para Check Point (https://cp.trf1.jus.br).'
12
+ subcommands
13
+ end
20
14
  end
21
15
  end
22
16
  end
@@ -1,29 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'eac_ruby_utils/simple_cache'
6
- require 'avmtrf1'
7
3
  require 'avmtrf1/check_point/session'
4
+ require 'avmtrf1/core_ext'
8
5
 
9
6
  module Avmtrf1
10
7
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class CheckPoint < ::EacRubyUtils::Console::DocoptRunner
13
- class Login < ::EacRubyUtils::Console::DocoptRunner
14
- include ::EacRubyUtils::SimpleCache
15
- include ::EacRubyUtils::Console::Speaker
16
-
17
- DOC = <<~DOCOPT
18
- Login no CheckPoint (https://cp.trf1.jus.br).
19
-
20
- Usage:
21
- __PROGRAM__ [options]
22
- __PROGRAM__ -h | --help
23
-
24
- Options:
25
- -h --help Mostra esta ajuda.
26
- DOCOPT
8
+ class Runner
9
+ class CheckPoint
10
+ class Login
11
+ runner_with :help do
12
+ desc 'Login no CheckPoint (https://cp.trf1.jus.br).'
13
+ end
27
14
 
28
15
  def run
29
16
  infov 'Username', session.username
@@ -1,35 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'avmtrf1/core_ext'
5
4
  require 'avmtrf1/default_esosti'
6
- require 'avmtrf1/ini'
7
- require 'avmtrf1/red/profile'
8
5
 
9
6
  module Avmtrf1
10
7
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class Esosti < ::EacRubyUtils::Console::DocoptRunner
8
+ class Runner
9
+ class Esosti
13
10
  require_sub __FILE__
14
- enable_console_speaker
15
- enable_simple_cache
16
-
17
- DOC = <<~DOCOPT
18
- Utilidades para e-Sosti (Control Desk).
19
-
20
- Usage:
21
- __PROGRAM__ [options] __SUBCOMMANDS__
22
- __PROGRAM__ -h | --help
23
-
24
- Options:
25
- -h --help Mostra esta ajuda.
26
- -U --url=<url> Utiliza o Control Desk em <url>.
27
- DOCOPT
11
+ runner_with :help, :subcommands do
12
+ desc 'Utilidades para e-Sosti (Control Desk).'
13
+ arg_opt '-U', '--url', 'Utiliza o Control Desk em <url>.'
14
+ subcommands
15
+ end
28
16
 
29
17
  private
30
18
 
31
19
  def esosti_instance_uncached
32
- options.fetch('--url').if_present(::Avmtrf1.default_esosti) do |url|
20
+ parsed.url.if_present(::Avmtrf1.default_esosti) do |url|
33
21
  ::Avmtrf1.trf1_esosti(url)
34
22
  end
35
23
  end
@@ -1,29 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'avmtrf1/default_esosti'
6
- require 'avmtrf1/ini'
7
- require 'avmtrf1/red/profile'
3
+ require 'avmtrf1/core_ext'
8
4
 
9
5
  module Avmtrf1
10
6
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
- class Changed < ::EacRubyUtils::Console::DocoptRunner
14
- enable_console_speaker
15
- enable_simple_cache
16
-
17
- DOC = <<~DOCOPT
18
- Recupera o conteúdo de uma solicitação e-Sosti (Control Desk).
19
-
20
- Usage:
21
- __PROGRAM__ [options] <time>
22
- __PROGRAM__ -h | --help
23
-
24
- Options:
25
- -h --help Mostra esta ajuda.
26
- DOCOPT
7
+ class Runner
8
+ class Esosti
9
+ class Changed
10
+ runner_with :help do
11
+ desc 'Recupera o conteúdo de uma solicitação e-Sosti (Control Desk).'
12
+ pos_arg :time
13
+ end
27
14
 
28
15
  def run
29
16
  infov 'Time', time
@@ -39,11 +26,11 @@ module Avmtrf1
39
26
  end
40
27
 
41
28
  def request_uncached
42
- context(:esosti_instance).changed_request(time)
29
+ runner_context.call(:esosti_instance).changed_request(time)
43
30
  end
44
31
 
45
32
  def time
46
- ::Time.parse(options.fetch('<time>'))
33
+ ::Time.parse(parsed.time)
47
34
  end
48
35
  end
49
36
  end
@@ -1,29 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'avmtrf1/default_esosti'
6
- require 'avmtrf1/ini'
7
- require 'avmtrf1/red/profile'
3
+ require 'avmtrf1/core_ext'
8
4
 
9
5
  module Avmtrf1
10
6
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
- class Fetch < ::EacRubyUtils::Console::DocoptRunner
14
- enable_console_speaker
15
- enable_simple_cache
16
-
17
- DOC = <<~DOCOPT
18
- Recupera o conteúdo de uma solicitação e-Sosti (Control Desk).
19
-
20
- Usage:
21
- __PROGRAM__ [options] <solicitacao_id>
22
- __PROGRAM__ -h | --help
23
-
24
- Options:
25
- -h --help Mostra esta ajuda.
26
- DOCOPT
7
+ class Runner
8
+ class Esosti
9
+ class Fetch
10
+ runner_with :help do
11
+ desc 'Recupera o conteúdo de uma solicitação e-Sosti (Control Desk).'
12
+ pos_arg :solicitacao_id
13
+ end
27
14
 
28
15
  def run
29
16
  infov 'URL', request.url
@@ -34,7 +21,7 @@ module Avmtrf1
34
21
  private
35
22
 
36
23
  def request_uncached
37
- context(:esosti_instance).issue_request(solicitacao_id)
24
+ runner_context.call(:esosti_instance).issue_request(solicitacao_id)
38
25
  end
39
26
 
40
27
  def issue_uncached
@@ -43,7 +30,7 @@ module Avmtrf1
43
30
  end
44
31
 
45
32
  def solicitacao_id
46
- options.fetch('<solicitacao_id>')
33
+ parsed.solicitacao_id
47
34
  end
48
35
  end
49
36
  end
@@ -1,33 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'avmtrf1/default_esosti'
6
- require 'avmtrf1/ini'
7
- require 'avmtrf1/red/profile'
3
+ require 'avmtrf1/core_ext'
4
+ require 'yaml'
8
5
 
9
6
  module Avmtrf1
10
7
  module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class Esosti < ::EacRubyUtils::Console::DocoptRunner
13
- class Request < ::EacRubyUtils::Console::DocoptRunner
14
- enable_console_speaker
15
- enable_simple_cache
16
-
17
- DOC = <<~DOCOPT
18
- Requisições genéricas para e-Sosti (Control Desk).
19
-
20
- Usage:
21
- __PROGRAM__ [options] <url-suffix>
22
- __PROGRAM__ -h | --help
23
-
24
- Options:
25
- -h --help Mostra esta ajuda.
26
- -d --default Opções --json e --yaml.
27
- -j --json Solicita resposta em JSON.
28
- -x --xml Solicita resposta em XML.
29
- -y --yaml Imprime saída em YAML.
30
- DOCOPT
8
+ class Runner
9
+ class Esosti
10
+ class Request
11
+ runner_with :help do
12
+ desc 'Requisições genéricas para e-Sosti (Control Desk).'
13
+ bool_opt '-d', '--default', 'Opções --json e --yaml.'
14
+ bool_opt '-j', '--json', 'Solicita resposta em JSON.'
15
+ bool_opt '-x', '--xml', 'Solicita resposta em XML.'
16
+ bool_opt '-y', '--yaml', 'Imprime saída em YAML.'
17
+ pos_arg :url_suffix
18
+ end
31
19
 
32
20
  def run
33
21
  start_banner
@@ -37,7 +25,7 @@ module Avmtrf1
37
25
  private
38
26
 
39
27
  def json?
40
- options.fetch('--json') || options.fetch('--default')
28
+ parsed.json? || parsed.default?
41
29
  end
42
30
 
43
31
  def start_banner
@@ -55,7 +43,7 @@ module Avmtrf1
55
43
  end
56
44
 
57
45
  def request_uncached
58
- context(:esosti_instance).request(url_suffix, request_headers)
46
+ runner_context.call(:esosti_instance).request(url_suffix, request_headers)
59
47
  end
60
48
 
61
49
  def request_headers
@@ -71,15 +59,15 @@ module Avmtrf1
71
59
  end
72
60
 
73
61
  def url_suffix
74
- options.fetch('<url-suffix>')
62
+ parsed.url_suffix
75
63
  end
76
64
 
77
65
  def xml?
78
- options.fetch('--xml')
66
+ parsed.xml?
79
67
  end
80
68
 
81
69
  def yaml?
82
- options.fetch('--yaml') || options.fetch('--default')
70
+ parsed.yaml? || parsed.default?
83
71
  end
84
72
  end
85
73
  end
@@ -1,36 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'eac_ruby_utils/require_sub'
6
- ::EacRubyUtils.require_sub(__FILE__)
7
- require 'avmtrf1/configs'
3
+ require 'avm/apps/config'
4
+ require 'avmtrf1/core_ext'
8
5
  require 'avmtrf1/forponto/user'
9
6
 
10
7
  module Avmtrf1
11
8
  module Tools
12
- class Runner < ::EacRubyUtils::Console::DocoptRunner
13
- class Forponto < ::EacRubyUtils::Console::DocoptRunner
14
- include ::EacRubyUtils::SimpleCache
15
- include ::EacRubyUtils::Console::Speaker
9
+ class Runner
10
+ class Forponto
11
+ require_sub __FILE__
16
12
 
17
13
  DEFAULT_VALUES = {
18
14
  url: 'http://pontoeletronico.trf1.jus.br/forponto/fptoweb.exe'
19
15
  }.freeze
20
16
 
21
- DOC = <<~DOCOPT
22
- Operações para Forponto.
23
-
24
- Usage:
25
- __PROGRAM__ [options] __SUBCOMMANDS__
26
- __PROGRAM__ -h | --help
27
-
28
- Options:
29
- -h --help Show this screen.
30
- -u --url=<url> URL inicial.
31
- -m --matricula=<matricula> Matrícula.
32
- -c --codigo=<codigo> Código.
33
- DOCOPT
17
+ runner_with :help, :subcommands do
18
+ desc 'Operações para Forponto.'
19
+ arg_opt '-u', '--url', 'URL inicial.'
20
+ arg_opt '-m', '--matricula', 'Matrícula.'
21
+ arg_opt '-c', '--codigo', 'Código.'
22
+ subcommands
23
+ end
34
24
 
35
25
  def run
36
26
  start_banner
@@ -47,7 +37,7 @@ module Avmtrf1
47
37
  end
48
38
 
49
39
  def value_by_option(name)
50
- options.fetch("--#{name}")
40
+ parsed.fetch(name)
51
41
  end
52
42
 
53
43
  def value_by_default(name)
@@ -55,7 +45,7 @@ module Avmtrf1
55
45
  end
56
46
 
57
47
  def value_by_entry(name, read_options)
58
- ::Avmtrf1.configs.read_entry("trf1.forponto.#{name}", read_options)
48
+ ::Avm::Apps::Config.current.read_entry("trf1.forponto.#{name}", read_options)
59
49
  end
60
50
 
61
51
  def user_uncached