avm-git 0.11.0 → 0.13.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: 4dbbeaecd11ef3df5fcdc6467875ee5e4cbd4bbf0ec16878c56ea0b0996b726b
4
- data.tar.gz: 257081841d148f3195076725ab146b4f12d47fc143db3b7e6bd7467840a2a481
3
+ metadata.gz: e4c465260eb218d03c56e7b83254e448b098fc0c3209a616d21a85e9145dc2dc
4
+ data.tar.gz: abfe98048c3d3c761dc0aea833dc7c05f48a3f0c385c9797cb68fe7d871ee401
5
5
  SHA512:
6
- metadata.gz: 1c40bfcfd621c1dc6137dcece97b85e5158b32419b529ec721aebd7eeb622e8692fbf8229fee08216d148592e6bbc1344043ce7bee2ae8ac06235ad920f7a900
7
- data.tar.gz: 71ca230ad521db192dbe47c981ccbd22fc40154aeaaabc8b32b512fb51716783159f55fb171cb71c8e000a245edf833053b374ebac6e91b81f9df45912c43c10
6
+ metadata.gz: 95264dd3e496af3d28533de1b1c439672920eaef5aae55e5972f52f808647f84ea46cce84086fb13857f9d7b8e4be0b50f5065a823c9b383c7621f3a3acf691c
7
+ data.tar.gz: f2908fe7a9b7e6ee1ce4ca90c2a21df5e08c92a47ce37079df17b19d4a55ce6c93ddba53f99fc31930bd68809f2971cda5174a00397d72a2829684287418ac1e
@@ -7,7 +7,7 @@ module Avm
7
7
  module Scms
8
8
  class Git < ::Avm::Scms::Base
9
9
  class ChangeTracker
10
- common_constructor :git_scm, :message
10
+ common_constructor :git_scm, :commit_info
11
11
  attr_reader :starting_commit
12
12
  delegate :git_repo, to: :git_scm
13
13
 
@@ -22,7 +22,7 @@ module Avm
22
22
  git_scm.commit_dirty
23
23
  return nil if starting_commit == git_repo.head
24
24
 
25
- git_scm.reset_and_commit(starting_commit, message)
25
+ git_scm.reset_and_commit(starting_commit, commit_info)
26
26
  end
27
27
 
28
28
  private
@@ -20,21 +20,24 @@ module Avm
20
20
  end
21
21
  end
22
22
 
23
+ # @param commit_info [Avm::Scms::CommitInfo]
23
24
  # @return [Avm::Git::Scms::Git::Commit,nil]
24
- def commit_dirty(message = nil)
25
+ def commit_dirty(commit_info = nil)
25
26
  return nil unless git_repo.dirty?
26
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
+
27
32
  git_repo.command('add', '.').execute!
28
- git_repo.command(
29
- 'commit', '-m',
30
- message.call_if_proc.if_present(COMMIT_DIRTY_DEFAULT_MESSAGE)
31
- ).execute!
33
+ run_commit(commit_info)
32
34
  head_commit
33
35
  end
34
36
 
37
+ # @param commit_info [Avm::Scms::CommitInfo]
35
38
  # @return [Avm::Git::Scms::Git::Commit,nil]
36
- def commit_if_change(message = nil)
37
- tracker = ::Avm::Git::Scms::Git::ChangeTracker.new(self, message)
39
+ def commit_if_change(commit_info = nil)
40
+ tracker = ::Avm::Git::Scms::Git::ChangeTracker.new(self, commit_info)
38
41
  tracker.start
39
42
  yield
40
43
  tracker.stop
@@ -45,10 +48,11 @@ module Avm
45
48
  commit(git_repo.head)
46
49
  end
47
50
 
51
+ # @param commit_info [Avm::Scms::CommitInfo]
48
52
  # @return [Avm::Git::Scms::Git::Commit]
49
- def reset_and_commit(commit_to_reset, message)
53
+ def reset_and_commit(commit_to_reset, commit_info)
50
54
  git_repo.command('reset', '--soft', commit(commit_to_reset).git_commit.id).execute!
51
- commit_dirty(message)
55
+ commit_dirty(commit_info)
52
56
  end
53
57
  end
54
58
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/commit'
4
+ require 'avm/git/scms/git/commit'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Git
9
+ module Scms
10
+ class GitSubBase < ::Avm::Scms::Base
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
15
+
16
+ delegate :deploy_to_env_path, :fixup?, :id, :merge_with, :reword, :scm_file?, :subject,
17
+ :to_s, to: :parent_commit
18
+
19
+ # @return [Array<Pathname>]
20
+ def changed_files
21
+ parent_commit.changed_files.map do |cf|
22
+ cf.relative_path_from(scm.relative_path_from_parent_scm)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/scms/git_sub_base/commit'
4
+ require 'avm/scms/base'
5
+ require 'avm/scms/interval'
6
+ require 'eac_ruby_utils/core_ext'
7
+
8
+ module Avm
9
+ module Git
10
+ module Scms
11
+ class GitSubBase < ::Avm::Scms::Base
12
+ class Interval < ::Avm::Scms::Interval
13
+ # @return [Array<Avm::Git::Scms::GitSubBase::Commit>]
14
+ def commits
15
+ parent_interval.commits.map do |parent_commit|
16
+ Avm::Git::Scms::GitSubBase::Commit.new(scm, parent_commit)
17
+ end
18
+ end
19
+
20
+ # @return [Avm::Git::Scms::Git::Interval]
21
+ def parent_interval
22
+ scm.parent_scm.interval(from, to)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class GitSubBase < ::Avm::Scms::Base
10
+ enable_abstract_methods
11
+
12
+ delegate :changed_files, :commit_if_change, :current_milestone_base_commit,
13
+ :head_commit, :reset_and_commit, :run_commit, to: :parent_scm
14
+
15
+ # @param from [Avm::Git::Scms::Git::Commit]
16
+ # @param to [Avm::Git::Scms::Git::Commit]
17
+ # @return [Avm::Git::Scms::GitSubBase::Interval]
18
+ def interval(from, to)
19
+ ::Avm::Git::Scms::GitSubBase::Interval.new(self, from, to)
20
+ end
21
+
22
+ require_sub __FILE__
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,16 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/scms/base'
3
+ require 'avm/git/scms/git_sub_base'
4
4
  require 'eac_git/local'
