eac_tools 0.49.0 → 0.51.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -23
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -1
  5. data/sub/avm/lib/avm/file_formats/base.rb +7 -0
  6. data/sub/avm/lib/avm/file_formats/search_formatter.rb +2 -12
  7. data/sub/avm/lib/avm/registry/file_formats.rb +4 -0
  8. data/sub/avm/lib/avm/rspec/setup.rb +2 -2
  9. data/sub/avm/lib/avm/rspec/shared_examples/avm_file_format_file_resource_name.rb +15 -0
  10. data/sub/avm/lib/avm/scms/auto_commit/file_resource_name.rb +39 -0
  11. data/sub/avm/lib/avm/scms/auto_commit/for_file.rb +72 -0
  12. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/base.rb +3 -2
  13. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/last.rb +4 -4
  14. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/manual.rb +5 -10
  15. data/sub/avm/lib/avm/scms/auto_commit/rules/new.rb +24 -0
  16. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/nth.rb +4 -4
  17. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/unique.rb +4 -4
  18. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules.rb +7 -2
  19. data/sub/avm/lib/avm/scms/auto_commit.rb +11 -0
  20. data/sub/avm/lib/avm/scms/base/commits.rb +27 -0
  21. data/sub/avm/lib/avm/scms/base/milestones.rb +21 -0
  22. data/sub/avm/lib/avm/scms/base.rb +8 -2
  23. data/sub/avm/lib/avm/scms/changed_file.rb +26 -0
  24. data/sub/avm/lib/avm/scms/commit.rb +15 -0
  25. data/sub/avm/lib/avm/scms/commit_info.rb +20 -0
  26. data/sub/avm/lib/avm/scms/interval.rb +18 -0
  27. data/sub/avm/lib/avm/scms.rb +9 -0
  28. data/sub/avm/lib/avm/version.rb +1 -1
  29. data/sub/avm/spec/lib/avm/file_formats/base_spec.rb +11 -0
  30. data/sub/{avm-git/spec/lib/avm/git/auto_commit_path_spec.rb → avm/spec/lib/avm/scms/auto_commit/file_resource_name_spec.rb} +2 -2
  31. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  32. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats/base/file_resource_name.rb +49 -0
  33. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats/base.rb +2 -0
  34. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  35. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec.rb +8 -0
  36. data/sub/avm-git/avm-git.gemspec +3 -3
  37. data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +16 -0
  38. data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +24 -0
  39. data/sub/avm-git/lib/avm/git/scms/git/commit.rb +10 -0
  40. data/sub/avm-git/lib/avm/git/scms/git/commits.rb +57 -0
  41. data/sub/avm-git/lib/avm/git/scms/git/interval.rb +31 -0
  42. data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +21 -0
  43. data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +57 -0
  44. data/sub/avm-git/lib/avm/git/scms/git.rb +6 -35
  45. data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +2 -1
  46. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  47. data/sub/avm-tools/avm-tools.gemspec +2 -2
  48. data/sub/avm-tools/lib/avm/tools/runner/git/subrepo/fix.rb +12 -4
  49. data/sub/avm-tools/lib/avm/tools/runner/{git → source}/auto_commit.rb +12 -9
  50. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  51. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/{value.rb → item.rb} +7 -13
  52. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +14 -4
  53. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/assert_parent.rb +12 -0
  54. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  55. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +10 -10
  56. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/assert_parent_spec.rb +21 -0
  57. metadata +42 -38
  58. data/sub/avm-git/lib/avm/git/auto_commit/commit_info.rb +0 -23
  59. data/sub/avm-git/lib/avm/git/auto_commit/rules/new.rb +0 -24
  60. data/sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb +0 -20
  61. data/sub/avm-git/lib/avm/git/auto_commit_path.rb +0 -28
  62. data/sub/avm-git/lib/avm/git/file_auto_fixup.rb +0 -83
@@ -1,25 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/patches/class/common_constructor'
3
4
  require 'eac_ruby_utils/inflector'
4
5
 
5
6
  module EacRubyUtils
6
7
  module Listable
