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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +25 -16
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/application_scms/base.rb +17 -6
  5. data/sub/avm/lib/avm/applications/base/auto_local_source_path.rb +24 -0
  6. data/sub/avm/lib/avm/applications/base/local_source.rb +1 -1
  7. data/sub/avm/lib/avm/applications/base/scm.rb +2 -2
  8. data/sub/avm/lib/avm/registry/application_scms.rb +2 -2
  9. data/sub/avm/lib/avm/version.rb +1 -1
  10. data/sub/avm/spec/lib/avm/applications/base/entries_spec.rb +4 -2
  11. data/sub/avm/spec/lib/avm/applications/base/entries_spec_files/config.yml +1 -0
  12. data/sub/avm-eac_github_base0/Gemfile +2 -2
  13. data/sub/avm-eac_github_base0/avm-eac_github_base0.gemspec +3 -2
  14. data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/api/entity.rb +1 -1
  15. data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/application_scms/base.rb +30 -2
  16. data/sub/avm-eac_github_base0/lib/avm/eac_github_base0/version.rb +1 -1
  17. data/sub/avm-eac_github_base0/spec/lib/avm/eac_github_base0/application_scms/base_spec.rb +40 -0
  18. data/sub/avm-eac_github_base0/spec/rubocop_spec.rb +1 -1
  19. data/sub/avm-eac_github_base0/spec/spec_helper.rb +1 -1
  20. data/sub/avm-eac_gitlab_base0/Gemfile +8 -0
  21. data/sub/avm-eac_gitlab_base0/avm-eac_gitlab_base0.gemspec +20 -0
  22. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/base_entity.rb +72 -0
  23. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb +33 -0
  24. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/group.rb +49 -0
  25. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/member.rb +25 -0
  26. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/node.rb +20 -0
  27. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/nodes_set.rb +118 -0
  28. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/project.rb +65 -0
  29. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/root.rb +30 -0
  30. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api.rb +43 -0
  31. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/application_scms/base.rb +13 -0
  32. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/application_scms.rb +11 -0
  33. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/instances/base.rb +18 -0
  34. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/version.rb +7 -0
  35. data/sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0.rb +9 -0
  36. data/sub/avm-eac_gitlab_base0/spec/lib/avm/eac_gitlab_base0/application_scms/base_spec.rb +7 -0
  37. data/sub/avm-eac_gitlab_base0/spec/rubocop_spec.rb +3 -0
  38. data/sub/avm-eac_gitlab_base0/spec/spec_helper.rb +4 -0
  39. data/sub/avm-git/Gemfile +2 -2
  40. data/sub/avm-git/avm-git.gemspec +3 -4
  41. data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +49 -0
  42. data/sub/avm-git/lib/avm/git/application_scms/base.rb +21 -0
  43. data/sub/avm-git/lib/avm/git/application_scms.rb +11 -0
  44. data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +2 -2
  45. data/sub/avm-git/lib/avm/git/issue/complete/push.rb +2 -2
  46. data/sub/avm-git/lib/avm/git/issue.rb +1 -1
  47. data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +4 -4
  48. data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +1 -1
  49. data/sub/avm-git/lib/avm/git/launcher/base.rb +1 -0
  50. data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +1 -2
  51. data/sub/avm-git/lib/avm/git/launcher/remote.rb +2 -2
  52. data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +3 -2
  53. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +2 -2
  54. data/sub/avm-git/lib/avm/git/organize/repository.rb +1 -1
  55. data/sub/avm-git/lib/avm/git/revision_test.rb +2 -2
  56. data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +1 -0
  57. data/sub/avm-git/lib/avm/git/scms/git/commit.rb +1 -1
  58. data/sub/avm-git/lib/avm/git/scms/git/interval.rb +1 -1
  59. data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +1 -1
  60. data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +1 -1
  61. data/sub/avm-git/lib/avm/git/subrepo_checks.rb +1 -0
  62. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  63. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +2 -2
  64. data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +4 -4
  65. data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +10 -10
  66. data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +11 -11
  67. data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +1 -1
  68. data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +1 -1
  69. data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +3 -3
  70. data/sub/avm-git/spec/rubocop_spec.rb +1 -1
  71. data/sub/avm-git/spec/spec_helper.rb +1 -1
  72. data/sub/avm-tools/avm-tools.gemspec +3 -3
  73. data/sub/avm-tools/lib/avm/tools/runner/application/info.rb +2 -1
  74. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  75. metadata +34 -17
  76. data/sub/avm-eac_github_base0/spec/avm/eac_github_base0/application_scms/base_spec.rb +0 -7
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_gitlab_base0/api/base_entity'
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 NodesSet
12
+ IDS_PREFIXES = {
13
+ '@@' => :group_and_projects, '@-' => :group_projects, '@' => :group
14
+ }.freeze
15
+
16
+ GROUP_AND_PROJECTS_ID_PARSER = /\A@@(.*)\z/.to_parser { |m| m[1] }
17
+ GROUP_ID_PARSER = /\A@(.*)\z/.to_parser { |m| m[1] }
18
+
19
+ class << self
20
+ def parse_id(id)
21
+ IDS_PREFIXES.each do |prefix, type|
22
+ /\A#{::Regexp.quote(prefix)}(.*)\z/.if_match(id, false) do |m|
23
+ return [m[1], type]
24
+ end
25
+ end
26
+
27
+ [id, :project]
28
+ end
29
+ end
30
+
31
+ attr_reader :rest_api
32
+ attr_writer :no_groups
33
+
34
+ def initialize(rest_api, *ids)
35
+ self.rest_api = rest_api
36
+ ids.each { |id| add(id) }
37
+ end
38
+
39
+ def add(id)
40
+ parsed_id, type = self.class.parse_id(id)
41
+
42
+ send("add_by_#{type}_id", parsed_id)
43
+ end
44
+
45
+ # @return [Array<Avm::EacGitlabBase0::Api::Group>]
46
+ def group
47
+ nodes.select { |node| node.is_a?(::Avm::EacGitlabBase0::Api::Group) }
48
+ end
49
+
50
+ # @return [Array<Avm::EacGitlabBase0::Api::Project>]
51
+ def projects
52
+ nodes.select { |node| node.is_a?(::Avm::EacGitlabBase0::Api::Project) }
53
+ end
54
+
55
+ # @return [Array<Avm::EacGitlabBase0::Api::Node>]
56
+ def nodes
57
+ r = nodes_set
58
+ r = r.reject { |g| g.is_a?(::Avm::EacGitlabBase0::Api::Group) } if no_groups?
59
+ r.sort_by { |p| [p.full_path] }
60
+ end
61
+
62
+ def no_groups?
63
+ @no_groups ? true : false
64
+ end
65
+
66
+ private
67
+
68
+ attr_writer :rest_api
69
+
70
+ # @return [Set<Avm::EacGitlabBase0::Api::Project>]
71
+ def nodes_set
72
+ @nodes_set ||= ::Set.new
73
+ end
74
+
75
+ # @return [Avm::EacGitlabBase0::Api::Node]
76
+ def add_node(node)
77
+ nodes_set.add(node)
78
+
79
+ node
80
+ end
81
+
82
+ # @return [Array<Avm::EacGitlabBase0::Api::Group>]
83
+ def add_by_group_id(id)
84
+ group = rest_api.root.group(id)
85
+
86
+ raise "No group found with ID = \"#{id}\"" unless group
87
+
88
+ [add_node(group)]
89
+ end
90
+
91
+ # @return [Array<Avm::EacGitlabBase0::Api::Project>]
92
+ def add_by_group_projects_id(id)
93
+ group = rest_api.root.group(id)
94
+
95
+ raise "No group found with ID = \"#{id}\"" unless group
96
+
97
+ group.projects.map do |project|
98
+ add_node(project)
99
+ end
100
+ end
101
+
102
+ # @return [Array<Avm::EacGitlabBase0::Api::Node>]
103
+ def add_by_group_and_projects_id(id)
104
+ add_by_group_id(id) + add_by_group_projects_id(id)
105
+ end
106
+
107
+ # @return [Array<Avm::EacGitlabBase0::Api::Project>]
108
+ def add_by_project_id(id)
109
+ project = rest_api.root.project(id)
110
+
111
+ raise "No project found with ID = \"#{id}\"" unless project
112
+
113
+ [add_node(project)]
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_gitlab_base0/api/file'
4
+ require 'avm/eac_gitlab_base0/api/member'
5
+ require 'avm/eac_gitlab_base0/api/node'
6
+ require 'eac_rest/api'
7
+ require 'eac_ruby_utils/core_ext'
8
+
9
+ module Avm
10
+ module EacGitlabBase0
11
+ class Api < ::EacRest::Api
12
+ class Project < ::Avm::EacGitlabBase0::Api::Node
13
+ FIELDS = %w[id description name name_with_namespace path path_with_namespace created_at
14
+ default_branch tag_list ssh_url_to_repo http_url_to_repo web_url readme_url
15
+ avatar_url star_count forks_count last_activity_at empty_repo archived
16
+ visibility resolve_outdated_diff_discussions container_registry_enabled
17
+ issues_enabled merge_requests_enabled wiki_enabled jobs_enabled snippets_enabled
18
+ issues_access_level repository_access_level merge_requests_access_level
19
+ wiki_access_level builds_access_level snippets_access_level
20
+ shared_runners_enabled lfs_enabled creator_id import_status
21
+ ci_default_git_depth public_jobs build_timeout auto_cancel_pending_pipelines
22
+ build_coverage_regex ci_config_path shared_with_groups
23
+ only_allow_merge_if_pipeline_succeeds request_access_enabled
24
+ only_allow_merge_if_all_discussions_are_resolved
25
+ remove_source_branch_after_merge printing_merge_request_link_enabled
26
+ merge_method auto_devops_enabled auto_devops_deploy_strategy].freeze
27
+
28
+ FIELDS.each do |field|
29
+ define_method field do
30
+ data.fetch(field)
31
+ end
32
+ end
33
+
34
+ def api_prefix
35
+ "/projects/#{encode_id(id)}"
36
+ end
37
+
38
+ def full_path
39
+ path_with_namespace
40
+ end
41
+
42
+ def file(path)
43
+ fetch_entity(
44
+ "#{api_prefix}/repository/files/#{encode_id(path)}?ref=#{default_branch}",
45
+ ::Avm::EacGitlabBase0::Api::File,
46
+ '404 File Not Found'
47
+ )
48
+ end
49
+
50
+ def to_s
51
+ path_with_namespace
52
+ end
53
+
54
+ private
55
+
56
+ def members_uncached
57
+ fetch_entities(
58
+ "#{api_prefix}/members",
59
+ ::Avm::EacGitlabBase0::Api::Member
60
+ )
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_gitlab_base0/api/base_entity'
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 Root < ::Avm::EacGitlabBase0::Api::BaseEntity
12
+ def group(id)
13
+ fetch_entity(
14
+ "/groups/#{encode_id(id)}?with_projects=false",
15
+ ::Avm::EacGitlabBase0::Api::Group,
16
+ '404 Group Not Found'
17
+ )
18
+ end
19
+
20
+ def project(id)
21
+ fetch_entity(
22
+ "/projects/#{encode_id(id)}",
23
+ ::Avm::EacGitlabBase0::Api::Project,
24
+ '404 Project Not Found'
25
+ )
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_rest/api'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacGitlabBase0
8
+ class Api < ::EacRest::Api
9
+ require_sub __FILE__
10
+
11
+ API_SUFFIX = '/api/v4'
12
+
13
+ def auth_token
14
+ ENV.fetch('TRF1_GITLAB_PRIVATE_TOKEN')
15
+ end
16
+
17
+ def build_service_url_suffix(suffix)
18
+ r = super(suffix)
19
+ r.path = API_SUFFIX + r.path
20
+ r
21
+ end
22
+
23
+ def custom_headers
24
+ {
25
+ 'PRIVATE-TOKEN' => auth_token
26
+ }
27
+ end
28
+
29
+ # @return [Avm::EacGitlabBase0::Api::ProjectsSet]
30
+ def nodes_set(*projects_ids)
31
+ ::Avm::EacGitlabBase0::Api::NodesSet.new(self, *projects_ids)
32
+ end
33
+
34
+ def request(service_url_suffix, headers = {}, &body_data_proc)
35
+ super(service_url_suffix, custom_headers.merge(headers), &body_data_proc)
36
+ end
37
+
38
+ def root
39
+ @root ||= ::Avm::EacGitlabBase0::Api::Root.new(self, {})
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_github_base0/application_scms/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacGitlabBase0
8
+ module ApplicationScms
9
+ class Base < ::Avm::EacGithubBase0::ApplicationScms::Base
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacGitlabBase0
7
+ module ApplicationScms
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/eac_gitlab_base0/api'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacGitlabBase0
9
+ module Instances
10
+ class Base < ::Avm::Instances::Base
11
+ # @return [Avm::EacGitlabBase0::Api]
12
+ def rest_api
13
+ @rest_api ||= ::Avm::EacGitlabBase0::Api.new(web_url)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacGitlabBase0
5
+ VERSION = '0.4.0'
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacGitlabBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_gitlab_base0/application_scms/base'
4
+
5
+ RSpec.describe Avm::EacGitlabBase0::ApplicationScms::Base do
6
+ include_examples 'in_avm_registry', 'application_scms'
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ EacRubyUtils::Rspec.default_setup_create(File.expand_path('..', __dir__))
data/sub/avm-git/Gemfile CHANGED
@@ -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,12 +13,11 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib,locale}/**/*']
14
14
  s.required_ruby_version = '>= 2.7'
