avm-git 0.13.4 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97b90e458de2c4249f60e964c1d95564bd46dbe0f4fd754ce591f475ba13313f
4
- data.tar.gz: 03bc99cf2b5863dc919a8d06f92711959c8f3fd8b4ae360500528a5b82f74a9a
3
+ metadata.gz: 5b8398e0b296b1b152268e3e75893239fdbf76ea35198a090b5a32c0b50c29ce
4
+ data.tar.gz: 1a3d77ec717bededa720a46b50d44dbe8cf098dc829adfce891e66880669024c
5
5
  SHA512:
6
- metadata.gz: afb7e4062254feab12e955691537fabe63c5a31318aa4965a31b807c40636ade3835dd90649bff89b830eb79d666d73680e0b74501910b1d7f58f9c5eed009c7
7
- data.tar.gz: aba1de78c58adcfee8009bf3a02f2ac7e87ff97a0313643745dd393416d76559ba02197ebab4e345244758d6e8de80f2f726957360f58b3edab5608c8a4b7129
6
+ metadata.gz: f6b6a7480886329c0d8d430ad2d3617e94a3775beee1812bf9d5a95bf5e56c0dad34dc9d4cfa437dfe0b3c9d73657960eefc149e7595d10b9f45fd3bc58d8cdc
7
+ data.tar.gz: a37e788e6f4c18b11c556c0bab148968e448915a34aa36e09810578c11f2b8ee9313882762a5ecc500b88d874407cd9f0cb09dbb945a9974ab59364317c0ccac
@@ -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
data/lib/avm/git/issue.rb CHANGED
@@ -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
@@ -9,6 +9,7 @@ module Avm
9
9
  enable_speaker
10
10
  enable_simple_cache
11
11
  attr_accessor :check_remote, :fix_parent
12
+
12
13
  common_constructor :repository
13
14
 
14
15
  def add_all_subrepos
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.13.4'
5
+ VERSION = '0.14.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.4
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-05 00:00:00.000000000 Z
11
+ date: 2023-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.79'
19
+ version: '0.82'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.79'
26
+ version: '0.82'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-files
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +73,7 @@ dependencies:
73
73
  version: '0.119'
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 0.119.1
76
+ version: 0.119.2
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,7 +83,7 @@ dependencies:
83
83
  version: '0.119'
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 0.119.1
86
+ version: 0.119.2
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: git
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -98,40 +98,20 @@ dependencies:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
100
  version: '1.18'
101
- - !ruby/object:Gem::Dependency
102
- name: aranha-parsers
103
- requirement: !ruby/object:Gem::Requirement
104
- requirements:
105
- - - "~>"
106
- - !ruby/object:Gem::Version
107
- version: '0.8'
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 0.8.5
111
- type: :development
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.8'
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: 0.8.5
121
101
  - !ruby/object:Gem::Dependency
122
102
  name: eac_ruby_gem_support
123
103
  requirement: !ruby/object:Gem::Requirement
124
104
  requirements:
125
105
  - - "~>"
126
106
  - !ruby/object:Gem::Version
127
- version: 0.7.0
107
+ version: '0.9'
128
108
  type: :development
129
109
  prerelease: false
130
110
  version_requirements: !ruby/object:Gem::Requirement
131
111
  requirements:
132
112
  - - "~>"
133
113
  - !ruby/object:Gem::Version
134
- version: 0.7.0
114
+ version: '0.9'
135
115
  description:
136
116
  email:
137
117
  executables: []
@@ -139,6 +119,9 @@ extensions: []
139
119
  extra_rdoc_files: []
140
120
  files:
141
121
  - lib/avm/git.rb
122
+ - lib/avm/git/application_scms.rb
123
+ - lib/avm/git/application_scms/base.rb
124
+ - lib/avm/git/application_scms/base/assert_main_at.rb
142
125
  - lib/avm/git/commit.rb
143
126
  - lib/avm/git/commit/class_methods.rb
144
127
  - lib/avm/git/commit/diff_tree_line.rb