eac_tools 0.80.0 → 0.82.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +29 -20
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +2 -2
  5. data/sub/avm/lib/avm/application_scms/base.rb +17 -6
  6. data/sub/avm/lib/avm/applications/base/auto_local_source_path.rb +24 -0
  7. data/sub/avm/lib/avm/applications/base/local_source.rb +1 -1
  8. data/sub/avm/lib/avm/applications/base/scm.rb +2 -2
  9. data/sub/avm/lib/avm/registry/application_scms.rb +2 -2
  10. data/sub/avm/lib/avm/sources/base/sub/remove.rb +38 -0
  11. data/sub/avm/lib/avm/sources/base/sub.rb +26 -0
  12. data/sub/avm/lib/avm/sources/base/subs.rb +7 -0
  13. data/sub/avm/lib/avm/version.rb +1 -1
  14. data/sub/avm/locale/en.yml +6 -0
  15. data/sub/avm/locale/pt-BR.yml +6 -0
  16. data/sub/avm/spec/lib/avm/applications/base/entries_spec.rb +4 -2
  17. data/sub/avm/spec/lib/avm/applications/base/entries_spec_files/config.yml +1 -0
  18. data/sub/avm-eac_github_base0/Gemfile +2 -2
  19. data/sub/avm-eac_github_base0/avm-eac_github_base0.gemspec +3 -2
  20. data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/api/entity.rb +1 -1
  21. data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/application_scms/base.rb +30 -2
  22. data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/version.rb +1 -1
  23. data/sub/avm-eac_github_base0/spec/lib/avm/eac_github_base0/application_scms/base_spec.rb +40 -0
  24. data/sub/avm-eac_github_base0/spec/rubocop_spec.rb +1 -1
  25. data/sub/avm-eac_github_base0/spec/spec_helper.rb +1 -1
  26. data/sub/avm-eac_gitlab_base0/Gemfile +8 -0
  27. data/sub/avm-eac_gitlab_base0/avm-eac_gitlab_base0.gemspec +20 -0
  28. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/base_entity.rb +72 -0
  29. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb +33 -0
  30. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/group.rb +49 -0
  31. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/member.rb +25 -0
  32. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/node.rb +20 -0
  33. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/nodes_set.rb +118 -0
  34. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/project.rb +65 -0
  35. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/root.rb +30 -0
  36. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api.rb +43 -0
  37. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/application_scms/base.rb +13 -0
  38. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/application_scms.rb +11 -0
  39. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/instances/base.rb +18 -0
  40. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/version.rb +7 -0
  41. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0.rb +9 -0
  42. data/sub/avm-eac_gitlab_base0/spec/lib/avm/eac_gitlab_base0/application_scms/base_spec.rb +7 -0
  43. data/sub/avm-eac_gitlab_base0/spec/rubocop_spec.rb +3 -0
  44. data/sub/avm-eac_gitlab_base0/spec/spec_helper.rb +4 -0
  45. data/sub/avm-git/Gemfile +2 -2
  46. data/sub/avm-git/avm-git.gemspec +3 -4
  47. data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +49 -0
  48. data/sub/avm-git/lib/avm/git/application_scms/base.rb +21 -0
  49. data/sub/avm-git/lib/avm/git/application_scms.rb +11 -0
  50. data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +2 -2
  51. data/sub/avm-git/lib/avm/git/issue/complete/push.rb +2 -2
  52. data/sub/avm-git/lib/avm/git/issue.rb +1 -1
  53. data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +4 -4
  54. data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +1 -1
  55. data/sub/avm-git/lib/avm/git/launcher/base.rb +1 -0
  56. data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +1 -2
  57. data/sub/avm-git/lib/avm/git/launcher/remote.rb +2 -2
  58. data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +3 -2
  59. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +2 -2
  60. data/sub/avm-git/lib/avm/git/organize/repository.rb +1 -1
  61. data/sub/avm-git/lib/avm/git/revision_test.rb +2 -2
  62. data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +1 -0
  63. data/sub/avm-git/lib/avm/git/scms/git/commit.rb +1 -1
  64. data/sub/avm-git/lib/avm/git/scms/git/interval.rb +1 -1
  65. data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +1 -1
  66. data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +1 -1
  67. data/sub/avm-git/lib/avm/git/subrepo_checks.rb +1 -0
  68. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  69. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +2 -2
  70. data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +4 -4
  71. data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +10 -10
  72. data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +11 -11
  73. data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +1 -1
  74. data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +1 -1
  75. data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +3 -3
  76. data/sub/avm-git/spec/rubocop_spec.rb +1 -1
  77. data/sub/avm-git/spec/spec_helper.rb +1 -1
  78. data/sub/avm-tools/avm-tools.gemspec +3 -3
  79. data/sub/avm-tools/lib/avm/tools/runner/application/info.rb +2 -1
  80. data/sub/avm-tools/lib/avm/tools/runner/source/sub/remove.rb +22 -0
  81. data/sub/avm-tools/lib/avm/tools/runner/source/sub.rb +29 -0
  82. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  83. data/sub/eac_cli/eac_cli.gemspec +2 -2
  84. data/sub/eac_cli/lib/eac_cli/definition/alternative.rb +4 -4
  85. data/sub/eac_cli/lib/eac_cli/definition/argument_option.rb +2 -2
  86. data/sub/eac_cli/lib/eac_cli/definition/boolean_option.rb +3 -4
  87. data/sub/eac_cli/lib/eac_cli/definition/{base_option → option}/initialize_args_parser.rb +1 -1
  88. data/sub/eac_cli/lib/eac_cli/definition/option.rb +73 -0
  89. data/sub/eac_cli/lib/eac_cli/definition/option_or_positional.rb +43 -0
  90. data/sub/eac_cli/lib/eac_cli/definition/{positional_argument.rb → positional.rb} +14 -22
  91. data/sub/eac_cli/lib/eac_cli/definition.rb +17 -3
  92. data/sub/eac_cli/lib/eac_cli/parser/alternative/argv.rb +2 -0
  93. data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +10 -1
  94. data/sub/eac_cli/lib/eac_cli/parser/alternative.rb +20 -0
  95. data/sub/eac_cli/lib/eac_cli/parser/collector.rb +10 -1
  96. data/sub/eac_cli/lib/eac_cli/rspec.rb +1 -1
  97. data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +1 -1
  98. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  99. data/sub/eac_cli/spec/lib/eac_cli/parser/alternative/subcommands_spec.rb +58 -0
  100. data/sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +1 -52
  101. data/sub/eac_cli/spec/lib/eac_cli/runner/for_context_spec.rb +3 -3
  102. data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb +2 -2
  103. metadata +45 -21
  104. data/sub/avm-eac_github_base0/spec/avm/eac_github_base0/application_scms/base_spec.rb +0 -7
  105. data/sub/eac_cli/lib/eac_cli/definition/base_option.rb +0 -68
  106. data/sub/eac_cli/lib/eac_cli/definition/default_value.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c7d9d14e62f4976d146dd5a901953270551a16e154e5d08a7d525552848b706