15
15
 
16
- s.add_dependency 'avm', '~> 0.79'
16
+ s.add_dependency 'avm', '~> 0.82'
17
17
  s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
18
18
  s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
19
- s.add_dependency 'eac_ruby_utils', '~> 0.119', '>= 0.119.1'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.119', '>= 0.119.2'
20
20
  s.add_dependency 'git', '~> 1.18'
21
21
 
22
- s.add_development_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
23
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.7.0'
22
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.9'
24
23
  end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/application_scms/base'
4
+ require 'eac_git/local'
5
+ require 'eac_git/remote'
6
+ require 'eac_ruby_utils/core_ext'
7
+
8
+ module Avm
9
+ module Git
10
+ module ApplicationScms
11
+ class Base < ::Avm::ApplicationScms::Base
12
+ class AssertMainAt
13
+ MAIN_REFERENCE = 'HEAD'
14
+
15
+ acts_as_instance_method
16
+ enable_simple_cache
17
+ common_constructor :base, :path
18
+
19
+ # @return [Pathname]
20
+ def result
21
+ local_repos.remote(base.git_https_url).fetch
22
+ local_repos.command('checkout', remote_head_commit_id).execute!
23
+ path
24
+ end
25
+
26
+ private
27
+
28
+ # @return [String]
29
+ def remote_head_commit_id
30
+ remote_repos.ls.fetch(MAIN_REFERENCE)
31
+ end
32
+
33
+ # @return [EacGit::Local]
34
+ def local_repos_uncached
35
+ path.mkpath
36
+ r = ::EacGit::Local.new(path)
37
+ r.command('init').execute! unless r.root_path.join('.git').exist?
38
+ r
39
+ end
40
+
41
+ # @return [EacGit::Remote]
42
+ def remote_repos_uncached
43
+ ::EacGit::Remote.new(base.git_https_url)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/application_scms/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module ApplicationScms
9
+ class Base < ::Avm::ApplicationScms::Base
10
+ acts_as_abstract
11
+
12
+ # @return [Addressable::URI]
13
+ def git_https_url
14
+ raise_abstract_method __method__
15
+ end
16
+
17
+ require_sub __FILE__, require_mode: :kernel
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ module ApplicationScms
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -32,8 +32,8 @@ module Avm
32
32
  end
