avm-git 0.13.2 → 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: 3bf8e082960ea0c3f5895f7d4fd75d88d0b0ff802941b6785b3c21798355b2e1
4
- data.tar.gz: 3a94d2ba83aa0c7f97a2bc1c9e8b1bc1a18ee37376cf48aa4db2b74878513acd
3
+ metadata.gz: 28871a777caa1e8f966f5721699e699dbb1d94a0d4942dc509e8feb044ed5407
4
+ data.tar.gz: f1a9ea393677102234301676063e2a281d668f36704ef043ac75ddb233288c66
5
5
  SHA512:
6
- metadata.gz: c34f1f8dbc3a1f9d3d73926fd9bc1b39351064ae16059e8ce015dde70c9e76a6953575de8249e345c28e8629173d89e66e4ebc66b7ed45389bbb88a0ebc2a3bf
7
- data.tar.gz: 0022ab54517124cd3c782958e39452b5f6c4abb75b3ab210f985f7b352c77a22d9ad053aa406ae5f1789449e40fa250f44c5c1544b2da7c8113298f8c41b51cb
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.2'
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.2
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-05-04 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.67'
19
+ version: '0.73'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.67.1
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.67'
29
+ version: '0.73'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.67.1
32
+ version: 0.73.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: avm-files
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -76,14 +76,14 @@ dependencies:
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '0.112'
79
+ version: '0.117'
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '0.112'
86
+ version: '0.117'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: git
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -194,11 +194,13 @@ files:
194
194
  - lib/avm/git/scms/git/commit.rb
195
195
  - lib/avm/git/scms/git/commit/deploy.rb
196
196
  - lib/avm/git/scms/git/commit/deploy_methods.rb
197
+ - lib/avm/git/scms/git/commit_dirty.rb
197
198
  - lib/avm/git/scms/git/commits.rb
198
199
  - lib/avm/git/scms/git/interval.rb
199
200
  - lib/avm/git/scms/git/milestones.rb
200
201
  - lib/avm/git/scms/git/run_commit.rb
201
202
  - lib/avm/git/scms/git_sub_base.rb
203
+ - lib/avm/git/scms/git_sub_base/changed_file.rb
202
204
  - lib/avm/git/scms/git_sub_base/commit.rb
203
205
  - lib/avm/git/scms/git_sub_base/interval.rb
204
206
  - lib/avm/git/scms/git_subrepo.rb