4
- data.tar.gz: 7b2f94a28c65415e62cd6983b4b501dfff63a67265010c8e54e12f690073b519
3
+ metadata.gz: 708d42ba52d2d044676786c93ad0213f7ace3709a8c7463232283ed38fb65fd7
4
+ data.tar.gz: 8258727a71e6eecb3f2bb4d9513381bec6303e405bfd35e49ddcd193d26d0a4b
5
5
  SHA512:
6
- metadata.gz: 747cdfc35f0f0cfb9a2b783b857c41208b80a2e5b28683336b35258a34541b1ebf1bf90b201ce3eb1b71e97a16ba61008a0f19cbc73f8650c73cbd423fb4074d
7
- data.tar.gz: 53c4d156592347bbf7143ee2b5a0dc860d7d93aa6b5fb40cf6faec55dd4e2d7a7f529a99c1539495d1ad50cbfa659bdd4ee4218edc004e45f9a0a5d5f39e5fbc
6
+ metadata.gz: 01442d1e31829b644915a656db3c53c33643fff0706a2cc2848ef72abf95370049b6d98d5128739679b30fd8692cff897bf42c9fe164e2a088f5912343d9b48d
7
+ data.tar.gz: 6a2bd15e0ce916d2f99d0cb71048efadda6961d373614df80b04fce683ff89b522e402683a8533c966fa7e2b0b6278eaed2b02af621c4c2877be8bdefc3ee02d
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.80.0)
5
- avm (~> 0.81)
4
+ eac_tools (0.82.0)
5
+ avm (~> 0.83)
6
6
  avm-eac_asciidoctor_base0 (~> 0.19)