33
33
 
34
34
  def commit_parents(commit)
35
- launcher_git.execute!('log', '--pretty=%P', '-n', '1', commit).split(' ').map(&:strip)
36
- .select(&:present?)
35
+ launcher_git.execute!('log', '--pretty=%P', '-n', '1', commit).split.map(&:strip)
36
+ .select(&:present?)
37
37
  end
38
38
  end
39
39
  end
@@ -25,11 +25,11 @@ module Avm
25
25
  end
26
26
 
27
27
  def pushs_uncached
28
- [master_push, remove_branch_push, tag_push].reject(&:nil?)
28
+ [master_push, remove_branch_push, tag_push].compact
29
29
  end
30
30
 
31
31
  def master_push
32
- remote_master_hash != branch_hash ? "#{branch_hash}:refs/heads/master" : nil
32
+ remote_master_hash == branch_hash ? nil : "#{branch_hash}:refs/heads/master"
33
33
  end
34
34
 
35
35
  def remove_branch_push
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
4
+ EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module Avm
7
7
  module Git
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/object'
3
+ require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
6
  module Git
@@ -9,11 +9,11 @@ module Avm
9
9
  module DirtyFiles
10
10
  delegate :dirty?, to: :eac_git
11
11
 
12
+ # @return [Array<Struct>]
12
13
  def dirty_files
