avm-tools 0.99.0 → 0.99.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/app_src.rb +4 -4
  3. data/lib/avm/eac_webapp_base0/deploy.rb +1 -1
  4. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +1 -1
  5. data/lib/avm/git/commit/file.rb +1 -1
  6. data/lib/avm/git/issue/complete.rb +2 -2
  7. data/lib/avm/git/subrepo_check.rb +1 -1
  8. data/lib/avm/git/subrepo_check/show_result.rb +1 -1
  9. data/lib/avm/git/subrepo_checks.rb +1 -1
  10. data/lib/avm/launcher/context.rb +83 -0
  11. data/lib/avm/launcher/context/instance_discovery.rb +56 -0
  12. data/lib/avm/launcher/context/instance_manager.rb +3 -3
  13. data/lib/avm/launcher/context/instance_manager/cached_instance.rb +1 -1
  14. data/lib/avm/launcher/context/settings.rb +53 -0
  15. data/lib/avm/launcher/git.rb +7 -0
  16. data/lib/avm/launcher/git/base.rb +86 -0
  17. data/lib/avm/launcher/git/base/class_methods.rb +28 -0
  18. data/lib/avm/launcher/git/base/dirty_files.rb +23 -0
  19. data/lib/avm/launcher/git/base/remotes.rb +40 -0
  20. data/lib/avm/launcher/git/base/subrepo.rb +44 -0
  21. data/lib/avm/launcher/git/base/underlying.rb +63 -0
  22. data/lib/avm/launcher/git/error.rb +13 -0
  23. data/lib/avm/launcher/git/mirror_update.rb +38 -0
  24. data/lib/avm/launcher/git/publish_base.rb +121 -0
  25. data/lib/avm/launcher/git/remote.rb +55 -0
  26. data/lib/avm/launcher/git/sub_warp_base.rb +33 -0
  27. data/lib/avm/launcher/git/warp_base.rb +56 -0
  28. data/lib/{eac_launcher → avm/launcher}/instances.rb +1 -1
  29. data/lib/avm/launcher/instances/base.rb +3 -3
  30. data/lib/avm/launcher/instances/base/cache.rb +1 -1
  31. data/lib/avm/launcher/instances/runner_helper.rb +1 -1
  32. data/lib/avm/launcher/paths.rb +4 -0
  33. data/lib/avm/launcher/paths/logical.rb +82 -0
  34. data/lib/avm/launcher/paths/real.rb +44 -0
  35. data/lib/avm/launcher/project.rb +18 -0
  36. data/lib/avm/launcher/publish.rb +4 -0
  37. data/lib/avm/launcher/publish/base.rb +47 -0
  38. data/lib/avm/launcher/publish/check_result.rb +67 -0
  39. data/lib/avm/launcher/ruby.rb +3 -0
  40. data/lib/avm/launcher/ruby/gem.rb +4 -0
  41. data/lib/avm/launcher/ruby/gem/build.rb +125 -0
  42. data/lib/avm/launcher/ruby/gem/specification.rb +63 -0
  43. data/lib/avm/launcher/vendor.rb +3 -0
  44. data/lib/avm/launcher/vendor/github.rb +20 -0
  45. data/lib/avm/projects/stereotypes/git/publish.rb +2 -2
  46. data/lib/avm/projects/stereotypes/git/update/subrepo.rb +2 -2
  47. data/lib/avm/projects/stereotypes/git/warp.rb +2 -2
  48. data/lib/avm/projects/stereotypes/git_subrepo.rb +2 -2
  49. data/lib/avm/projects/stereotypes/git_subrepo/publish.rb +2 -2
  50. data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +11 -11
  51. data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -2
  52. data/lib/avm/projects/stereotypes/git_subtree/warp.rb +4 -4
  53. data/lib/avm/projects/stereotypes/ruby_gem.rb +2 -2
  54. data/lib/avm/projects/stereotypes/ruby_gem/publish.rb +11 -11
  55. data/lib/avm/tools/runner/files/format.rb +2 -2
  56. data/lib/avm/tools/runner/git.rb +2 -2
  57. data/lib/avm/tools/runner/git/commit.rb +2 -2
  58. data/lib/avm/tools/runner/git/deploy.rb +2 -2
  59. data/lib/avm/tools/runner/launcher/instances.rb +1 -1
  60. data/lib/avm/tools/runner/launcher/projects.rb +3 -3
  61. data/lib/avm/tools/runner/launcher/publish.rb +2 -2
  62. data/lib/avm/tools/version.rb +1 -1
  63. metadata +32 -34
  64. data/lib/eac_launcher.rb +0 -13
  65. data/lib/eac_launcher/context.rb +0 -81
  66. data/lib/eac_launcher/context/instance_discovery.rb +0 -54
  67. data/lib/eac_launcher/context/settings.rb +0 -51
  68. data/lib/eac_launcher/git.rb +0 -7
  69. data/lib/eac_launcher/git/base.rb +0 -84
  70. data/lib/eac_launcher/git/base/class_methods.rb +0 -26
  71. data/lib/eac_launcher/git/base/dirty_files.rb +0 -21
  72. data/lib/eac_launcher/git/base/remotes.rb +0 -38
  73. data/lib/eac_launcher/git/base/subrepo.rb +0 -42
  74. data/lib/eac_launcher/git/base/underlying.rb +0 -61
  75. data/lib/eac_launcher/git/error.rb +0 -11
  76. data/lib/eac_launcher/git/mirror_update.rb +0 -36
  77. data/lib/eac_launcher/git/publish_base.rb +0 -119
  78. data/lib/eac_launcher/git/remote.rb +0 -53
  79. data/lib/eac_launcher/git/sub_warp_base.rb +0 -31
  80. data/lib/eac_launcher/git/warp_base.rb +0 -54
  81. data/lib/eac_launcher/paths.rb +0 -4
  82. data/lib/eac_launcher/paths/logical.rb +0 -80
  83. data/lib/eac_launcher/paths/real.rb +0 -42
  84. data/lib/eac_launcher/project.rb +0 -16
  85. data/lib/eac_launcher/publish.rb +0 -4
  86. data/lib/eac_launcher/publish/base.rb +0 -45
  87. data/lib/eac_launcher/publish/check_result.rb +0 -65
  88. data/lib/eac_launcher/ruby.rb +0 -3
  89. data/lib/eac_launcher/ruby/gem.rb +0 -4
  90. data/lib/eac_launcher/ruby/gem/build.rb +0 -123
  91. data/lib/eac_launcher/ruby/gem/specification.rb +0 -61
  92. data/lib/eac_launcher/vendor.rb +0 -3
  93. data/lib/eac_launcher/vendor/github.rb +0 -18
  94. data/lib/eac_launcher/version.rb +0 -5
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_launcher/context'
3
+ require 'avm/launcher/context'
4
4
  require 'avm/launcher/instances/runner_helper'
