avm-git 0.11.0 → 0.12.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: 447507fccfbdccc90a778e94ea7dbc81e2600cab181994857ee1e2644d80ca9a
4
+ data.tar.gz: cf78b8c4eb61432fc10369703fdb2309fca8e4c30fb92c2dc507262c30d8c070
5
5
  SHA512:
6
- metadata.gz: 1c40bfcfd621c1dc6137dcece97b85e5158b32419b529ec721aebd7eeb622e8692fbf8229fee08216d148592e6bbc1344043ce7bee2ae8ac06235ad920f7a900
7
- data.tar.gz: 71ca230ad521db192dbe47c981ccbd22fc40154aeaaabc8b32b512fb51716783159f55fb171cb71c8e000a245edf833053b374ebac6e91b81f9df45912c43c10
6
+ metadata.gz: 2d54484f2a54ca4a8a315e47044f0450acbb74b8f95f39cf9ff2c803600cc7a4d1b08209d3ccb66a3da9070fefb846b71cc3d0cdd8b497e438b76a4bedc1d47e
7
+ data.tar.gz: ea4c503d46c43fce7d44b38e69792a16c6b380a5a448fbd7e959cbb2e7348123f809ac3b9a52c090a670edca80c98e3ba21ab5157327b8d3a608037b4f8c5f1b
@@ -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,17 @@
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, :interval,
13
+ :head_commit, :reset_and_commit, :run_commit, to: :parent_scm
14
+ end
15
+ end
16
+ end
17
+ 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.12.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.12.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-01-19 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.61'
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.61'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-files
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +79,9 @@ dependencies:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '1.13'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 1.13.1
82
85
  type: :runtime
83
86
  prerelease: false
84
87
  version_requirements: !ruby/object:Gem::Requirement
@@ -86,6 +89,9 @@ dependencies:
86
89
  - - "~>"
87
90
  - !ruby/object:Gem::Version
88
91
  version: '1.13'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 1.13.1
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: aranha-parsers
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +192,9 @@ 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
189
196
  - lib/avm/git/scms/git_subrepo.rb
197
+ - lib/avm/git/scms/git_subtree.rb
190
198
  - lib/avm/git/scms/provider.rb
191
199
  - lib/avm/git/subrepo_check.rb
192
200
  - lib/avm/git/subrepo_check/parent.rb
@@ -196,6 +204,8 @@ files:
196
204
  - lib/avm/git/vendor.rb
197
205
  - lib/avm/git/vendor/github.rb
198
206
  - lib/avm/git/version.rb
207
+ - locale/en.yml
208
+ - locale/pt-BR.yml
199
209
  homepage:
200
210
  licenses: []
201
211
  metadata: {}