avm-tools 0.62.2 → 0.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/avm/git/organize.rb +11 -0
- data/lib/avm/git/organize/reference_update.rb +34 -0
- data/lib/avm/git/organize/repository.rb +76 -0
- data/lib/avm/instances/configuration.rb +11 -3
- data/lib/avm/instances/configuration/_tests.rb +1 -1
- data/lib/avm/launcher/instances/base.rb +1 -0
- data/lib/avm/launcher/instances/settings.rb +51 -0
- data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +29 -0
- data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +1 -1
- data/lib/avm/ruby/rubocop/_gemfile.rb +2 -2
- data/lib/avm/tools/runner/git/organize.rb +78 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher/context/settings.rb +2 -2
- data/lib/eac_launcher/git/base/dirty_files.rb +1 -1
- data/vendor/eac_git/lib/eac_git/local.rb +4 -0
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- metadata +8 -3
- data/lib/eac_launcher/instances/settings.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e6a74ca2abee19a57dbb17f1857ede525b0386297e58a036ab98d15e601a9d5
|
4
|
+
data.tar.gz: e94fe357e1fd4ba8a0acd651fdef3e1f60f67465a6758a1ddc899b6aebb87197
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b59f21007fd2c766ee0b5f8b0cf24da986a036bcafc4fddfd0b5ef26910e1605c541e37a580f7e933d1d7174a25f5465a59c572c6a1d89f085498caf0793f7c
|
7
|
+
data.tar.gz: a6db12617e9f12a9aaf3d031b1c586ec36e7ac45fc7fa18310f4ddabc1ebc51654e44ed108d23532807e6b6cea3f94c93ee9cdee83d923740d4566e24535e8a1
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module Organize
|
8
|
+
class ReferenceUpdate
|
9
|
+
enable_listable
|
10
|
+
lists.add_symbol :operation, :remove
|
11
|
+
|
12
|
+
common_constructor :repository, :reference, :operation
|
13
|
+
|
14
|
+
def run_operation
|
15
|
+
send("run_operation_#{operation}")
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"#{reference} [#{operation}]"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def reference_pathname
|
25
|
+
repository.refs_root.join(reference)
|
26
|
+
end
|
27
|
+
|
28
|
+
def run_operation_remove
|
29
|
+
reference_pathname.unlink
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module Organize
|
8
|
+
class Repository
|
9
|
+
enable_simple_cache
|
10
|
+
common_constructor :eac_git_local
|
11
|
+
|
12
|
+
def collected_references
|
13
|
+
@collected_references || []
|
14
|
+
end
|
15
|
+
|
16
|
+
def collect_subrepos
|
17
|
+
collect_references_with_pattern(
|
18
|
+
%r{\Asubrepo/},
|
19
|
+
::Avm::Git::Organize::ReferenceUpdate::OPERATION_REMOVE
|
20
|
+
)
|
21
|
+
collect_references_with_pattern(
|
22
|
+
%r{\Aheads/subrepo/},
|
23
|
+
::Avm::Git::Organize::ReferenceUpdate::OPERATION_REMOVE
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def collect_originals
|
28
|
+
collect_references_with_pattern(
|
29
|
+
%r{\Aoriginal/},
|
30
|
+
::Avm::Git::Organize::ReferenceUpdate::OPERATION_REMOVE
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def all_branches
|
35
|
+
eac_git_local.execute!
|
36
|
+
end
|
37
|
+
|
38
|
+
delegate :to_s, to: :eac_git_local
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def all_references
|
43
|
+
::Pathname.glob("#{refs_root}/**/*").select(&:file?)
|
44
|
+
.map { |p| p.relative_path_from(refs_root).to_path }
|
45
|
+
end
|
46
|
+
|
47
|
+
def reference_update_by_ref(reference)
|
48
|
+
collected_references.find { |ru| ru.reference == reference }
|
49
|
+
end
|
50
|
+
|
51
|
+
def collect_reference(reference, operation)
|
52
|
+
new_ru = ::Avm::Git::Organize::ReferenceUpdate.new(self, reference, operation)
|
53
|
+
reference_update_by_ref(new_ru.reference).if_present do |ru_found|
|
54
|
+
raise "Reference #{new_ru} already added (#{ru_found})"
|
55
|
+
end
|
56
|
+
@collected_references ||= []
|
57
|
+
@collected_references << new_ru
|
58
|
+
end
|
59
|
+
|
60
|
+
def collect_references_with_pattern(pattern, operation)
|
61
|
+
references_with_pattern(pattern).each do |reference|
|
62
|
+
collect_reference(reference, operation)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def references_with_pattern(pattern)
|
67
|
+
all_references.select { |reference| pattern.if_match(reference, false) }
|
68
|
+
end
|
69
|
+
|
70
|
+
def refs_root_uncached
|
71
|
+
eac_git_local.root_path / '.git' / 'refs'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -17,15 +17,23 @@ module Avm
|
|
17
17
|
internal_find_path(path.expand_path)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
def internal_find_path(absolute_pathname)
|
20
|
+
def find_in_path(path)
|
21
|
+
absolute_pathname = path.to_pathname.expand_path
|
23
22
|
if absolute_pathname.directory?
|
24
23
|
FILENAMES.each do |filename|
|
25
24
|
file = absolute_pathname.join(filename)
|
26
25
|
return new(file) if file.exist?
|
27
26
|
end
|
28
27
|
end
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def internal_find_path(absolute_pathname)
|
34
|
+
r = find_in_path(absolute_pathname)
|
35
|
+
return r if r.present?
|
36
|
+
|
29
37
|
internal_find_path(absolute_pathname.dirname) unless absolute_pathname.root?
|
30
38
|
end
|
31
39
|
end
|
@@ -80,6 +80,7 @@ module Avm
|
|
80
80
|
|
81
81
|
def publish?(stereotype)
|
82
82
|
return false unless stereotype.publish_class
|
83
|
+
return false unless options.stereotype_publishable?(stereotype)
|
83
84
|
|
84
85
|
filter = ::EacLauncher::Context.current.publish_options[:stereotype]
|
85
86
|
filter.blank? ? true : filter == stereotype.name.demodulize
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Launcher
|
7
|
+
module Instances
|
8
|
+
class Settings
|
9
|
+
DEFAULT_CURRENT_REVISION = 'origin/master'
|
10
|
+
DEFAULT_PUBLISH_REMOTE = 'publish'
|
11
|
+
PUBLISHABLE_KEY = :publishable
|
12
|
+
|
13
|
+
common_constructor :data do
|
14
|
+
self.data = (data.is_a?(Hash) ? data : {}).with_indifferent_access
|
15
|
+
end
|
16
|
+
|
17
|
+
def git_current_revision
|
18
|
+
data[__method__] || DEFAULT_CURRENT_REVISION
|
19
|
+
end
|
20
|
+
|
21
|
+
def git_publish_remote
|
22
|
+
data[__method__] || DEFAULT_PUBLISH_REMOTE
|
23
|
+
end
|
24
|
+
|
25
|
+
def publishable?
|
26
|
+
!!publishable_value
|
27
|
+
end
|
28
|
+
|
29
|
+
def stereotype_publishable?(stereotype)
|
30
|
+
return publishable? unless publishable_value.is_a?(::Hash)
|
31
|
+
|
32
|
+
parse_publishable_value(publishable_value[stereotype.stereotype_name], true)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def publishable_value
|
38
|
+
parse_publishable_value(data[PUBLISHABLE_KEY], false)
|
39
|
+
end
|
40
|
+
|
41
|
+
def parse_publishable_value(value, hash_to_true)
|
42
|
+
return value.with_indifferent_access if !hash_to_true && value.is_a?(::Hash)
|
43
|
+
return true if value.nil? || value == true
|
44
|
+
return false if value == false
|
45
|
+
|
46
|
+
!!value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/configuration'
|
4
|
+
require 'eac_ruby_gems_utils/gem'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Patches
|
9
|
+
module EacRubyGemsUtils
|
10
|
+
module Gem
|
11
|
+
enable_simple_cache
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def configuration_uncached
|
16
|
+
::Avm::Instances::Configuration.find_in_path(root)
|
17
|
+
end
|
18
|
+
|
19
|
+
def gemfile_path_uncached
|
20
|
+
return super unless configuration.present? && configuration.rubocop_gemfile.present?
|
21
|
+
|
22
|
+
configuration.rubocop_gemfile
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
::EacRubyGemsUtils::Gem.prepend(::Avm::Patches::EacRubyGemsUtils::Gem)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_gems_utils/gem'
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
4
|
require 'eac_ruby_utils/core_ext'
|
5
5
|
require 'eac_ruby_utils/on_clean_ruby_environment'
|
6
6
|
|
@@ -14,7 +14,7 @@ module Avm
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def rubocop_command_by_gemfile_path(path)
|
17
|
-
::EacRubyGemsUtils::Gem.new(path).bundle('exec', 'rubocop')
|
17
|
+
::EacRubyGemsUtils::Gem.new(path).bundle('exec', 'rubocop').chdir_root
|
18
18
|
end
|
19
19
|
|
20
20
|
def rubocop_gemfile?
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/organize/repository'
|
4
|
+
require 'eac_cli/default_runner'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Git < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class Organize < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
include ::EacCli::DefaultRunner
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Organize branches.'
|
16
|
+
bool_opt '-a', '--all', 'Run all organizations.'
|
17
|
+
bool_opt '-n', '--no', 'Do not run operations.'
|
18
|
+
bool_opt '-o', '--originals', 'Remove refs/original branches.'
|
19
|
+
bool_opt '-s', '--subrepos', 'Remove git-subrepo branches.'
|
20
|
+
bool_opt '-y', '--yes', 'Run operations without confirmation.'
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
start_banner
|
25
|
+
collect_references
|
26
|
+
after_collect_banner
|
27
|
+
run_operations
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def after_collect_banner
|
33
|
+
infov 'Collected references', repository.collected_references.count
|
34
|
+
repository.collected_references.each do |ru|
|
35
|
+
infov " * #{ru.reference}", ru.operation
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def collect?(type)
|
40
|
+
options.fetch("--#{type}") || options.fetch('--all')
|
41
|
+
end
|
42
|
+
|
43
|
+
def collect_references
|
44
|
+
%w[subrepos originals].each do |type|
|
45
|
+
repository.send("collect_#{type}") if collect?(type)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def run_operations
|
50
|
+
return warn('No operations to run (Run with --help to see options)') if
|
51
|
+
repository.collected_references.empty?
|
52
|
+
return unless run_operations?
|
53
|
+
|
54
|
+
repository.collected_references.each do |ru|
|
55
|
+
info "Doing operation #{ru}..."
|
56
|
+
ru.run_operation
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def run_operations?
|
61
|
+
return true if options.fetch('--yes')
|
62
|
+
return false if options.fetch('--no')
|
63
|
+
|
64
|
+
request_input('Confirm operations?', bool: true)
|
65
|
+
end
|
66
|
+
|
67
|
+
def repository_uncached
|
68
|
+
::Avm::Git::Organize::Repository.new(context(:git).eac_git)
|
69
|
+
end
|
70
|
+
|
71
|
+
def start_banner
|
72
|
+
infov 'Repository', repository
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/launcher/instances/settings'
|
3
4
|
require 'eac_ruby_utils/simple_cache'
|
4
5
|
require 'yaml'
|
5
|
-
require 'eac_launcher/instances/settings'
|
6
6
|
|
7
7
|
module EacLauncher
|
8
8
|
class Context
|
@@ -18,7 +18,7 @@ module EacLauncher
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def instance_settings(instance)
|
21
|
-
::
|
21
|
+
::Avm::Launcher::Instances::Settings.new(value(['Instances', instance.name]))
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.64.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -336,6 +336,9 @@ files:
|
|
336
336
|
- lib/avm/git/issue/complete/_validations.rb
|
337
337
|
- lib/avm/git/issue/complete/_working_tree.rb
|
338
338
|
- lib/avm/git/issue/complete/validation.rb
|
339
|
+
- lib/avm/git/organize.rb
|
340
|
+
- lib/avm/git/organize/reference_update.rb
|
341
|
+
- lib/avm/git/organize/repository.rb
|
339
342
|
- lib/avm/git/revision_test.rb
|
340
343
|
- lib/avm/git/spec_helper.rb
|
341
344
|
- lib/avm/git/subrepo_check.rb
|
@@ -370,10 +373,12 @@ files:
|
|
370
373
|
- lib/avm/launcher/errors/non_project.rb
|
371
374
|
- lib/avm/launcher/instances/base.rb
|
372
375
|
- lib/avm/launcher/instances/base/cache.rb
|
376
|
+
- lib/avm/launcher/instances/settings.rb
|
373
377
|
- lib/avm/local_projects.rb
|
374
378
|
- lib/avm/local_projects/instance.rb
|
375
379
|
- lib/avm/local_projects/jobs/update.rb
|
376
380
|
- lib/avm/patches.rb
|
381
|
+
- lib/avm/patches/eac_ruby_gems_utils/gem.rb
|
377
382
|
- lib/avm/patches/object/template.rb
|
378
383
|
- lib/avm/path_string.rb
|
379
384
|
- lib/avm/projects.rb
|
@@ -474,6 +479,7 @@ files:
|
|
474
479
|
- lib/avm/tools/runner/git/deploy.rb
|
475
480
|
- lib/avm/tools/runner/git/dirty_files.rb
|
476
481
|
- lib/avm/tools/runner/git/issue.rb
|
482
|
+
- lib/avm/tools/runner/git/organize.rb
|
477
483
|
- lib/avm/tools/runner/git/revisions_test.rb
|
478
484
|
- lib/avm/tools/runner/git/subrepo.rb
|
479
485
|
- lib/avm/tools/runner/git/subrepo/check.rb
|
@@ -511,7 +517,6 @@ files:
|
|
511
517
|
- lib/eac_launcher/instances.rb
|
512
518
|
- lib/eac_launcher/instances/error.rb
|
513
519
|
- lib/eac_launcher/instances/runner_helper.rb
|
514
|
-
- lib/eac_launcher/instances/settings.rb
|
515
520
|
- lib/eac_launcher/paths.rb
|
516
521
|
- lib/eac_launcher/paths/logical.rb
|
517
522
|
- lib/eac_launcher/paths/real.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacLauncher
|
4
|
-
module Instances
|
5
|
-
class Settings
|
6
|
-
def initialize(data)
|
7
|
-
@data = ActiveSupport::HashWithIndifferentAccess.new(data.is_a?(Hash) ? data : {})
|
8
|
-
end
|
9
|
-
|
10
|
-
def git_current_revision
|
11
|
-
@data[__method__] || 'origin/master'
|
12
|
-
end
|
13
|
-
|
14
|
-
def git_publish_remote
|
15
|
-
@data[__method__] || 'publish'
|
16
|
-
end
|
17
|
-
|
18
|
-
def publishable?
|
19
|
-
@data.key?(:publishable) ? @data[:publishable] : true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|