7
- class Value
8
- attr_reader :value, :key
9
-
10
- def initialize(list, value, key, translation_required = true)
11
- @list = list
12
- @value = value
13
- @key = key
14
- @translation_required = translation_required
15
- end
8
+ class Item
9
+ common_constructor :list, :value, :key, :translation_required, default: [true]
16
10
 
17
11
  def to_s
18
- "I: #{@list.item}, V: #{@value}, K: #{@key}"
12
+ "I: #{list.item}, V: #{value}, K: #{key}"
19
13
  end
20
14
 
21
15
  def constant_name
22
- ::EacRubyUtils::Inflector.variableize("#{@list.item}_#{@key}").upcase
16
+ ::EacRubyUtils::Inflector.variableize("#{list.item}_#{key}").upcase
23
17
  end
24
18
 
25
19
  def label
@@ -36,13 +30,13 @@ module EacRubyUtils
36
30
  end
37
31
 
38
32
  def translation_required?
39
- @translation_required
33
+ translation_required
40
34
  end
41
35
 
42
36
  private
43
37
 
44
38
  def translate(translate_key)
45
- full_translate_key = "#{@list.i18n_key}.#{@key}.#{translate_key}"
39
+ full_translate_key = "#{list.i18n_key}.#{key}.#{translate_key}"
46
40
  if !::I18n.exists?(full_translate_key) && !translation_required?
47
41
  ''
48
42
  else
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/listable/value'
3
+ require 'eac_ruby_utils/listable/item'
4
4
 
5
5
  module EacRubyUtils
6
6
  module Listable
@@ -18,13 +18,23 @@ module EacRubyUtils
18
18
  end
19
19
 
20
20
  def blank_value
21
- @blank_value ||= ::EacRubyUtils::Listable::Value.new(self, BLANK_VALUE, BLANK_KEY, false)
21
+ @blank_value ||= ::EacRubyUtils::Listable::Item.new(self, BLANK_VALUE, BLANK_KEY, false)
22
22
  end
23
23
 
24
24
  def each_value(&block)
25
25
  values.each(&block)
26
26
  end
27
27
 
28
+ # @return [EacRubyUtils::Listable::Item, nil]
29
+ def item_by_value(value)
30
+ @values.values.find { |item| item.value == value }
31
+ end
32
+
33
+ # @return [EacRubyUtils::Listable::Item]
34
+ def item_by_value!(value)
35
+ item_by_value(value) || raise(::KeyError, "Value not found: #{value}")
36
+ end
37
+
28
38
  def values
29
39
  @values.values.map(&:value)
30
40
  end
@@ -59,7 +69,7 @@ module EacRubyUtils
59
69
  "eac_ruby_utils.listable.#{class_i18n_key}.#{item}"
60
70
  end
61
71
 
62
- # @return [EacRubyUtils::Listable::Value, nil]
72
+ # @return [EacRubyUtils::Listable::Item, nil]
63
73
  def instance_value(instance)
64
74
  v = instance.send(item)
65
75
  return blank_value if v.blank?
@@ -109,7 +119,7 @@ module EacRubyUtils
109
119
  def build_values(labels)
110
120
  vs = {}
111
121
  parse_labels(labels).each do |value, key|
112
- v = Value.new(self, value, key)
122
+ v = ::EacRubyUtils::Listable::Item.new(self, value, key)
113
123
  vs[v.value] = v
114
124
  end
115
125
  vs
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ class Pathname
6
+ # Invoke +mkpath+ for parent path and return +self+.
7
+ # @return [self]
8
+ def assert_parent
9
+ parent.mkpath
10
+ self
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.109.1'
4
+ VERSION = '0.110.1'
5
5
  end
@@ -87,52 +87,52 @@ RSpec.describe ::EacRubyUtils::Listable do
87
87
  it { expect(stub_class.lists.is_a?(::EacRubyUtils::Listable::Lists)).to eq(true) }
88
88
 
89
89
  it {
90
- expect(stub_class.lists.inteiro.value_a.is_a?(::EacRubyUtils::Listable::Value))
90
+ expect(stub_class.lists.inteiro.value_a.is_a?(::EacRubyUtils::Listable::Item))
91
91
  .to eq(true)
92
92
  }
