eac_tools 0.80.0 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -16
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/lib/avm/application_scms/base.rb +17 -6
- data/sub/avm/lib/avm/applications/base/auto_local_source_path.rb +24 -0
- data/sub/avm/lib/avm/applications/base/local_source.rb +1 -1
- data/sub/avm/lib/avm/applications/base/scm.rb +2 -2
- data/sub/avm/lib/avm/registry/application_scms.rb +2 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/applications/base/entries_spec.rb +4 -2
- data/sub/avm/spec/lib/avm/applications/base/entries_spec_files/config.yml +1 -0
- data/sub/avm-eac_github_base0/Gemfile +2 -2
- data/sub/avm-eac_github_base0/avm-eac_github_base0.gemspec +3 -2
- data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/api/entity.rb +1 -1
- data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/application_scms/base.rb +30 -2
- data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/version.rb +1 -1
- data/sub/avm-eac_github_base0/spec/lib/avm/eac_github_base0/application_scms/base_spec.rb +40 -0
- data/sub/avm-eac_github_base0/spec/rubocop_spec.rb +1 -1
- data/sub/avm-eac_github_base0/spec/spec_helper.rb +1 -1
- data/sub/avm-eac_gitlab_base0/Gemfile +8 -0
- data/sub/avm-eac_gitlab_base0/avm-eac_gitlab_base0.gemspec +20 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/base_entity.rb +72 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb +33 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/group.rb +49 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/member.rb +25 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/node.rb +20 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/nodes_set.rb +118 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/project.rb +65 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/root.rb +30 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api.rb +43 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/application_scms/base.rb +13 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/application_scms.rb +11 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/instances/base.rb +18 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/version.rb +7 -0
- data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0.rb +9 -0
- data/sub/avm-eac_gitlab_base0/spec/lib/avm/eac_gitlab_base0/application_scms/base_spec.rb +7 -0
- data/sub/avm-eac_gitlab_base0/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_gitlab_base0/spec/spec_helper.rb +4 -0
- data/sub/avm-git/Gemfile +2 -2
- data/sub/avm-git/avm-git.gemspec +3 -4
- data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +49 -0
- data/sub/avm-git/lib/avm/git/application_scms/base.rb +21 -0
- data/sub/avm-git/lib/avm/git/application_scms.rb +11 -0
- data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +2 -2
- data/sub/avm-git/lib/avm/git/issue/complete/push.rb +2 -2
- data/sub/avm-git/lib/avm/git/issue.rb +1 -1
- data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +4 -4
- data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +1 -1
- data/sub/avm-git/lib/avm/git/launcher/base.rb +1 -0
- data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +1 -2
- data/sub/avm-git/lib/avm/git/launcher/remote.rb +2 -2
- data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +3 -2
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +2 -2
- data/sub/avm-git/lib/avm/git/organize/repository.rb +1 -1
- data/sub/avm-git/lib/avm/git/revision_test.rb +2 -2
- data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +1 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit.rb +1 -1
- data/sub/avm-git/lib/avm/git/scms/git/interval.rb +1 -1
- data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +1 -1
- data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +1 -1
- data/sub/avm-git/lib/avm/git/subrepo_checks.rb +1 -0
- data/sub/avm-git/lib/avm/git/version.rb +1 -1
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +2 -2
- data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +4 -4
- data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +10 -10
- data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +11 -11
- data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +1 -1
- data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +1 -1
- data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +3 -3
- data/sub/avm-git/spec/rubocop_spec.rb +1 -1
- data/sub/avm-git/spec/spec_helper.rb +1 -1
- data/sub/avm-tools/avm-tools.gemspec +3 -3
- data/sub/avm-tools/lib/avm/tools/runner/application/info.rb +2 -1
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- metadata +34 -17
- data/sub/avm-eac_github_base0/spec/avm/eac_github_base0/application_scms/base_spec.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d2e685c6164fa7bbf8b6c8aff6f6b893482bb469306379210cc7d54d8ea3f05
|
|
4
|
+
data.tar.gz: acedb29f75ec68d89fe776ea05976050519ec549f9f328f4de56835109c32710
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb5a6a90e7655ac953173526517d7de438f76f25d8f11f9ecc0a64d013d260311cb8779595a773416e22dd3fc6fbf01f0002eefbcaf7eaf0df874c38e140b186
|
|
7
|
+
data.tar.gz: 45a9f8b13ac0a309fe00568f4ee4911a84eb9d8a9caaac14c3412c02f489d8802ce82362e2c4fd9e742e260d2bf5cfc56e61e05010f833e8bb327a1d7b87aee3
|
data/Gemfile.lock
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
eac_tools (0.
|
|
5
|
-
avm (~> 0.
|
|
4
|
+
eac_tools (0.81.0)
|
|
5
|
+
avm (~> 0.82)
|
|
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.
|
|
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.
|
|
21
|
-
avm-tools (~> 0.
|
|
20
|
+
avm-git (~> 0.14)
|
|
21
|
+
avm-tools (~> 0.158)
|
|
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.
|
|
45
|
-
avm (~> 0.
|
|
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.
|
|
166
|
-
avm (~> 0.
|
|
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.
|
|
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.
|
|
183
|
+
avm-tools (0.158.0)
|
|
176
184
|
aranha-parsers (~> 0.21)
|
|
177
|
-
avm (~> 0.
|
|
178
|
-
avm-eac_ruby_base1 (~> 0.
|
|
185
|
+
avm (~> 0.82)
|
|
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.
|
|
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,7 +198,7 @@ PATH
|
|
|
190
198
|
PATH
|
|
191
199
|
remote: sub/avm
|
|
192
200
|
specs:
|
|
193
|
-
avm (0.
|
|
201
|
+
avm (0.82.0)
|
|
194
202
|
aranha-parsers (~> 0.21)
|
|
195
203
|
eac_cli (~> 0.38)
|
|
196
204
|
eac_config (~> 0.14, >= 0.14.1)
|
|
@@ -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.
|
|
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!
|
data/lib/eac_tools/version.rb
CHANGED
|
@@ -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(
|
|
16
|
-
# @param
|
|
17
|
-
common_constructor :
|
|
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}[#{
|
|
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
|
|
@@ -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(
|
|
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
|
|
9
|
+
return nil unless klass.type_name == detect_args.fetch(0).scm_type
|
|
10
10
|
|
|
11
|
-
klass.new(*detect_args
|
|
11
|
+
klass.new(*detect_args)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
data/sub/avm/lib/avm/version.rb
CHANGED
|
@@ -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
|
|
|
@@ -4,5 +4,5 @@ source 'https://rubygems.org'
|
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
|
-
local_gemfile =
|
|
8
|
-
eval_gemfile local_gemfile if
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_gitlab_base0/api/base_entity'
|
|
4
|
+
require 'eac_rest/api'
|
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
|
6
|
+
|
|
7
|
+
module Avm
|
|
8
|
+
module EacGitlabBase0
|
|
9
|
+
class Api < ::EacRest::Api
|
|
10
|
+
class File < ::Avm::EacGitlabBase0::Api::BaseEntity
|
|
11
|
+
FIELDS = %w[file_name file_path size encoding content_sha256 ref blob_id commit_id
|
|
12
|
+
last_commit_id].freeze
|
|
13
|
+
|
|
14
|
+
FIELDS.each do |field|
|
|
15
|
+
define_method field do
|
|
16
|
+
data.fetch(field)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def content
|
|
21
|
+
case encoding
|
|
22
|
+
when 'base64' then ::Base64.decode64(encoded_content)
|
|
23
|
+
else nyi("Unmapped encoding: #{encoding}")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def encoded_content
|
|
28
|
+
data.fetch('content')
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_gitlab_base0/api/node'
|
|
4
|
+
require 'avm/eac_gitlab_base0/api/project'
|
|
5
|
+
require 'eac_rest/api'
|
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
|
7
|
+
|
|
8
|
+
module Avm
|
|
9
|
+
module EacGitlabBase0
|
|
10
|
+
class Api < ::EacRest::Api
|
|
11
|
+
class Group < ::Avm::EacGitlabBase0::Api::Node
|
|
12
|
+
FIELDS = %w[id web_url name path description visibility share_with_group_lock
|
|
13
|
+
require_two_factor_authentication two_factor_grace_period project_creation_level
|
|
14
|
+
auto_devops_enabled subgroup_creation_level emails_disabled lfs_enabled
|
|
15
|
+
avatar_url request_access_enabled full_name full_path parent_id].freeze
|
|
16
|
+
|
|
17
|
+
FIELDS.each do |field|
|
|
18
|
+
define_method field do
|
|
19
|
+
data.fetch(field)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def api_prefix
|
|
24
|
+
"/groups/#{encode_id(id)}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_s
|
|
28
|
+
full_path
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def members_uncached
|
|
34
|
+
fetch_entities(
|
|
35
|
+
"#{api_prefix}/members",
|
|
36
|
+
::Avm::EacGitlabBase0::Api::Member
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def projects_uncached
|
|
41
|
+
fetch_entities(
|
|
42
|
+
"#{api_prefix}/projects?order_by=path&sort=asc&per_page=9999",
|
|
43
|
+
::Avm::EacGitlabBase0::Api::Project
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_gitlab_base0/api/base_entity'
|
|
4
|
+
require 'eac_rest/api'
|
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
|
6
|
+
|
|
7
|
+
module Avm
|
|
8
|
+
module EacGitlabBase0
|
|
9
|
+
class Api < ::EacRest::Api
|
|
10
|
+
class Member < ::Avm::EacGitlabBase0::Api::BaseEntity
|
|
11
|
+
FIELDS = %w[id name username state avatar_url web_url access_level expires_at].freeze
|
|
12
|
+
|
|
13
|
+
FIELDS.each do |field|
|
|
14
|
+
define_method field do
|
|
15
|
+
data.fetch(field)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def to_s
|
|
20
|
+
[name, username, state, access_level].join(' / ')
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_gitlab_base0/api/base_entity'
|
|
4
|
+
require 'avm/eac_gitlab_base0/api/file'
|
|
5
|
+
require 'eac_rest/api'
|
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
|
7
|
+
|
|
8
|
+
module Avm
|
|
9
|
+
module EacGitlabBase0
|
|
10
|
+
class Api < ::EacRest::Api
|
|
11
|
+
class Node < ::Avm::EacGitlabBase0::Api::BaseEntity
|
|
12
|
+
compare_by :id
|
|
13
|
+
|
|
14
|
+
def remove_member(user_id)
|
|
15
|
+
delete("#{api_prefix}/members/#{encode_id(user_id)}")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|