13
14
  eac_git.dirty_files.map do |df|
14
- ::OpenStruct.new(
15
- df.to_h.merge(path: df.path.to_path, absolute_path: df.absolute_path.to_path)
16
- )
15
+ df.to_h.merge(path: df.path.to_path, absolute_path: df.absolute_path.to_path)
16
+ .to_struct
17
17
  end
18
18
  end
19
19
  end
@@ -30,7 +30,7 @@ module Avm
30
30
  def subrepo_status_parse_output(output)
31
31
  r = {}.with_indifferent_access
32
32
  output.each_line do |l|
33
- m = /\A([^\:]+)\:(.*)\z/.match(l.strip)
33
+ m = /\A([^\:]+):(.*)\z/.match(l.strip)
34
34
  next unless m && m[2].present?
35
35
 
36
36
  r[m[1].strip] = m[2].strip
@@ -19,6 +19,7 @@ module Avm
19
19
  include ::Avm::Git::Launcher::Base::Underlying
20
20
 
21
21
  attr_reader :eac_git
22
+
22
23
  delegate :descendant?, :merge_base, :rev_parse, to: :eac_git
23
24
 
24
25
  def initialize(path)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/simple_cache'
4
3
  require 'eac_ruby_utils/simple_cache'
5
4
  require 'avm/launcher/publish/base'