93
93
 
94
94
  it {
95
- expect(stub_class.lists.inteiro.value_b.is_a?(::EacRubyUtils::Listable::Value))
95
+ expect(stub_class.lists.inteiro.value_b.is_a?(::EacRubyUtils::Listable::Item))
96
96
  .to eq(true)
97
97
  }
98
98
 
99
99
  it {
100
- expect(stub_class.lists.inteiro.value_c.is_a?(::EacRubyUtils::Listable::Value))
100
+ expect(stub_class.lists.inteiro.value_c.is_a?(::EacRubyUtils::Listable::Item))
101
101
  .to eq(true)
102
102
  }
103
103
 
104
104
  it {
105
- expect(stub_class.lists.code.value_a.is_a?(::EacRubyUtils::Listable::Value))
105
+ expect(stub_class.lists.code.value_a.is_a?(::EacRubyUtils::Listable::Item))
106
106
  .to eq(true)
107
107
  }
108
108
 
109
109
  it {
110
- expect(stub_class.lists.code.value_b.is_a?(::EacRubyUtils::Listable::Value))
110
+ expect(stub_class.lists.code.value_b.is_a?(::EacRubyUtils::Listable::Item))
111
111
  .to eq(true)
112
112
  }
113
113
 
114
114
  it {
115
- expect(stub_class.lists.cadeia.value_a.is_a?(::EacRubyUtils::Listable::Value))
115
+ expect(stub_class.lists.cadeia.value_a.is_a?(::EacRubyUtils::Listable::Item))
116
116
  .to eq(true)
117
117
  }
118
118
 
119
119
  it {
120
- expect(stub_class.lists.cadeia.value_b.is_a?(::EacRubyUtils::Listable::Value))
120
+ expect(stub_class.lists.cadeia.value_b.is_a?(::EacRubyUtils::Listable::Item))
121
121
  .to eq(true)
122
122
  }
123
123
 
124
124
  it {
125
- expect(stub_class.lists.cadeia.value_c.is_a?(::EacRubyUtils::Listable::Value))
125
+ expect(stub_class.lists.cadeia.value_c.is_a?(::EacRubyUtils::Listable::Item))
126
126
  .to eq(true)
127
127
  }
128
128
 
129
129
  it {
130
- expect(stub_class.lists.type.value_a.is_a?(::EacRubyUtils::Listable::Value))
130
+ expect(stub_class.lists.type.value_a.is_a?(::EacRubyUtils::Listable::Item))
131
131
  .to eq(true)
132
132
  }
133
133
 
134
134
  it {
135
- expect(stub_class.lists.type.value_b.is_a?(::EacRubyUtils::Listable::Value))
135
+ expect(stub_class.lists.type.value_b.is_a?(::EacRubyUtils::Listable::Item))
136
136
  .to eq(true)
137
137
  }
138
138
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/patches/pathname/parent_n'
4
+
5
+ RSpec.describe ::Pathname do
6
+ let(:root) { temp_dir }
7
+ let(:parent_dir) { root.join('parent_dir') }
8
+ let(:instance) { parent_dir.join('the_file') }
9
+ let(:result) { instance.assert_parent }
10
+
11
+ it { expect(parent_dir).not_to exist }
12
+ it { expect(instance).not_to exist }
13
+
14
+ context 'when parent is asserted' do
15
+ before { result }
16
+
17
+ it { expect(parent_dir).to exist }
18
+ it { expect(instance).not_to exist }
19
+ it { expect(result).to eq(instance) }
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.49.0
4
+ version: 0.51.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: 2022-12-24 00:00:00.000000000 Z
11
+ date: 2023-01-09 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.58'
19
+ version: '0.60'
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.58'
26
+ version: '0.60'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_asciidoctor_base0
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -188,20 +188,14 @@ dependencies:
188
188
  requirements:
189
189
  - - "~>"
190
190
  - !ruby/object:Gem::Version
191
- version: '0.27'
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: 0.27.3
191
+ version: '0.28'
195
192
  type: :runtime
