avm-tools 0.59.0 → 0.60.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/local_projects/instance.rb +8 -1
- data/lib/avm/local_projects/jobs/update.rb +29 -0
- data/lib/avm/projects/stereotype.rb +17 -10
- data/lib/avm/projects/stereotypes/git/local_project_mixin.rb +19 -0
- data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +19 -0
- data/lib/avm/projects/stereotypes/ruby_gem/update.rb +59 -0
- data/lib/avm/tools/runner/local_project.rb +1 -1
- data/lib/avm/tools/runner/local_project/update.rb +26 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher/context/instance_manager.rb +1 -0
- data/lib/eac_launcher/git/base/dirty_files.rb +5 -14
- data/vendor/eac_git/lib/eac_git/local.rb +1 -1
- data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +38 -0
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/identity_file.rb +2 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/quiet.rb +2 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb +2 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +8 -8
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a03f7f27fdfdd821203ba28f951ca16404a91b886453f9839e855dcf78627ef
|
4
|
+
data.tar.gz: 8f02cc5b2e5454e4e5253be317e73c94d8f007538b3464281f9a84c1bd83768f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7d158d5b73aea3e54c715b2a13ec15fa3bc5fd6f87b3252f70ae9b0fd8dce36fb3a6b9c1d043f0b2365087848627595aaf7041142bf27f18d60a3f1ac4e0a9
|
7
|
+
data.tar.gz: a8300831601639f79484dcd81934900c4be5003e85ed4e5a6345bb0c19ea5f4b3149556633238bd63fff97c933df7535622bfe588021c06e0567a064ccaca7e2
|
@@ -5,11 +5,12 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
require 'avm/projects/stereotypes'
|
6
6
|
|
7
7
|
module Avm
|
8
|
-
module
|
8
|
+
module LocalProjects
|
9
9
|
class Instance
|
10
10
|
enable_simple_cache
|
11
11
|
common_constructor :path do
|
12
12
|
self.path = path.to_pathname
|
13
|
+
source_stereotypes_mixins
|
13
14
|
end
|
14
15
|
|
15
16
|
# Backward compatibility with [EacLauncher::Paths::Logical].
|
@@ -23,6 +24,12 @@ module Avm
|
|
23
24
|
def stereotypes_uncached
|
24
25
|
::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
|
25
26
|
end
|
27
|
+
|
28
|
+
def source_stereotypes_mixins
|
29
|
+
stereotypes.each do |s|
|
30
|
+
s.local_project_mixin_module.if_present { |v| extend(v) }
|
31
|
+
end
|
32
|
+
end
|
26
33
|
end
|
27
34
|
end
|
28
35
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module LocalProjects
|
7
|
+
module Jobs
|
8
|
+
class Update
|
9
|
+
enable_console_speaker
|
10
|
+
common_constructor :instance
|
11
|
+
|
12
|
+
def run
|
13
|
+
instance.stereotypes.each { |stereotype| run_stereotype(stereotype) }
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def run_stereotype(stereotype)
|
19
|
+
if stereotype.update_class.present?
|
20
|
+
puts stereotype.label + ': update class found. Running...'
|
21
|
+
stereotype.update_class.new(instance).run
|
22
|
+
else
|
23
|
+
puts stereotype.label + ': update class not found'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -30,22 +30,29 @@ module Avm
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def stereotype_name
|
33
|
-
name.
|
33
|
+
name.demodulize
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
{
|
37
|
+
local_project_mixin: ::Module,
|
38
|
+
publish: ::Class,
|
39
|
+
update: ::Class,
|
40
|
+
warp: ::Class
|
41
|
+
}.each do |name, is_a|
|
42
|
+
define_method "#{name}_#{is_a.name.underscore}" do
|
43
|
+
sub_constant(name.to_s.camelcase, is_a)
|
44
|
+
end
|
42
45
|
end
|
43
46
|
|
44
47
|
private
|
45
48
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
49
|
+
def sub_constant(constant_name, is_a)
|
50
|
+
constant = const_get(constant_name)
|
51
|
+
unless is_a.if_present(true) { |v| constant.is_a?(v) }
|
52
|
+
raise("#{constant} is not a #{is_a}")
|
53
|
+
end
|
54
|
+
|
55
|
+
constant
|
49
56
|
rescue NameError
|
50
57
|
nil
|
51
58
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git/local'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Projects
|
8
|
+
module Stereotypes
|
9
|
+
class Git
|
10
|
+
module LocalProjectMixin
|
11
|
+
# @return [EacGit::Local]
|
12
|
+
def git_repo
|
13
|
+
@git_repo ||= ::EacGit::Local.new(path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_gems_utils/gem'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Projects
|
8
|
+
module Stereotypes
|
9
|
+
class RubyGem
|
10
|
+
module LocalProjectMixin
|
11
|
+
# @return [EacRubyGemsUtils::Gem]
|
12
|
+
def ruby_gem
|
13
|
+
@ruby_gem ||= ::EacRubyGemsUtils::Gem.new(path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Projects
|
7
|
+
module Stereotypes
|
8
|
+
class RubyGem
|
9
|
+
class Update
|
10
|
+
enable_console_speaker
|
11
|
+
common_constructor :instance
|
12
|
+
|
13
|
+
def run
|
14
|
+
gemfile_lock_checkout
|
15
|
+
bundle_update
|
16
|
+
gemfile_lock_commit
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def bundle_update
|
22
|
+
infom 'Running "bundle update"...'
|
23
|
+
instance.ruby_gem.bundle('update').execute!
|
24
|
+
infom 'Running "bundle install"...'
|
25
|
+
instance.ruby_gem.bundle('install').execute!
|
26
|
+
end
|
27
|
+
|
28
|
+
def gemfile_lock_checkout
|
29
|
+
return unless instance.respond_to?(:git_repo)
|
30
|
+
|
31
|
+
infom 'Checkouting Gemfile.lock...'
|
32
|
+
instance.git_repo.command('checkout', '--',
|
33
|
+
instance.ruby_gem.gemfile_lock_path.to_path).execute!
|
34
|
+
end
|
35
|
+
|
36
|
+
def gemfile_lock_commit
|
37
|
+
return unless instance.respond_to?(:git_repo)
|
38
|
+
|
39
|
+
if gemfile_lock_changed?
|
40
|
+
infom 'Commiting Gemfile.lock...'
|
41
|
+
instance.git_repo.command('commit', '-m', gemfile_lock_commit_message, '--',
|
42
|
+
instance.ruby_gem.gemfile_lock_path).execute!
|
43
|
+
else
|
44
|
+
infom 'Gemfile.lock did not change'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def gemfile_lock_commit_message
|
49
|
+
'Todas as gems: atualiza.'
|
50
|
+
end
|
51
|
+
|
52
|
+
def gemfile_lock_changed?
|
53
|
+
instance.git_repo.dirty_file?(instance.ruby_gem.gemfile_lock_path)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/local_projects/jobs/update'
|
4
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class Update < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
include ::EacCli::DefaultRunner
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Update local project.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
infov 'Path', context(:instance).path
|
20
|
+
::Avm::LocalProjects::Jobs::Update.new(context(:instance)).run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
@@ -6,24 +6,15 @@ module EacLauncher
|
|
6
6
|
module Git
|
7
7
|
class Base < ::EacLauncher::Paths::Real
|
8
8
|
module DirtyFiles
|
9
|
-
|
10
|
-
dirty_files.any?
|
11
|
-
end
|
9
|
+
delegate :dirty, to: :eac_git
|
12
10
|
|
13
11
|
def dirty_files
|
14
|
-
|
15
|
-
|
12
|
+
eac_git.dirty_files.map do |df|
|
13
|
+
::OpenStruct.new(
|
14
|
+
df.to_h.merge(path: df.path.to_path, absolute_path: df.absolute_path.to_path)
|
15
|
+
)
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def parse_status_line(line)
|
22
|
-
m = /\A(.)(.)\s(.+)\z/.match(line)
|
23
|
-
::Kernel.raise "Status pattern does not match \"#{line}\"" unless m
|
24
|
-
::OpenStruct.new(index: m[1], worktree: m[2], path: m[3],
|
25
|
-
absolute_path: ::File.expand_path(m[3], self))
|
26
|
-
end
|
27
18
|
end
|
28
19
|
end
|
29
20
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
module EacGit
|
7
|
+
class Local
|
8
|
+
module DirtyFiles
|
9
|
+
STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
|
10
|
+
|
11
|
+
def dirty?
|
12
|
+
dirty_files.any?
|
13
|
+
end
|
14
|
+
|
15
|
+
def dirty_file?(path)
|
16
|
+
absolute_path = path.to_pathname.expand_path(root_path)
|
17
|
+
dirty_files.any? do |df|
|
18
|
+
df.absolute_path == absolute_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def dirty_files
|
23
|
+
command('status', '--porcelain', '--untracked-files').execute!.each_line.map do |line|
|
24
|
+
parse_status_line(line.gsub(/\n\z/, ''))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def parse_status_line(line)
|
31
|
+
STATUS_LINE_PATTERN.if_match(line) do |m|
|
32
|
+
::OpenStruct.new(index: m[1], worktree: m[2], path: m[3].to_pathname,
|
33
|
+
absolute_path: m[3].to_pathname.expand_path(root_path))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
+
require 'eac_ruby_utils/envs/ssh_env/dasho_options'
|
4
5
|
require 'eac_ruby_utils/listable'
|
5
6
|
require 'eac_ruby_utils/patches/object/if_present'
|
6
7
|
|
@@ -11,6 +12,7 @@ module EacRubyUtils
|
|
11
12
|
extend ::ActiveSupport::Concern
|
12
13
|
|
13
14
|
included do
|
15
|
+
include ::EacRubyUtils::Envs::SshEnv::DashoOptions
|
14
16
|
add_nodasho_option('IdentityFile')
|
15
17
|
end
|
16
18
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
4
|
require 'eac_ruby_utils/boolean'
|
5
|
+
require 'eac_ruby_utils/envs/ssh_env/dasho_options'
|
5
6
|
|
6
7
|
module EacRubyUtils
|
7
8
|
module Envs
|
@@ -10,6 +11,7 @@ module EacRubyUtils
|
|
10
11
|
extend ::ActiveSupport::Concern
|
11
12
|
|
12
13
|
included do
|
14
|
+
include ::EacRubyUtils::Envs::SshEnv::DashoOptions
|
13
15
|
add_nodasho_option('Quiet')
|
14
16
|
end
|
15
17
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
+
require 'eac_ruby_utils/envs/ssh_env/dasho_options'
|
4
5
|
require 'eac_ruby_utils/listable'
|
5
6
|
require 'eac_ruby_utils/patches/object/if_present'
|
6
7
|
|
@@ -11,6 +12,7 @@ module EacRubyUtils
|
|
11
12
|
extend ::ActiveSupport::Concern
|
12
13
|
|
13
14
|
included do
|
15
|
+
include ::EacRubyUtils::Envs::SshEnv::DashoOptions
|
14
16
|
add_nodasho_option('Terminal')
|
15
17
|
include ::EacRubyUtils::Listable
|
16
18
|
lists.add_string :terminal_option, :auto, :disable, :enable, :force
|
@@ -33,6 +33,11 @@ module EacRubyUtils
|
|
33
33
|
find_list_by_method(name) || super
|
34
34
|
end
|
35
35
|
|
36
|
+
def hash_keys_validate!(hash, error_class = ::StandardError)
|
37
|
+
hash.keys.each { |key| value_validate!(key, error_class) }
|
38
|
+
hash
|
39
|
+
end
|
40
|
+
|
36
41
|
def i18n_key
|
37
42
|
"eac_ruby_utils.listable.#{class_i18n_key}.#{item}"
|
38
43
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/inflector'
|
4
|
+
require 'eac_ruby_utils/listable'
|
4
5
|
|
5
6
|
module EacRubyUtils
|
6
7
|
class << self
|
@@ -10,15 +11,14 @@ module EacRubyUtils
|
|
10
11
|
end
|
11
12
|
|
12
13
|
class RequireSub
|
13
|
-
|
14
|
-
|
15
|
-
REQUIRE_DEPENDENCY_OPTION_KEY = :require_dependency
|
14
|
+
include ::EacRubyUtils::Listable
|
15
|
+
lists.add_symbol :option, :base, :include_modules, :require_dependency
|
16
16
|
|
17
17
|
attr_reader :file, :options
|
18
18
|
|
19
19
|
def initialize(file, options = {})
|
20
20
|
@file = file
|
21
|
-
@options = options
|
21
|
+
@options = self.class.lists.option.hash_keys_validate!(options)
|
22
22
|
end
|
23
23
|
|
24
24
|
def apply
|
@@ -29,7 +29,7 @@ module EacRubyUtils
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def active_support_require(path)
|
32
|
-
return false unless options[
|
32
|
+
return false unless options[OPTION_REQUIRE_DEPENDENCY]
|
33
33
|
|
34
34
|
::Kernel.require_dependency(path)
|
35
35
|
true
|
@@ -46,7 +46,7 @@ module EacRubyUtils
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def include_modules
|
49
|
-
return unless options[
|
49
|
+
return unless options[OPTION_INCLUDE_MODULES]
|
50
50
|
|
51
51
|
base.constants.each do |constant_name|
|
52
52
|
constant = base.const_get(constant_name)
|
@@ -57,11 +57,11 @@ module EacRubyUtils
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def base
|
60
|
-
options[
|
60
|
+
options[OPTION_BASE] || raise('Option :base not setted')
|
61
61
|
end
|
62
62
|
|
63
63
|
def base?
|
64
|
-
options[
|
64
|
+
options[OPTION_BASE] ? true : false
|
65
65
|
end
|
66
66
|
|
67
67
|
def kernel_require(path)
|
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.60.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-07-
|
11
|
+
date: 2020-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -360,6 +360,7 @@ files:
|
|
360
360
|
- lib/avm/instances/entry_keys.rb
|
361
361
|
- lib/avm/local_projects.rb
|
362
362
|
- lib/avm/local_projects/instance.rb
|
363
|
+
- lib/avm/local_projects/jobs/update.rb
|
363
364
|
- lib/avm/patches.rb
|
364
365
|
- lib/avm/patches/object/template.rb
|
365
366
|
- lib/avm/path_string.rb
|
@@ -367,6 +368,7 @@ files:
|
|
367
368
|
- lib/avm/projects/stereotype.rb
|
368
369
|
- lib/avm/projects/stereotypes.rb
|
369
370
|
- lib/avm/projects/stereotypes/git.rb
|
371
|
+
- lib/avm/projects/stereotypes/git/local_project_mixin.rb
|
370
372
|
- lib/avm/projects/stereotypes/git/publish.rb
|
371
373
|
- lib/avm/projects/stereotypes/git/warp.rb
|
372
374
|
- lib/avm/projects/stereotypes/git_subrepo.rb
|
@@ -378,7 +380,9 @@ files:
|
|
378
380
|
- lib/avm/projects/stereotypes/rails_application.rb
|
379
381
|
- lib/avm/projects/stereotypes/redmine_plugin.rb
|
380
382
|
- lib/avm/projects/stereotypes/ruby_gem.rb
|
383
|
+
- lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
|
381
384
|
- lib/avm/projects/stereotypes/ruby_gem/publish.rb
|
385
|
+
- lib/avm/projects/stereotypes/ruby_gem/update.rb
|
382
386
|
- lib/avm/rails.rb
|
383
387
|
- lib/avm/rails/runners.rb
|
384
388
|
- lib/avm/rails/runners/bundle.rb
|
@@ -468,6 +472,7 @@ files:
|
|
468
472
|
- lib/avm/tools/runner/launcher/publish.rb
|
469
473
|
- lib/avm/tools/runner/local_project.rb
|
470
474
|
- lib/avm/tools/runner/local_project/info.rb
|
475
|
+
- lib/avm/tools/runner/local_project/update.rb
|
471
476
|
- lib/avm/tools/runner/ruby.rb
|
472
477
|
- lib/avm/tools/runner/ruby/gems.rb
|
473
478
|
- lib/avm/tools/runner/ruby/gems/generate.rb
|
@@ -552,6 +557,7 @@ files:
|
|
552
557
|
- vendor/eac_git/lib/eac_git.rb
|
553
558
|
- vendor/eac_git/lib/eac_git/executables.rb
|
554
559
|
- vendor/eac_git/lib/eac_git/local.rb
|
560
|
+
- vendor/eac_git/lib/eac_git/local/dirty_files.rb
|
555
561
|
- vendor/eac_git/lib/eac_git/local/subrepo.rb
|
556
562
|
- vendor/eac_git/lib/eac_git/local/subrepo/config.rb
|
557
563
|
- vendor/eac_git/lib/eac_git/remote.rb
|