avm-git 0.13.1 → 0.13.3

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: 3c527e07290b2c56ad8f4aeb91cdbb3b0f78223dc34c9babf50f372573555d79
4
- data.tar.gz: f9cf685952de778334ce13137152065a246bbcd0b95135b627439fee1fdd2a8d
3
+ metadata.gz: 28871a777caa1e8f966f5721699e699dbb1d94a0d4942dc509e8feb044ed5407
4
+ data.tar.gz: f1a9ea393677102234301676063e2a281d668f36704ef043ac75ddb233288c66
5
5
  SHA512:
6
- metadata.gz: 2685abcc268908517117700c16217f2bd928e0eadb0564f81e7702dd20a7a0fef4273178ebbe7c9baf4b12c93e7c5b0bd2e7e2e1773c6b97d9d1d3d8d2b063ba
7
- data.tar.gz: f72d76691c1d21a09fbcb7e2c9f73f802f168734e34575e5c7e3a55f2401005d99b6492739f9a467e7fea30ce13d611f64e1b1a19b41f78ca344c3a474321f2b
6
+ metadata.gz: baaf6987cc2f64fd6d32d791230c4a9a7de0df711870d908fdf95fc30da44aa0e1a9082d27a3a020f82425e435c63d77723af466f9003cbb0fcad0d28c2d4e1f
7
+ data.tar.gz: 7c2ff2e208628a5e7a1361965139473f98ba3be5b573a97d55479eeeda8b29c8f63554edf25b5b1c11d25a8ae4d1ec39d9c4e6f70ef8b5a61d9ed43bac9806c6
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/scms/git/changed_file'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class Git < ::Avm::Scms::Base
10
+ class CommitDirty
11
+ enable_method_class
12
+ # @param commit_info [Avm::Scms::CommitInfo, nil]
13
+ common_constructor :scm, :commit_info, default: [nil]
14
+ delegate :git_repo, :head_commit, :run_commit, to: :scm
15
+
16
+ # @return [Avm::Git::Scms::Git::Commit,nil]
17
+ def result
18
+ return nil unless git_repo.dirty?
19
+
20
+ run_commit(asserted_commit_info)
21
+ head_commit
22
+ end
23
+
24
+ private
25
+
26
+ def asserted_commit_info
27
+ r = ::Avm::Scms::CommitInfo.assert(commit_info)
28
+ r = r.message(COMMIT_DIRTY_DEFAULT_MESSAGE) if r.message.blank?
29
+ git_repo.dirty_files.inject(r) { |a, e| a.path(e.absolute_path) }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -20,20 +20,6 @@ module Avm
20
20
  end
21
21
  end
22
22
 
23
- # @param commit_info [Avm::Scms::CommitInfo]
24
- # @return [Avm::Git::Scms::Git::Commit,nil]
25
- def commit_dirty(commit_info = nil)
26
- return nil unless git_repo.dirty?
27
-
28
- commit_info = ::Avm::Scms::CommitInfo.assert(commit_info)
29
- commit_info = commit_info.message(COMMIT_DIRTY_DEFAULT_MESSAGE) if
30
- commit_info.message.blank?
31
-
32
- git_repo.command('add', '.').execute!
33
- run_commit(commit_info)
34
- head_commit
35
- end
36
-
37
23
  # @param commit_info [Avm::Scms::CommitInfo]
38
24
  # @return [Avm::Git::Scms::Git::Commit,nil]
39
25
  def commit_if_change(commit_info = nil)
@@ -48,7 +48,7 @@ module Avm
48
48
  end
49
49
 
50
50
  def reset
51
- scm.git_repo.command('reset', '--soft', 'HEAD').execute!
51
+ scm.git_repo.command('reset', 'HEAD').execute!
52
52
  end
53
53
  end