6
5
  require 'avm/launcher/publish/check_result'
@@ -111,7 +110,7 @@ module Avm
111
110
  def remote_sha_uncached
112
111
  remote_fetch
113
112
  b = sgit.git.branches["#{remote_name}/#{remote_ref}"]
114
- b ? b.gcommit.sha : nil
113
+ b&.gcommit&.sha
115
114
  end
116
115
 
117
116
  def remote_fetch_uncached
@@ -13,10 +13,10 @@ module Avm
13
13
  end
14
14
 
15
15
  def ls
16
- git.execute!(['ls-remote', name]).each_line.map do |line|
16
+ git.execute!(['ls-remote', name]).each_line.to_h do |line|
17
17
  x = line.strip.split(/\s+/)
18
18
  [x[1], x[0]]
19
- end.to_h
19
+ end
20
20
  end
21
21
 
22
22
  # +git remote add ...+
@@ -33,8 +33,9 @@ module Avm
33
33
  return
34
34
  end
35
35
 
36
- raise ::Avm::Launcher::Instances::Error, 'Refspec ' \
37
- "\"#{source_instance.options.git_current_revision}\" not found in \"#{source_git}\""
36
+ raise ::Avm::Launcher::Instances::Error,
37
+ "Refspec \"#{source_instance.options.git_current_revision}\" " \
38
+ "not found in \"#{source_git}\""
38
39
  end