196
193
  prerelease: false
197
194
  version_requirements: !ruby/object:Gem::Requirement
198
195
  requirements:
199
196
  - - "~>"
200
197
  - !ruby/object:Gem::Version
201
- version: '0.27'
202
- - - ">="
203
- - !ruby/object:Gem::Version
204
- version: 0.27.3
198
+ version: '0.28'
205
199
  - !ruby/object:Gem::Dependency
206
200
  name: avm-eac_webapp_base0
207
201
  requirement: !ruby/object:Gem::Requirement
@@ -236,40 +230,34 @@ dependencies:
236
230
  requirements:
237
231
  - - "~>"
238
232
  - !ruby/object:Gem::Version
239
- version: '0.142'
240
- - - ">="
241
- - !ruby/object:Gem::Version
242
- version: 0.142.8
233
+ version: '0.143'
243
234
  type: :runtime
244
235
  prerelease: false
245
236
  version_requirements: !ruby/object:Gem::Requirement
246
237
  requirements:
247
238
  - - "~>"
248
239
  - !ruby/object:Gem::Version
249
- version: '0.142'
250
- - - ">="
251
- - !ruby/object:Gem::Version
252
- version: 0.142.8
240
+ version: '0.143'
253
241
  - !ruby/object:Gem::Dependency
254
242
  name: eac_ruby_utils
255
243
  requirement: !ruby/object:Gem::Requirement
256
244
  requirements:
257
245
  - - "~>"
258
246
  - !ruby/object:Gem::Version
259
- version: '0.109'
247
+ version: '0.110'
260
248
  - - ">="
261
249
  - !ruby/object:Gem::Version
262
- version: 0.109.1
250
+ version: 0.110.1
263
251
  type: :runtime
264
252
  prerelease: false
265
253
  version_requirements: !ruby/object:Gem::Requirement
266
254
  requirements:
267
255
  - - "~>"
268
256
  - !ruby/object:Gem::Version
269
- version: '0.109'
257
+ version: '0.110'
270
258
  - - ">="
271
259
  - !ruby/object:Gem::Version
272
- version: 0.109.1
260
+ version: 0.110.1
273
261
  - !ruby/object:Gem::Dependency
274
262
  name: eac_ruby_gem_support
275
263
  requirement: !ruby/object:Gem::Requirement
@@ -629,6 +617,7 @@ files:
629
617
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/version_requirement.rb
630
618
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats.rb
631
619
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats/base.rb
620
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats/base/file_resource_name.rb
632
621
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/launcher.rb
633
622
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/launcher/gem.rb
634
623
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/launcher/gem/build.rb
@@ -857,21 +846,10 @@ files:
857
846
  - sub/avm-git/Gemfile
858
847
  - sub/avm-git/avm-git.gemspec
859
848
  - sub/avm-git/lib/avm/git.rb
860
- - sub/avm-git/lib/avm/git/auto_commit/commit_info.rb
861
- - sub/avm-git/lib/avm/git/auto_commit/rules.rb
862
- - sub/avm-git/lib/avm/git/auto_commit/rules/base.rb
863
- - sub/avm-git/lib/avm/git/auto_commit/rules/last.rb
864
- - sub/avm-git/lib/avm/git/auto_commit/rules/manual.rb
865
- - sub/avm-git/lib/avm/git/auto_commit/rules/new.rb
866
- - sub/avm-git/lib/avm/git/auto_commit/rules/nth.rb
867
- - sub/avm-git/lib/avm/git/auto_commit/rules/unique.rb
868
- - sub/avm-git/lib/avm/git/auto_commit_path.rb
869
- - sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb
870
849
  - sub/avm-git/lib/avm/git/commit.rb
871
850
  - sub/avm-git/lib/avm/git/commit/class_methods.rb
872
851
  - sub/avm-git/lib/avm/git/commit/diff_tree_line.rb
873
852
  - sub/avm-git/lib/avm/git/commit/file.rb
874
- - sub/avm-git/lib/avm/git/file_auto_fixup.rb
875
853
  - sub/avm-git/lib/avm/git/issue.rb