7
7
  avm-eac_generic_base0 (~> 0.12, >= 0.12.1)
8
- avm-eac_github_base0 (~> 0.2)
8
+ avm-eac_github_base0 (~> 0.3)
9
9
  avm-eac_latex_base0 (~> 0.3, >= 0.3.1)
10
10
  avm-eac_php_base0 (~> 0.4, >= 0.4.2)
11
11
  avm-eac_postgresql_base0 (~> 0.5, >= 0.5.2)
@@ -17,8 +17,8 @@ PATH
17
17
  avm-eac_ruby_base1 (~> 0.33)
18
18
  avm-eac_webapp_base0 (~> 0.18, >= 0.18.2)
19
19
  avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
20
- avm-git (~> 0.13, >= 0.13.4)
21
- avm-tools (~> 0.157)
20
+ avm-git (~> 0.14)
21
+ avm-tools (~> 0.159)
22
22
  eac_ruby_utils (~> 0.119, >= 0.119.2)
23
23
 
24
24
  PATH
@@ -41,11 +41,19 @@ PATH
41
41
  PATH
42
42
  remote: sub/avm-eac_github_base0
43
43
  specs:
44
- avm-eac_github_base0 (0.2.0)
45
- avm (~> 0.81)
44
+ avm-eac_github_base0 (0.3.0)
45
+ avm (~> 0.82)
46
+ avm-git (~> 0.14)
46
47
  eac_rest (~> 0.10)
47
48
  eac_ruby_utils (~> 0.119, >= 0.119.2)
48
49
 
50
+ PATH
51
+ remote: sub/avm-eac_gitlab_base0
52
+ specs:
53
+ avm-eac_gitlab_base0 (0.4.0)
54
+ avm-eac_github_base0 (~> 0.3)
55
+ eac_ruby_utils (~> 0.119, >= 0.119.2)
56
+
49
57
  PATH
50
58
  remote: sub/avm-eac_latex_base0
51
59
  specs:
@@ -162,23 +170,23 @@ PATH
162
170
  PATH
163
171
  remote: sub/avm-git
164
172
  specs:
165
- avm-git (0.13.4)
166
- avm (~> 0.79)
173
+ avm-git (0.14.0)
174
+ avm (~> 0.82)
167
175
  avm-files (~> 0.6, >= 0.6.2)
168
176
  eac_git (~> 0.14, >= 0.14.1)
169
- eac_ruby_utils (~> 0.119, >= 0.119.1)
177
+ eac_ruby_utils (~> 0.119, >= 0.119.2)
170
178
  git (~> 1.18)
171
179
 
172
180
  PATH
173
181
  remote: sub/avm-tools
174
182
  specs:
175
- avm-tools (0.157.0)
183
+ avm-tools (0.159.0)
176
184
  aranha-parsers (~> 0.21)
177
- avm (~> 0.81)
178
- avm-eac_ruby_base1 (~> 0.32, >= 0.32.1)
185
+ avm (~> 0.83)
186
+ avm-eac_ruby_base1 (~> 0.33)
179
187
  avm-eac_ubuntu_base0 (~> 0.5)
180
188
  avm-files (~> 0.6, >= 0.6.2)
181
- avm-git (~> 0.13, >= 0.13.4)
189
+ avm-git (~> 0.14)
182
190
  clipboard (~> 1.3, >= 1.3.6)
183
191
  curb (~> 0.9, >= 0.9.11)
184
192
  eac_git (~> 0.14, >= 0.14.1)
@@ -190,9 +198,9 @@ PATH
190
198
  PATH