54
54
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/changed_file'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class GitSubBase < ::Avm::Scms::Base
10
+ class ChangedFile < ::Avm::Scms::ChangedFile
11
+ common_constructor :scm, :parent_changed_file
12
+
13
+ # @return [Pathname]
14
+ def path
15
+ parent_changed_file.path.relative_path_from(scm.relative_path_from_parent_scm)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -9,9 +9,7 @@ module Avm
9
9
  module Scms
10
10
  class GitSubBase < ::Avm::Scms::Base
11
11
  class Commit < ::Avm::Scms::Commit
12
- common_constructor :scm, :parent_commit do
13
- # parent_commit.assert_argument(::Avm::Git::Scms::Git::Commit, 'parent_commit')
14
- end
12
+ common_constructor :scm, :parent_commit
15
13
 
16
14
  delegate :deploy_to_env_path, :fixup?, :id, :merge_with, :reword, :scm_file?, :subject,
17
15
  :to_s, to: :parent_commit
@@ -9,9 +9,16 @@ module Avm
9
9
  class GitSubBase < ::Avm::Scms::Base
10
10
  enable_abstract_methods
11
11
 
12
- delegate :changed_files, :commit_if_change, :current_milestone_base_commit,
12
+ delegate :commit_if_change, :current_milestone_base_commit,
13
13
  :head_commit, :reset_and_commit, :run_commit, to: :parent_scm
14
14
 
15
+ # @return [Enumerable<Avm::Git::Scms::GitSubBase::ChangedFile>]
16
+ def changed_files
17
+ parent_scm.changed_files.map do |parent_changed_file|
18
+ ::Avm::Git::Scms::GitSubBase::ChangedFile.new(self, parent_changed_file)
19
+ end
20
+ end
21
+
15
22
  # @param from [Avm::Git::Scms::Git::Commit]
16
23
  # @param to [Avm::Git::Scms::Git::Commit]
17
24
  # @return [Avm::Git::Scms::GitSubBase::Interval]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.13.1'
5
+ VERSION = '0.13.3'
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.1
4
+ version: 0.13.3
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-03-31 00:00:00.000000000 Z
11
+ date: 2023-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.64'
19
+ version: '0.73'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.64.2
22
+ version: 0.73.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.64'
29
+ version: '0.73'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.64.2
32
+ version: 0.73.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: avm-files
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -37,6 +37,9 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0.6'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.6.2
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,6 +47,9 @@ dependencies:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
49
  version: '0.6'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.6.2
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: eac_git
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -70,14 +76,14 @@ dependencies:
70
76
  requirements:
71
77
  - - "~>"
72
78
  - !ruby/object:Gem::Version
73
- version: '0.112'
79
+ version: '0.117'
74
80
  type: :runtime
75
81
  prerelease: false
76
82
  version_requirements: !ruby/object:Gem::Requirement
77
83
  requirements:
78
84
  - - "~>"
79
85
  - !ruby/object:Gem::Version
80
- version: '0.112'
86
+ version: '0.117'
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: git
83
89
  requirement: !ruby/object:Gem::Requirement
@@ -188,11 +194,13 @@ files:
188
194
  - lib/avm/git/scms/git/commit.rb
189
195
  - lib/avm/git/scms/git/commit/deploy.rb
190
196
  - lib/avm/git/scms/git/commit/deploy_methods.rb
197
+ - lib/avm/git/scms/git/commit_dirty.rb
191
198
  - lib/avm/git/scms/git/commits.rb
192
199
  - lib/avm/git/scms/git/interval.rb
193
200
  - lib/avm/git/scms/git/milestones.rb
194
201
  - lib/avm/git/scms/git/run_commit.rb
195
202
  - lib/avm/git/scms/git_sub_base.rb
203
+ - lib/avm/git/scms/git_sub_base/changed_file.rb
196
204
  - lib/avm/git/scms/git_sub_base/commit.rb
197
205
  - lib/avm/git/scms/git_sub_base/interval.rb
198
206
  - lib/avm/git/scms/git_subrepo.rb