876
854
  - sub/avm-git/lib/avm/git/issue/complete.rb
877
855
  - sub/avm-git/lib/avm/git/issue/complete/commits.rb
@@ -918,9 +896,15 @@ files:
918
896
  - sub/avm-git/lib/avm/git/scms.rb
919
897
  - sub/avm-git/lib/avm/git/scms/git.rb
920
898
  - sub/avm-git/lib/avm/git/scms/git/change_tracker.rb
899
+ - sub/avm-git/lib/avm/git/scms/git/changed_file.rb
900
+ - sub/avm-git/lib/avm/git/scms/git/changed_files.rb
921
901
  - sub/avm-git/lib/avm/git/scms/git/commit.rb
922
902
  - sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb
923
903
  - sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb
904
+ - sub/avm-git/lib/avm/git/scms/git/commits.rb
905
+ - sub/avm-git/lib/avm/git/scms/git/interval.rb
906
+ - sub/avm-git/lib/avm/git/scms/git/milestones.rb
907
+ - sub/avm-git/lib/avm/git/scms/git/run_commit.rb
924
908
  - sub/avm-git/lib/avm/git/scms/git_subrepo.rb
925
909
  - sub/avm-git/lib/avm/git/scms/provider.rb
926
910
  - sub/avm-git/lib/avm/git/subrepo_check.rb
@@ -931,7 +915,6 @@ files:
931
915
  - sub/avm-git/lib/avm/git/vendor.rb
932
916
  - sub/avm-git/lib/avm/git/vendor/github.rb
933
917
  - sub/avm-git/lib/avm/git/version.rb
934
- - sub/avm-git/spec/lib/avm/git/auto_commit_path_spec.rb
935
918
  - sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb
936
919
  - sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out
937
920
  - sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml
@@ -969,7 +952,6 @@ files:
969
952
  - sub/avm-tools/lib/avm/tools/runner/files/format.rb
970
953
  - sub/avm-tools/lib/avm/tools/runner/files/rotate.rb
971
954
  - sub/avm-tools/lib/avm/tools/runner/git.rb
972
- - sub/avm-tools/lib/avm/tools/runner/git/auto_commit.rb
973
955
  - sub/avm-tools/lib/avm/tools/runner/git/commit.rb
974
956
  - sub/avm-tools/lib/avm/tools/runner/git/deploy.rb
975
957
  - sub/avm-tools/lib/avm/tools/runner/git/dirty_files.rb
@@ -991,6 +973,7 @@ files:
991
973
  - sub/avm-tools/lib/avm/tools/runner/self/docker.rb
992
974
  - sub/avm-tools/lib/avm/tools/runner/self/registry.rb
993
975
  - sub/avm-tools/lib/avm/tools/runner/source.rb
976
+ - sub/avm-tools/lib/avm/tools/runner/source/auto_commit.rb
994
977
  - sub/avm-tools/lib/avm/tools/runner/source/info.rb
995
978
  - sub/avm-tools/lib/avm/tools/runner/source/issue.rb
996
979
  - sub/avm-tools/lib/avm/tools/runner/source/issue/complete.rb
@@ -1143,15 +1126,32 @@ files:
1143
1126
  - sub/avm/lib/avm/rspec/setup.rb
1144
1127
  - sub/avm/lib/avm/rspec/setup/launcher.rb
1145
1128
  - sub/avm/lib/avm/rspec/setup/source_generator.rb
1129
+ - sub/avm/lib/avm/rspec/shared_examples/avm_file_format_file_resource_name.rb
1146
1130
  - sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
1147
1131
  - sub/avm/lib/avm/rspec/shared_examples/avm_source_generated.rb
1148
1132
  - sub/avm/lib/avm/rspec/shared_examples/entries_values.rb
1149
1133
  - sub/avm/lib/avm/rspec/shared_examples/in_avm_registry.rb
1150
1134
  - sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb
1151
1135
  - sub/avm/lib/avm/runners/base.rb