191
199
  remote: sub/avm
192
200
  specs:
193
- avm (0.81.0)
201
+ avm (0.83.0)
194
202
  aranha-parsers (~> 0.21)
195
- eac_cli (~> 0.38)
203
+ eac_cli (~> 0.38, >= 0.38.1)
196
204
  eac_config (~> 0.14, >= 0.14.1)
197
205
  eac_docker (~> 0.7)
198
206
  eac_fs (~> 0.16)
@@ -206,9 +214,9 @@ PATH
206
214
  PATH
207
215
  remote: sub/eac_cli
208
216
  specs:
209
- eac_cli (0.38.0)
217
+ eac_cli (0.38.1)
210
218
  colorize (~> 0.8, >= 0.8.1)
211
- eac_config (~> 0.14)
219
+ eac_config (~> 0.14, >= 0.14.1)
212
220
  eac_ruby_utils (~> 0.119, >= 0.119.2)
213
221
 
214
222
  PATH
@@ -245,7 +253,7 @@ GEM
245
253
  ofx-parser (~> 1.1)
246
254
  asciidoctor (2.0.20)
247
255
  ast (2.4.2)
248
- base64 (0.1.1)
256
+ base64 (0.2.0)
249
257
  clipboard (1.3.6)
250
258
  colorize (0.8.1)
251
259
  concurrent-ruby (1.2.2)
@@ -332,7 +340,7 @@ GEM
332
340
  racc
333
341
  parslet (2.0.0)
334
342
  public_suffix (5.0.3)
335
- racc (1.7.1)
343
+ racc (1.7.3)
336
344
  rack (3.0.8)
337
345
  rainbow (3.1.1)
338
346
  rchardet (1.8.0)
@@ -394,6 +402,7 @@ DEPENDENCIES
394
402
  avm-eac_asciidoctor_base0!
395
403
  avm-eac_generic_base0!
396
404
  avm-eac_github_base0!
405
+ avm-eac_gitlab_base0!
397
406
  avm-eac_latex_base0!
398
407
  avm-eac_php_base0!
399
408
  avm-eac_postgresql_base0!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.80.0'
4
+ VERSION = '0.82.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Eduardo H. Bogoni']
11
11
  s.summary = 'Ruby base library for Agora Vai! Methodology (https://avm.esquiloazul.tech).'
12
12
 
13
- s.files = Dir['{lib}/**/*']
13
+ s.files = Dir['{lib, locale}/**/*']
14
14
 
15
15
  s.add_dependency 'aranha-parsers', '~> 0.21'
16
- s.add_dependency 'eac_cli', '~> 0.38'
16
+ s.add_dependency 'eac_cli', '~> 0.38', '>= 0.38.1'
17
17
  s.add_dependency 'eac_config', '~> 0.14', '>= 0.14.1'
18
18
  s.add_dependency 'eac_docker', '~> 0.7'
19
19
  s.add_dependency 'eac_fs', '~> 0.16'
@@ -5,6 +5,8 @@ require 'eac_ruby_utils/core_ext'
5
5
  module Avm
6
6
  module ApplicationScms
7
7
  class Base
8
+ acts_as_abstract
9
+
8
10
  class << self
9
11
  # @return [String]
10
12
  def type_name
@@ -12,16 +14,25 @@ module Avm
12
14
  end
13
15
  end
14
16
 
15
- # !method initialize(url)
16
- # @param url [Addressable::URI]
17
- common_constructor :url do
18
- self.url = url.to_uri
19
- end
17
+ # !method initialize(application)
18
+ # @param application [Avm::Application::Base]
19
+ common_constructor :application
20
20
  delegate :type_name, to: :class
21
21
 
22
+ # @param path [Pathname]
23
+ # @return [Pathname]
24
+ def assert_main_at(path) # rubocop:disable Lint/UnusedMethodArgument
25
+ raise_abstract_method __method__
26
+ end
27
+
22
28
  # @return [String]
23
29
  def to_s