39
40
 
40
41
  def update
@@ -33,8 +33,8 @@ module Avm
33
33
  parent_git_warped.descendant?('HEAD', subrepo_parent_hash)
34
34
 
35
35
  raise Avm::Launcher::Errors::Base,
36
- "Subrepo parent hash \"#{subrepo_parent_hash}\"" \
37
- " not found in \"#{parent_git_warped}\""
36
+ "Subrepo parent hash \"#{subrepo_parent_hash}\" " \
37
+ "not found in \"#{parent_git_warped}\""
38
38
  end
39
39
 
40
40
  def subrepo_parent_hash
@@ -42,7 +42,7 @@ module Avm
42
42
 
43
43
  def all_references
44
44
  ::Pathname.glob("#{refs_root}/**/*").select(&:file?)
45
- .map { |p| p.relative_path_from(refs_root).to_path }
45
+ .map { |p| p.relative_path_from(refs_root).to_path }
46
46
  end
47
47
 
48
48
  def reference_update_by_ref(reference)
@@ -57,8 +57,8 @@ module Avm
57
57
  end
58
58
 
59
59
  def run_test
60
- infom "Running test command \"#{::Shellwords.join(test_command_args)}\"" \
61
- " on \"#{git_absolute_path}\"..."
60
+ infom "Running test command \"#{::Shellwords.join(test_command_args)}\" " \
61
+ "on \"#{git_absolute_path}\"..."
62
62
  result = ::EacRubyUtils::Ruby.on_clean_environment { test_command.execute }
63
63
  infom 'Test done'
64
64
  write_result_cache(result)
@@ -9,6 +9,7 @@ module Avm
9
9
  class ChangeTracker
10
10
  common_constructor :git_scm, :commit_info
11
11
  attr_reader :starting_commit
12
+
12
13
  delegate :git_repo, to: :git_scm
13
14
 
14
15
  def start
@@ -15,7 +15,7 @@ module Avm
15
15
  delegate :git_repo, to: :git_scm
16
16
  delegate :id, to: :git_commit
17
17
 
18
- FIXUP_SUBJECT_PATTERN = /\Afixup\!/.freeze
18
+ FIXUP_SUBJECT_PATTERN = /\Afixup!/.freeze
19
19
 
20
20
  # @return [Array<Pathname>]
21
21
  def changed_files
@@ -17,7 +17,7 @@ module Avm
17
17
  # @return [Array<Avm::Git::Scms::Git::Commit>]
18
18
  def commits
19
19
  scm.git_repo.command('log', '--pretty=format:%H', git_commit_interval).execute!
20
- .each_line.map { |sha1| scm.commit(sha1.strip) }
20
+ .each_line.map { |sha1| scm.commit(sha1.strip) }
21
21
  end
22
22
 
23
23
  # @return [String]
@@ -15,7 +15,7 @@ module Avm
15
15
 
16
16
  def valid?
17
17
  return false unless ::Avm::Git::Scms::Provider
18
- .new.all.any? { |scm_class| parent_scm.is_a?(scm_class) }
18
+ .new.all.any? { |scm_class| parent_scm.is_a?(scm_class) }
19
19
 
20
20
  (::Avm::Git::Scms::Provider.new.all - [self.class])
21
21
  .lazy.map { |scm_class| scm_class.new(path) }.none?(&:valid?)
@@ -24,7 +24,7 @@ module Avm
24
24
  end
25
25
 
26
26
  def out_attr(key, value)
27
- out('|' + "#{key}=".white + value)
27
+ out("|#{"#{key}=".white}#{value}")
28
28
  end
29
29
  end
30
30
  end