1136
+ - sub/avm/lib/avm/scms.rb
1137
+ - sub/avm/lib/avm/scms/auto_commit.rb
1138
+ - sub/avm/lib/avm/scms/auto_commit/file_resource_name.rb
1139
+ - sub/avm/lib/avm/scms/auto_commit/for_file.rb
1140
+ - sub/avm/lib/avm/scms/auto_commit/rules.rb
1141
+ - sub/avm/lib/avm/scms/auto_commit/rules/base.rb
1142
+ - sub/avm/lib/avm/scms/auto_commit/rules/last.rb
1143
+ - sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
1144
+ - sub/avm/lib/avm/scms/auto_commit/rules/new.rb
1145
+ - sub/avm/lib/avm/scms/auto_commit/rules/nth.rb
1146
+ - sub/avm/lib/avm/scms/auto_commit/rules/unique.rb
1152
1147
  - sub/avm/lib/avm/scms/base.rb
1148
+ - sub/avm/lib/avm/scms/base/commits.rb
1149
+ - sub/avm/lib/avm/scms/base/milestones.rb
1150
+ - sub/avm/lib/avm/scms/changed_file.rb
1153
1151
  - sub/avm/lib/avm/scms/commit.rb
1152
+ - sub/avm/lib/avm/scms/commit_info.rb
1154
1153
  - sub/avm/lib/avm/scms/inflector.rb
1154
+ - sub/avm/lib/avm/scms/interval.rb
1155
1155
  - sub/avm/lib/avm/scms/null.rb
1156
1156
  - sub/avm/lib/avm/self/docker_image.rb
1157
1157
  - sub/avm/lib/avm/self/instance.rb
@@ -1187,6 +1187,7 @@ files:
1187
1187
  - sub/avm/lib/avm/with/extra_subcommands.rb
1188
1188
  - sub/avm/spec/lib/avm/applications/base_spec.rb
1189
1189
  - sub/avm/spec/lib/avm/applications/base_spec_fixture.yml
1190
+ - sub/avm/spec/lib/avm/file_formats/base_spec.rb
1190
1191
  - sub/avm/spec/lib/avm/instances/base_spec.rb
1191
1192
  - sub/avm/spec/lib/avm/instances/base_spec_files/config.yml
1192
1193
  - sub/avm/spec/lib/avm/launcher/instances/base_spec.rb
@@ -1197,6 +1198,7 @@ files:
1197
1198
  - sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/lib/ruby_gem_stub/version.rb
1198
1199
  - sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/ruby_gem_stub.gemspec
1199
1200
  - sub/avm/spec/lib/avm/launcher/instances/base_spec_files/settings.yaml
1201
+ - sub/avm/spec/lib/avm/scms/auto_commit/file_resource_name_spec.rb
1200
1202
  - sub/avm/spec/lib/avm/scms/base_spec.rb
1201
1203
  - sub/avm/spec/lib/avm/sources/base_spec.rb
1202
1204
  - sub/avm/spec/lib/avm/sources/runner_spec.rb
@@ -1677,11 +1679,11 @@ files:
1677
1679
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/class_methods.rb
1678
1680
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/instance_methods.rb
1679
1681
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/integer_list.rb
1682
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/item.rb
1680
1683
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb
1681
1684
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/lists.rb
1682
1685
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/string_list.rb
1683
1686
  - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/symbol_list.rb
1684
- - sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb
1685
1687
  - sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb
1686
1688
  - sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb
1687
1689
  - sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb
@@ -1738,6 +1740,7 @@ files:
1738
1740
  - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_pathname.rb
1739
1741
  - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_uri.rb
1740
1742
  - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname.rb
1743
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/assert_parent.rb
1741
1744
  - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_noext.rb
1742
1745
  - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb
1743
1746
  - sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/if_exist.rb