24
- "#{type_name}[#{url}]"
30
+ "#{type_name}[#{to_s_type_specific}]"
31
+ end
32
+
33
+ # @return [String]
34
+ def to_s_type_specific
35
+ ''
25
36
  end
26
37
  end
27
38
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/core_ext'
4
+
5
+ module Avm
6
+ module Applications
7
+ class Base
8
+ class AutoLocalSourcePath
9
+ acts_as_instance_method
10
+ common_constructor :application
11
+
12
+ # @return [Pathname]
13
+ def result
14
+ application.scm.assert_main_at(fs_cache.path.to_pathname)
15
+ end
16
+
17
+ # @return [String]
18
+ def fs_object_id
19
+ application.id.to_s.parameterize
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -10,7 +10,7 @@ module Avm
10
10
  module LocalSource
11
11
  # @return [Pathname]
12
12
  def local_source_path
13
- local_source_path_entry.value!.to_pathname
13
+ (local_source_path_entry.value || auto_local_source_path).to_pathname
14
14
  end
15
15
 
16
16
  # @return [EacConfig::Entry]
@@ -8,12 +8,12 @@ module Avm
8
8
  class Base
9
9
  module Scm
10
10
  common_concern do
11
- uri_components_entries_values 'scm', %w[repos_path type]
11
+ uri_components_entries_values 'scm', %w[repos_path ssh_username type]
12
12
  end
13
13
 
14
14
  # @return [Avm::ApplicationScms::Base]
15
15
  def scm
16
- @scm ||= ::Avm::Registry.application_scms.detect(scm_type, scm_url)
16
+ @scm ||= ::Avm::Registry.application_scms.detect(self)
17
17
  end
18
18
 
19
19
  # @param value [String]
@@ -6,9 +6,9 @@ module Avm
6
6
  module Registry
7
7
  class ApplicationScms < ::Avm::Registry::FromGems
8
8
  def class_detect(klass, detect_args)
9
- return nil unless klass.type_name == detect_args[0]
9
+ return nil unless klass.type_name == detect_args.fetch(0).scm_type
10
10
 
11
- klass.new(*detect_args[1..-1])
11
+ klass.new(*detect_args)
12
12
  end
13
13
  end
14
14
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Sources
7
+ class Base
8
+ class Sub
9
+ class Remove
10
+ acts_as_instance_method
11
+
12
+ # !method initialize(sub)
13
+ # @param sub [Avm::Sources::Base::Sub]
14
+ common_constructor :sub
15
+ delegate :source, to: :sub
16
+
17
+ # @return [void]
18
+ def result
19
+ source.scm.commit_if_change(commit_message) { do_changes }
20
+ end
21
+
22
+ private
23
+
24
+ # @return [String]
25
+ def commit_message
26
+ sub.i18n_translate(:remove_commit_message, sub_path: sub.sub_path)
27
+ end
28
+
29
+ # @return [void]
30
+ def do_changes
31
+ ::FileUtils.rm_rf(sub.absolute_path)
32
+ source.on_sub_updated
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/base/subs_paths'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ class Sub
10
+ # !method initialize(source, sub_path)
11
+ # @param source [Avm::Sources::Base]
12
+ # @param sub_path [Pathname]
13
+ common_constructor :source, :sub_path do
14
+ self.sub_path = sub_path.to_pathname
15
+ end
16
+
17
+ # @return [Pathname]
18
+ def absolute_path
19
+ sub_path.expand_path(source.path)
20
+ end
21
+
22
+ require_sub __FILE__, require_mode: :kernel
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/sources/base/sub'
3
4
  require 'avm/sources/base/subs_paths'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -17,6 +18,12 @@ module Avm
17
18
  subs.lazy.map { |sub| path.expand_path.child_of?(sub.path) ? sub : nil }.find(&:present?)
18
19
  end
19
20
 
21
+ # @param sub_path [Pathname]
22
+ # @return [Avm::Sources::Base::Sub]
23
+ def sub(sub_path)
24
+ ::Avm::Sources::Base::Sub.new(self, sub_path)
25
+ end
26
+
20
27
  # @return [Enumerable<Avm::Sources::Base>]
21
28
  def subs
