avm-tools 0.62.4 → 0.65.0
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/data/package/dump.rb +1 -0
- 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/launcher/instances/base.rb +1 -0
- data/lib/avm/launcher/instances/settings.rb +51 -0
- data/lib/avm/local_projects/instance.rb +8 -0
- data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +1 -0
- data/lib/avm/patches/object/template.rb +3 -3
- data/lib/avm/projects/stereotype.rb +2 -2
- data/lib/avm/self.rb +5 -1
- data/lib/avm/tools/runner/git/organize.rb +78 -0
- data/lib/avm/tools/runner/local_project.rb +5 -0
- data/lib/avm/tools/runner/local_project/test.rb +34 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher/context/settings.rb +2 -2
- data/vendor/eac_git/lib/eac_git/local.rb +4 -0
- data/vendor/eac_git/lib/eac_git/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: b49415c22196804138f3b05422b6efeec1aa7d092d4ec282721b4a292b81cc26
|
4
|
+
data.tar.gz: da7e1f8019ee6ea9694088a328f8c988143325f72fca48b99e082a8217616aca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 993126704ac357031cd9f050964aace90fedb10c29849b1de13a05b1cc4f8c222223f6d10604517d5a87c03bcf03d09337d517e067cad85af0aba9c39e001af2
|
7
|
+
data.tar.gz: 40d27a357cf1ba0d5534289bebc3cbf2a529e4250cee92a8a6de80b623a5ba6b9d055c22f397e133e1f5fcc5ec26e57e9d307c07acc1e70721600a57a7930258
|
@@ -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
|
@@ -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
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/instances/configuration'
|
3
4
|
require 'eac_launcher/paths/real'
|
4
5
|
require 'eac_ruby_utils/core_ext'
|
5
6
|
require 'avm/projects/stereotypes'
|
@@ -13,6 +14,8 @@ module Avm
|
|
13
14
|
source_stereotypes_mixins
|
14
15
|
end
|
15
16
|
|
17
|
+
delegate :to_s, to: :path
|
18
|
+
|
16
19
|
# Backward compatibility with [EacLauncher::Paths::Logical].
|
17
20
|
# @return [EacLauncher::Paths::Real].
|
18
21
|
def real
|
@@ -21,6 +24,11 @@ module Avm
|
|
21
24
|
|
22
25
|
private
|
23
26
|
|
27
|
+
# @return [Avm::Instances::Configuration]
|
28
|
+
def configuration_uncached
|
29
|
+
::Avm::Instances::Configuration.find_in_path(path)
|
30
|
+
end
|
31
|
+
|
24
32
|
def stereotypes_uncached
|
25
33
|
::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
|
26
34
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/self'
|
3
4
|
require 'eac_ruby_utils/patches/object/template'
|
4
5
|
|
5
|
-
::EacRubyUtils::Templates::Searcher.default.included_paths <<
|
6
|
-
('
|
7
|
-
)
|
6
|
+
::EacRubyUtils::Templates::Searcher.default.included_paths <<
|
7
|
+
::Avm::Self.root.join('template').to_path
|
@@ -47,14 +47,14 @@ module Avm
|
|
47
47
|
private
|
48
48
|
|
49
49
|
def sub_constant(constant_name, is_a)
|
50
|
+
return nil unless const_defined?(constant_name)
|
51
|
+
|
50
52
|
constant = const_get(constant_name)
|
51
53
|
unless is_a.if_present(true) { |v| constant.is_a?(v) }
|
52
54
|
raise("#{constant} is not a #{is_a}")
|
53
55
|
end
|
54
56
|
|
55
57
|
constant
|
56
|
-
rescue NameError
|
57
|
-
nil
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/lib/avm/self.rb
CHANGED
@@ -10,12 +10,16 @@ module Avm
|
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def application
|
13
|
-
@application ||= ::EacRubyBase0::Application.new(
|
13
|
+
@application ||= ::EacRubyBase0::Application.new(root.to_path)
|
14
14
|
end
|
15
15
|
|
16
16
|
def instance
|
17
17
|
@instance ||= ::Avm::Self::Instance.by_id('avm-tools_self')
|
18
18
|
end
|
19
|
+
|
20
|
+
def root
|
21
|
+
::Pathname.new('../..').expand_path(__dir__)
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -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
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
9
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Test < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
include ::EacCli::DefaultRunner
|
12
|
+
|
13
|
+
runner_definition do
|
14
|
+
desc 'Test local project.'
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
context(:instance_banner)
|
19
|
+
infov 'Test command', test_command
|
20
|
+
if test_command.present?
|
21
|
+
test_command.system!
|
22
|
+
else
|
23
|
+
fatal_error 'No test command found'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_command
|
28
|
+
context(:instance).configuration.if_present(&:any_test_command)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
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.65.0
|
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-
|
11
|
+
date: 2020-09-02 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,6 +373,7 @@ 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
|
@@ -475,6 +479,7 @@ files:
|
|
475
479
|
- lib/avm/tools/runner/git/deploy.rb
|
476
480
|
- lib/avm/tools/runner/git/dirty_files.rb
|
477
481
|
- lib/avm/tools/runner/git/issue.rb
|
482
|
+
- lib/avm/tools/runner/git/organize.rb
|
478
483
|
- lib/avm/tools/runner/git/revisions_test.rb
|
479
484
|
- lib/avm/tools/runner/git/subrepo.rb
|
480
485
|
- lib/avm/tools/runner/git/subrepo/check.rb
|
@@ -484,6 +489,7 @@ files:
|
|
484
489
|
- lib/avm/tools/runner/launcher/publish.rb
|
485
490
|
- lib/avm/tools/runner/local_project.rb
|
486
491
|
- lib/avm/tools/runner/local_project/info.rb
|
492
|
+
- lib/avm/tools/runner/local_project/test.rb
|
487
493
|
- lib/avm/tools/runner/local_project/update.rb
|
488
494
|
- lib/avm/tools/runner/ruby.rb
|
489
495
|
- lib/avm/tools/runner/ruby/gems.rb
|
@@ -512,7 +518,6 @@ files:
|
|
512
518
|
- lib/eac_launcher/instances.rb
|
513
519
|
- lib/eac_launcher/instances/error.rb
|
514
520
|
- lib/eac_launcher/instances/runner_helper.rb
|
515
|
-
- lib/eac_launcher/instances/settings.rb
|
516
521
|
- lib/eac_launcher/paths.rb
|
517
522
|
- lib/eac_launcher/paths/logical.rb
|
518
523
|
- 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
|