5
5
  require 'eac_ruby_utils/core_ext'
6
6
 
7
7
  module Avm
8
8
  module Git
9
9
  module Scms
10
- class GitSubrepo < ::Avm::Scms::Base
11
- delegate :changed_files, :commit_if_change, :current_milestone_base_commit, :interval,
12
- :head_commit, :run_commit, to: :parent_scm
13
-
10
+ class GitSubrepo < ::Avm::Git::Scms::GitSubBase
14
11
  def update
15
12
  git_subrepo.command('clean').execute!
16
13
  git_subrepo.command('pull').execute!
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/scms/provider'
4
+ require 'avm/git/scms/git_sub_base'
5
+ require 'avm/scms/base'
6
+ require 'eac_ruby_utils/core_ext'
7
+
8
+ module Avm
9
+ module Git
10
+ module Scms
11
+ class GitSubtree < ::Avm::Git::Scms::GitSubBase
12
+ def update
13
+ # Do nothing
14
+ end
15
+
16
+ def valid?
17
+ return false unless ::Avm::Git::Scms::Provider
18
+ .new.all.any? { |scm_class| parent_scm.is_a?(scm_class) }
19
+
20
+ (::Avm::Git::Scms::Provider.new.all - [self.class])
21
+ .lazy.map { |scm_class| scm_class.new(path) }.none?(&:valid?)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -2,13 +2,15 @@
2
2
 
3
3
  require 'avm/git/scms/git'
4
4
  require 'avm/git/scms/git_subrepo'
5
+ require 'avm/git/scms/git_subtree'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
 
7
8
  module Avm
8
9
  module Git
9
10
  module Scms
10
11
  class Provider
11
- SCMS = [::Avm::Git::Scms::Git, ::Avm::Git::Scms::GitSubrepo].freeze
12
+ SCMS = [::Avm::Git::Scms::Git, ::Avm::Git::Scms::GitSubrepo,
13
+ ::Avm::Git::Scms::GitSubtree].freeze
12
14
 
13
15
  def all
14
16
  SCMS
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.11.0'
5
+ VERSION = '0.13.0'
6
6
  end
7
7
  end
data/locale/en.yml ADDED
@@ -0,0 +1,6 @@
1
+ en:
2
+ avm:
3
+ git:
4
+ scms:
5
+ git_subrepo:
6
+ update_version_scm_message: '**/.gitrepo: fix/update.'
data/locale/pt-BR.yml ADDED
@@ -0,0 +1,6 @@
1
+ pt-BR:
2
+ avm:
3
+ git:
4
+ scms:
5
+ git_subrepo:
6
+ update_version_scm_message: '**/.gitrepo: conserta/atualiza.'
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.11.0
4
+ version: 0.13.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-01-09 00:00:00.000000000 Z
11
+ date: 2023-03-21 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.59'
19
+ version: '0.64'
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.59'
26
+ version: '0.64'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-files
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.14'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.14.1
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,40 +55,43 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '0.14'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.14.1
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: eac_ruby_utils
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0.110'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 0.110.1
67
+ version: '0.112'
65
68
  type: :runtime
66
69
  prerelease: false
67
70
  version_requirements: !ruby/object:Gem::Requirement
68
71
  requirements:
69
72
  - - "~>"
70
73
  - !ruby/object:Gem::Version
71
- version: '0.110'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 0.110.1
74
+ version: '0.112'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: git
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '1.13'
81
+ version: '1.17'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 1.17.2
82
85
  type: :runtime
83
86
  prerelease: false
84
87
  version_requirements: !ruby/object:Gem::Requirement
85
88
  requirements:
86
89
  - - "~>"
87
90
  - !ruby/object:Gem::Version
88
- version: '1.13'
91
+ version: '1.17'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 1.17.2
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: aranha-parsers
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +192,11 @@ files:
186
192
  - lib/avm/git/scms/git/interval.rb
187
193
  - lib/avm/git/scms/git/milestones.rb
188
194
  - lib/avm/git/scms/git/run_commit.rb
195
+ - lib/avm/git/scms/git_sub_base.rb
196
+ - lib/avm/git/scms/git_sub_base/commit.rb
197
+ - lib/avm/git/scms/git_sub_base/interval.rb
189
198
  - lib/avm/git/scms/git_subrepo.rb
199
+ - lib/avm/git/scms/git_subtree.rb
190
200
  - lib/avm/git/scms/provider.rb
191
201
  - lib/avm/git/subrepo_check.rb
192
202
  - lib/avm/git/subrepo_check/parent.rb
@@ -196,6 +206,8 @@ files:
196
206
  - lib/avm/git/vendor.rb
197
207
  - lib/avm/git/vendor/github.rb
198
208
  - lib/avm/git/version.rb
209
+ - locale/en.yml
210
+ - locale/pt-BR.yml
199
211
  homepage:
200
212
  licenses: []
201
213
  metadata: {}