22
29
  subs_paths_to_search
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.81.0'
4
+ VERSION = '0.83.0'
5
5
  end
@@ -0,0 +1,6 @@
1
+ en:
2
+ avm:
3
+ sources:
4
+ base:
5
+ sub:
6
+ remove_commit_message: 'Sub[%{sub_path}]: remove.'
@@ -0,0 +1,6 @@
1
+ pt-BR:
2
+ avm:
3
+ sources:
4
+ base:
5
+ sub:
6
+ remove_commit_message: 'Sub[%{sub_path}]: remove.'
@@ -10,7 +10,8 @@ RSpec.describe ::Avm::Applications::Base do
10
10
  'scm.id' => 'app1',
11
11
  'scm.type' => 'ScmX',
12
12
  'scm.url' => 'http://nowhere.net/anypath',
13
- 'scm.repos_path' => 'mygroup/app0'
13
+ 'scm.repos_path' => 'mygroup/app0',
14
+ 'scm.ssh_username' => 'myuser'
14
15
  },
15
16
  'app1' => {
16
17
  'name' => nil,
@@ -18,7 +19,8 @@ RSpec.describe ::Avm::Applications::Base do
18
19
  'scm.id' => nil,
19
20
  'scm.type' => 'ScmX',
20
21
  'scm.url' => 'http://nowhere.net/anypath',
21
- 'scm.repos_path' => 'mygroup'
22
+ 'scm.repos_path' => 'mygroup',
23
+ 'scm.ssh_username' => 'myuser'
22
24
  }
23
25
  }
24
26
 
@@ -9,3 +9,4 @@ app1:
9
9
  url: http://nowhere.net/anypath
10
10
  type: ScmX
11
11
  repos_path: mygroup
12
+ ssh_username: myuser
@@ -4,5 +4,5 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
- eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
7
+ local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if File.exist?(local_gemfile)
@@ -13,9 +13,10 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
  s.required_ruby_version = '>= 2.7'
15
15
 
16
- s.add_dependency 'avm', '~> 0.81'
16
+ s.add_dependency 'avm', '~> 0.82'
17
+ s.add_dependency 'avm-git', '~> 0.14'
17
18
  s.add_dependency 'eac_rest', '~> 0.10'
18
19
  s.add_dependency 'eac_ruby_utils', '~> 0.119', '>= 0.119.2'
19
20
 
20
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.8', '>= 0.8.2'
21
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.9'
21
22
  end
@@ -13,7 +13,7 @@ module Avm
13
13
  while url_suffix.present?
14
14
  response = api.request_json(url_suffix).response
15
15
  r += response.body_data_or_raise
16
- .map { |child_data| child_entity(entity_class, child_data) }
16
+ .map { |child_data| child_entity(entity_class, child_data) }
17
17
  url_suffix = response.link('next')
18
18
  end
19
19
  r
@@ -1,12 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/application_scms/base'
3
+ require 'avm/git/application_scms/base'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacGithubBase0
8
8
  module ApplicationScms
9
- class Base < ::Avm::ApplicationScms::Base
9
+ class Base < ::Avm::Git::ApplicationScms::Base
10
+ REPOSITORY_URL_SUFFIX = '.git'
11
+
12
+ # @return [Addressable::URI]
13
+ def git_https_url
14
+ r = web_url.dup
15
+ r.path = "#{r.path}#{REPOSITORY_URL_SUFFIX}"
16
+ r
17
+ end
18
+
19
+ # @return [Addressable::URI]
20
+ def git_ssh_url
21
+ ::Addressable::URI.new(
22
+ scheme: 'ssh',
23
+ user: application.scm_ssh_username,
24
+ host: web_url.host,
25
+ path: "#{application.scm_repos_path}#{REPOSITORY_URL_SUFFIX}"
26
+ )
27
+ end
28
+
29
+ # @return [String]
30
+ def to_s_type_specific
31
+ web_url.to_s
32
+ end
33
+
34
+ # @return [Addressable::URI]
35
+ def web_url
36
+ application.scm_url.to_uri + application.scm_repos_path.to_s
37
+ end
10
38
  end
11
39
  end