5
5
 
6
6
  module Avm
@@ -15,8 +15,8 @@ module Avm
15
15
  end
16
16
 
17
17
  def run
18
- ::EacLauncher::Context.current.recache = parsed.recache?
19
- ::EacLauncher::Context.current.projects.each do |p|
18
+ ::Avm::Launcher::Context.current.recache = parsed.recache?
19
+ ::Avm::Launcher::Context.current.projects.each do |p|
20
20
  show_project(p)
21
21
  end
22
22
  end
@@ -20,7 +20,7 @@ module Avm
20
20
  end
21
21
 
22
22
  def run
23
- ::EacLauncher::Context.current.recache = parsed.recache?
23
+ ::Avm::Launcher::Context.current.recache = parsed.recache?
24
24
  build_publish_options
25
25
  instances.each do |i|
26
26
  next unless i.options.publishable?
@@ -40,7 +40,7 @@ module Avm
40
40
  end
41
41
 
42
42
  def build_publish_options
43
- ::EacLauncher::Context.current.publish_options = publish_options
43
+ ::Avm::Launcher::Context.current.publish_options = publish_options
44
44
  end
45
45
 
46
46
  def publish_options
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.99.0'
5
+ VERSION = '0.99.1'
6
6
  end
7
7
  end
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.99.0
4
+ version: 0.99.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: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -491,16 +491,46 @@ files:
491
491
  - lib/avm/instances/entry.rb
492
492
  - lib/avm/instances/entry_keys.rb
493
493
  - lib/avm/instances/runner.rb
494
+ - lib/avm/launcher/context.rb
495
+ - lib/avm/launcher/context/instance_discovery.rb
494
496
  - lib/avm/launcher/context/instance_manager.rb
495
497
  - lib/avm/launcher/context/instance_manager/cached_instance.rb
496
498
  - lib/avm/launcher/context/instance_manager/cached_instances.rb
499
+ - lib/avm/launcher/context/settings.rb
497
500
  - lib/avm/launcher/errors/base.rb