@@ -1824,6 +1827,7 @@ files:
1824
1827
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb
1825
1828
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
1826
1829
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec_files/path/my_stub_with_template
1830
+ - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/assert_parent_spec.rb
1827
1831
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_noext_spec.rb
1828
1832
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb
1829
1833
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Git
7
- module AutoCommit
8
- class CommitInfo
9
- enable_immutable
10
-
11
- immutable_accessor :fixup, :message
12
-
13
- def git_commit_args
14
- r = fixup.if_present([]) { |v| ['--fixup', v.sha1] }
15
- r += message.if_present([]) { |v| ['--message', v] }
16
- return r if r.any?
17
-
18
- raise 'Argument list is empty'
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/git/auto_commit/rules/base'
4
- require 'avm/git/auto_commit_path'
5
-
6
- module Avm
7
- module Git
8
- module AutoCommit
9
- module Rules
10
- class New < ::Avm::Git::AutoCommit::Rules::Base
11
- class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
12
- def auto_commit_path
13
- ::Avm::Git::AutoCommitPath.new(file.git, file.path)
14
- end
15
-
16
- def commit_info
17
- new_commit_info.message(auto_commit_path.commit_message)
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Git
7
- class AutoCommitPath
8
- module Ruby
9
- RUBY_CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
10
-
11
- def ruby_class_name
12
- RUBY_CLASS_NAME_PATTERNS.each do |pattern|
13
- pattern.if_match(relative_path.to_path, false) { |m| return m[1].camelize }
14
- end
15
- nil
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Git
7
- class AutoCommitPath
8
- require_sub __FILE__, include_modules: true
9
- common_constructor :git, :path do
10
- self.path = path.to_pathname
11
- end
12
-
13
- def class_name
14
- ruby_class_name || relative_path.to_path
15
- end
16
-
17
- def commit_message
18
- r = class_name
19
- r += ': remove' unless path.file?
20
- r + '.'
21
- end
22
-
23
- def relative_path
24
- path.expand_path.relative_path_from(git.root_path.expand_path)
25
- end
26
- end
27
- end
28
- end
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/git/auto_commit/commit_info'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
- module Avm
7
- module Git
8
- class FileAutoFixup
9
- enable_speaker
10
- enable_simple_cache
11
- enable_listable
12
-
13
- common_constructor :git, :path, :rules do
14
- self.path = path.to_pathname.expand_path(git.root_path)
15
- end
16
-
17
- COMMITS_SEARCH_INTERVAL = 'origin/master..HEAD'
18
-
19
- def git_relative_path
20
- path.to_pathname.relative_path_from(git.root_path)
21
- end
22
-
23
- def run
24
- start_banner
25
- run_commit || warn("No rule returned commit information for \"#{path}\"")
26
- end
27
-
28
- private
29
-
30
- def commit_args
31
- commit_info.if_present([], &:git_commit_args) + ['--', git_relative_path]
32
- end
33
-
34
- def commit_info_uncached
35
- rules.lazy.map { |rule| rule.with_file(self).commit_info }.find(&:present?)
36
- end
37
-
38
- def start_banner
39
- infov 'Path', path
40
- infov ' Commits found', commits.count
41
- end
42
-
43
- def run_commit
44
- return false if commit_info.blank?
45
-
46
- infov ' Commit arguments', ::Shellwords.join(commit_args)
47
- run_git_add_and_commit
48
- success ' Commited'
49
- true
50
- end
51
-
52
- def run_git_add_and_commit
53
- git.execute!('reset', '--soft', 'HEAD')
54
- if path.exist?
55
- git.execute!('add', git_relative_path)
56
- else
57
- git.execute!('rm', '-f', git_relative_path)
58
- end
59
- git.execute!('commit', *commit_args)
60
- end
61
-
62
- def commits_uncached
63
- git.execute!('log', '--pretty=format:%H', COMMITS_SEARCH_INTERVAL, '--', path)
64
- .each_line.map { |sha1| ::Avm::Git::Commit.new(git, sha1.strip) }
65
- .reject { |commit| commit.subject.start_with?('fixup!') }
66
- .each_with_index.map { |commit, index| CommitDelegator.new(commit, index) }
67
- end
68
-
69
- class CommitDelegator < ::SimpleDelegator
70
- attr_reader :index
71
-
72
- def initialize(commit, index)
73
- super(commit)
74
- @index = index
75
- end
76
-
77
- def position
78
- index + 1
79
- end
80
- end
81
- end
82
- end
83
- end