12
40
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacGithubBase0
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_github_base0/application_scms/base'
4
+
5
+ RSpec.describe Avm::EacGithubBase0::ApplicationScms::Base do
6
+ let(:stub_application) do
7
+ {
8
+ scm_url: 'https://github.com'.to_uri,
9
+ scm_repos_path: 'esquilo-azul/eac_tools'.to_pathname,
10
+ scm_ssh_username: 'git'
11
+ }.to_struct
12
+ end
13
+ let(:instance) { described_class.new(stub_application) }
14
+
15
+ include_examples 'in_avm_registry', 'application_scms'
16
+
17
+ describe '#git_https_url' do
18
+ it do
19
+ expect(instance.git_https_url).to(
20
+ eq(Addressable::URI.parse('https://github.com/esquilo-azul/eac_tools.git'))
21
+ )
22
+ end
23
+ end
24
+
25
+ describe '#git_ssh_url' do
26
+ it do
27
+ expect(instance.git_ssh_url).to(
28
+ eq(Addressable::URI.parse('ssh://git@github.com/esquilo-azul/eac_tools.git'))
29
+ )
30
+ end
31
+ end
32
+
33
+ describe '#web_url' do
34
+ it do
35
+ expect(instance.web_url).to(
36
+ eq(Addressable::URI.parse('https://github.com/esquilo-azul/eac_tools'))
37
+ )
38
+ end
39
+ end
40
+ end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
3
+ EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
4
+ EacRubyUtils::Rspec.default_setup_create(File.expand_path('..', __dir__))
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if File.exist?(local_gemfile)
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/eac_gitlab_base0/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-eac_gitlab_base0'
9
+ s.version = Avm::EacGitlabBase0::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+ s.required_ruby_version = '>= 2.7'
15
+
16
+ s.add_dependency 'avm-eac_github_base0', '~> 0.3'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.119', '>= 0.119.2'
18
+
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.9'
20
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_rest/api'
4
+ require 'eac_rest/entity'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacGitlabBase0
9
+ class Api < ::EacRest::Api
10
+ class BaseEntity < ::EacRest::Entity
11
+ enable_simple_cache
12
+
13
+ def delete(url_suffix)
14
+ api.request(url_suffix).verb(:delete).response.body_data
15
+ end
16
+
17
+ def encode_id(id)
18
+ return id if id.is_a?(::Integer)
19
+
20
+ ::CGI.escape(id.to_s)
21
+ end
22
+
23
+ def fetch_entity(suffix, klass, not_found_message = nil)
24
+ validate_response_data(
25
+ dump_response(api.request_json(suffix).response),
26
+ not_found_message
27
+ ).if_present { |v| klass.new(api, v) }
28
+ end
29
+
30
+ def fetch_entities(suffix, klass)
31
+ r = []
32
+ request = api.request_json(suffix)
33
+ while request
34
+ response = request.response
35
+ r += validate_response_data(response).map { |rr| klass.new(api, rr) }
36
+ request = response.link('next').if_present do |v|
37
+ api.request_json(v)
38
+ end
39
+ end
40
+ r
41
+ end
42
+
43
+ def dump_response(response)
44
+ basename = response.url.to_s.variableize[0..99]
45
+ { data: response.body_data, headers: response.headers, links: response.links }
46
+ .each { |part, value| dump_debug("#{basename}_#{part}", value) }
47
+ response
48
+ end
49
+
50
+ def dump_debug(basename, data)
51
+ file = ::Pathname.new('/tmp').join('gitlab_temp', "#{basename}.yaml")
52
+ file.parent.mkpath
53
+ ::EacRubyUtils::Yaml.dump_file(file, data)
54
+ end
55
+
56
+ def validate_response_data(response, not_found_message = nil)
57
+ if response.body_data.is_a?(::Hash)
58
+ response.body_data['error'].if_present do |v|
59
+ raise "URL: #{response.url}, Data: #{v}"
60
+ end
61
+
62
+ response.body_data['message'].if_present do |v|
63
+ return nil if v == not_found_message
64
+ end
65
+ end
66
+
67
+ response.body_data
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end