498
501
  - lib/avm/launcher/errors/non_project.rb
502
+ - lib/avm/launcher/git.rb
503
+ - lib/avm/launcher/git/base.rb
504
+ - lib/avm/launcher/git/base/class_methods.rb
505
+ - lib/avm/launcher/git/base/dirty_files.rb
506
+ - lib/avm/launcher/git/base/remotes.rb
507
+ - lib/avm/launcher/git/base/subrepo.rb
508
+ - lib/avm/launcher/git/base/underlying.rb
509
+ - lib/avm/launcher/git/error.rb
510
+ - lib/avm/launcher/git/mirror_update.rb
511
+ - lib/avm/launcher/git/publish_base.rb
512
+ - lib/avm/launcher/git/remote.rb
513
+ - lib/avm/launcher/git/sub_warp_base.rb
514
+ - lib/avm/launcher/git/warp_base.rb
515
+ - lib/avm/launcher/instances.rb
499
516
  - lib/avm/launcher/instances/base.rb
500
517
  - lib/avm/launcher/instances/base/cache.rb
501
518
  - lib/avm/launcher/instances/error.rb
502
519
  - lib/avm/launcher/instances/runner_helper.rb
503
520
  - lib/avm/launcher/instances/settings.rb
521
+ - lib/avm/launcher/paths.rb
522
+ - lib/avm/launcher/paths/logical.rb
523
+ - lib/avm/launcher/paths/real.rb
524
+ - lib/avm/launcher/project.rb
525
+ - lib/avm/launcher/publish.rb
526
+ - lib/avm/launcher/publish/base.rb
527
+ - lib/avm/launcher/publish/check_result.rb
528
+ - lib/avm/launcher/ruby.rb
529
+ - lib/avm/launcher/ruby/gem.rb
530
+ - lib/avm/launcher/ruby/gem/build.rb
531
+ - lib/avm/launcher/ruby/gem/specification.rb
532
+ - lib/avm/launcher/vendor.rb
533
+ - lib/avm/launcher/vendor/github.rb
504
534
  - lib/avm/patches.rb
505
535
  - lib/avm/patches/class.rb
506
536
  - lib/avm/patches/class/i18n.rb
@@ -620,38 +650,6 @@ files:
620
650
  - lib/avm/tools/runner/self/docker.rb
621
651
  - lib/avm/tools/version.rb
622
652
  - lib/avm/version.rb
623
- - lib/eac_launcher.rb
624
- - lib/eac_launcher/context.rb
625
- - lib/eac_launcher/context/instance_discovery.rb
626
- - lib/eac_launcher/context/settings.rb
627
- - lib/eac_launcher/git.rb
628
- - lib/eac_launcher/git/base.rb
629
- - lib/eac_launcher/git/base/class_methods.rb
630
- - lib/eac_launcher/git/base/dirty_files.rb
631
- - lib/eac_launcher/git/base/remotes.rb
632
- - lib/eac_launcher/git/base/subrepo.rb
633
- - lib/eac_launcher/git/base/underlying.rb
634
- - lib/eac_launcher/git/error.rb
635
- - lib/eac_launcher/git/mirror_update.rb
636
- - lib/eac_launcher/git/publish_base.rb
637
- - lib/eac_launcher/git/remote.rb
638
- - lib/eac_launcher/git/sub_warp_base.rb
639
- - lib/eac_launcher/git/warp_base.rb
640
- - lib/eac_launcher/instances.rb
641
- - lib/eac_launcher/paths.rb
642
- - lib/eac_launcher/paths/logical.rb
643
- - lib/eac_launcher/paths/real.rb
644
- - lib/eac_launcher/project.rb
645
- - lib/eac_launcher/publish.rb
646
- - lib/eac_launcher/publish/base.rb
647
- - lib/eac_launcher/publish/check_result.rb
648
- - lib/eac_launcher/ruby.rb
649
- - lib/eac_launcher/ruby/gem.rb
650
- - lib/eac_launcher/ruby/gem/build.rb
651
- - lib/eac_launcher/ruby/gem/specification.rb
652
- - lib/eac_launcher/vendor.rb
653
- - lib/eac_launcher/vendor/github.rb
654
- - lib/eac_launcher/version.rb
655
653
  - template/avm/eac_rails_base0/apache_path/extra_content.conf
656
654
  - template/avm/eac_rails_base0/deploy/config/database.yml.template
657
655
  - template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template
data/lib/eac_launcher.rb DELETED
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EacLauncher
4
- require 'eac_launcher/context'
5
- require 'eac_launcher/paths'
6
- require 'eac_launcher/project'
7
- require 'avm/projects/stereotype'
8
- require 'eac_launcher/git'
9
- require 'eac_launcher/instances'
10
- require 'eac_launcher/publish'
11
- require 'eac_launcher/ruby'
12
- require 'eac_launcher/vendor'
13
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/core_ext/hash/indifferent_access'
4
- require 'avm/launcher/context/instance_manager'
5
- require 'eac_ruby_utils/simple_cache'
6
- require 'eac_cli/speaker'
7
- require 'eac_launcher/context/instance_discovery'
8
- require 'eac_launcher/context/settings'
9
- require 'eac_launcher/paths/logical'
10
- require 'eac_launcher/project'
11
-
12
- module EacLauncher
13
- class Context
14
- include ::EacRubyUtils::SimpleCache
15
- include ::EacCli::Speaker
16
-
17
- DEFAULT_PROJECTS_ROOT = '.'
18
- DEFAULT_SETTINGS_FILE = ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
19
- DEFAULT_CACHE_ROOT = ::File.join(ENV['HOME'], '.cache', 'eac_launcher')
20
-
21
- class << self
22
- attr_writer :current
23
-
24
- def current
25
- @current ||= default
26
- end
27
-
28
- def default
29
- @default ||= Context.new
30
- end
31
- end
32
-
33
- attr_reader :root, :settings, :cache_root
34
- attr_accessor :publish_options, :recache, :instance_manager
35
-
36
- def initialize(options = {})
37
- @options = options.with_indifferent_access
38
- @root = ::EacLauncher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
39
- @settings = ::EacLauncher::Context::Settings.new(build_option(:settings_file))
40
- @cache_root = build_option(:cache_root)
41
- @publish_options = { new: false, confirm: false, stereotype: nil }
42
- @instance_manager = ::Avm::Launcher::Context::InstanceManager.new(self)
43
- @recache = false
44
- end
45
-
46
- def instance(name)
47
- instances.find { |i| i.name == name }
48
- end
49
-
50
- def instances
51
- @instance_manager.instances
52
- end
53
-
54
- def pending_instances
55
- @instance_manager.pending_instances
56
- end
57
-
58
- private
59
-
60
- def build_option(key)
61
- @options[key] || env_option(key) || default_option(key)
62
- end
63
-
64
- def env_option(key)
65
- ENV["EAC_LAUNCHER_#{key}".underscore.upcase]
66
- end
67
-
68
- def default_option(key)
69
- self.class.const_get("DEFAULT_#{key}".underscore.upcase)
70
- end
71
-
72
- def projects_uncached
73
- r = {}
74
- instances.each do |i|
75
- r[i.project_name] ||= []
76
- r[i.project_name] << i
77
- end
78
- r.map { |name, instances| ::EacLauncher::Project.new(name, instances) }
79
- end
80
- end
81
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ruby-progressbar'
4
- require 'avm/launcher/instances/base'
5
-
6
- module EacLauncher
7
- class Context
8
- class InstanceDiscovery
9
- attr_reader :instances
10
-
11
- def initialize(context)
12
- @context = context
13
- @progress = ::ProgressBar.create(title: 'Instance discovery', total: 1)
14
- @instances = path_instances(@context.root, nil)
15
- ensure
16
- @progress&.finish
17
- end
18
-
19
- private
20
-
21
- def path_instances(path, parent_instance)
22
- update_progress_format(path)
23
- on_rescued_path_instances(path) do |r|
24
- if path.project?
25
- parent_instance = ::Avm::Launcher::Instances::Base.instanciate(path, parent_instance)
26
- r << path
27
- end
28
- children = path.children
29
- update_progress_count(children)
30
- r.concat(children.flat_map { |c| path_instances(c, parent_instance) })
31
- end
32
- end
33
-
34
- def on_rescued_path_instances(path)
35
- r = []
36
- begin
37
- yield(r) if path.included?
38
- rescue StandardError => e
39
- warn("#{path}: #{e}")
40
- end
41
- r
42
- end
43
-
44
- def update_progress_format(path)
45
- @progress.format = "%t (Paths: %c/%C, Current: #{path.logical}) |%B| %a"
46
- end
47
-
48
- def update_progress_count(children)
49
- @progress.total += children.count
50
- @progress.increment
51
- end
52
- end
53
- end
54
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/launcher/instances/settings'
4
- require 'eac_ruby_utils/simple_cache'
5
- require 'yaml'
6
-
7
- module EacLauncher
8
- class Context
9
- class Settings
10
- include ::EacRubyUtils::SimpleCache
11
-
12
- def initialize(file)
13
- unless ::File.exist?(file)
14
- ::FileUtils.mkdir_p(::File.dirname(file))
15
- ::File.write(file, {}.to_yaml)
16
- end
17
- @data = YAML.load_file(file)
18
- end
19
-
20
- def instance_settings(instance)
21
- ::Avm::Launcher::Instances::Settings.new(value(['Instances', instance.name]))
22
- end
23
-
24
- private
25
-
26
- def excluded_projects_uncached
27
- enum_value(%w[Projects Exclude])
28
- end
29
-
30
- def excluded_paths_uncached
31
- enum_value(%w[Paths Exclude])
32
- end
33
-
34
- def enum_value(path)
35
- r = value(path)
36
- r.is_a?(Enumerable) ? r : []
37
- end
38
-
39
- def value(path)
40
- node_value(@data, path)
41
- end
42
-
43
- def node_value(data, path)
44
- return data if path.empty?
45
- return nil unless data.is_a?(Hash)
46
-
47
- node_value(data[path.first], path.drop(1))
48
- end
49
- end
50
- end
51
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_launcher/git/base'
4
- require 'eac_launcher/git/error'
5
- require 'eac_launcher/git/mirror_update'
6
- require 'eac_launcher/git/publish_base'
7
- require 'eac_launcher/git/warp_base'
@@ -1,84 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_git/local'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_ruby_utils/envs'
6
- require 'eac_launcher/paths/real'
7
- require 'eac_launcher/git/error'
8
-
9
- module EacLauncher
10
- module Git
11
- class Base < ::EacLauncher::Paths::Real
12
- require_sub __FILE__
13
- enable_simple_cache
14
- extend ::EacLauncher::Git::Base::ClassMethods
15
- include ::EacLauncher::Git::Base::DirtyFiles
16
- include ::EacLauncher::Git::Base::Remotes
17
- include ::EacLauncher::Git::Base::Subrepo
18
- include ::EacLauncher::Git::Base::Underlying
19
-
20
- attr_reader :eac_git
21
- delegate :descendant?, :merge_base, :rev_parse, to: :eac_git
22
-
23
- def initialize(path)
24
- super(path)
25
-
26
- @eac_git = ::EacGit::Local.new(path)
27
- end
28
-
29
- def init_bare
30
- FileUtils.mkdir_p(self)
31
- ::EacRubyUtils::Envs.local.command('git', 'init', '--bare', self).execute! unless
32
- File.exist?(subpath('.git'))
33
- end
34
-
35
- # @return [Pathname]
36
- def root_path
37
- @root_path ||= self.class.find_root(to_s)
38
- end
39
-
40
- def descendant?(descendant, ancestor)
41
- base = merge_base(descendant, ancestor)
42
- return false if base.blank?
43
-
44
- revparse = execute!('rev-parse', '--verify', ancestor).strip
45
- base == revparse
46
- end
47
-
48
- def subtree_split(prefix)
49
- execute!('subtree', '-q', 'split', '-P', prefix).strip
50
- end
51
-
52
- def push(remote_name, refspecs, options = {})
53
- refspecs = [refspecs] unless refspecs.is_a?(Array)
54
- args = ['push']
55
- args << '--dry-run' if options[:dryrun]
56
- args << '--force' if options[:force]
57
- system!(args + [remote_name] + refspecs)
58
- end
59
-
60
- def push_all(remote_name)
61
- system!('push', '--all', remote_name)
62
- system!('push', '--tags', remote_name)
63
- end
64
-
65
- def fetch(remote_name, options = {})
66
- args = ['fetch', '-p', remote_name]
67
- args += %w[--tags --prune-tags --force] if options[:tags]
68
- execute!(*args)
69
- end
70
-
71
- def current_branch
72
- execute!(%w[symbolic-ref -q HEAD]).gsub(%r{\Arefs/heads/}, '').strip
73
- end
74
-
75
- def reset_hard(ref)
76
- execute!('reset', '--hard', ref)
77
- end
78
-
79
- def raise(message)
80
- ::Kernel.raise EacLauncher::Git::Error.new(self, message)
81
- end
82
- end
83
- end
84
- end