avm-tools 0.79.0 → 0.80.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eec96ee906113345d8ef2b32945ccf9140141b63cdeaccb7b2f351762f338e82
4
- data.tar.gz: 8f25aaa99149329fc034c040f45609b8eb078b2c547ab88d99c89dfd2b607135
3
+ metadata.gz: '0517668b390f4bfcd0ade6b28b127de99e7b309e54633353bae6a0e558c36054'
4
+ data.tar.gz: d6cb8cb3880f9929fe7f5bea9ed794934a50e2aed96fccbe4c1f42c5cc2e2524
5
5
  SHA512:
6
- metadata.gz: 1790d224e7b049c1aca352e2d4859ae9d48d80df3664aa2741654a56c70491e065380936e1d62f542b449aaf8de3e7e5d609985da830ebef6a24e4e392a75f99
7
- data.tar.gz: 4e658ff31fcb8044695f44a20a8f0777eda5eb580ddaad93d7e63f1ecfb4676e3f284e8e8578a0c3d2db1b978f0a3754ec3c0709fbb7e80c50a903c718dd408b
6
+ metadata.gz: f46b14fadb4d557a6e3af527649b9237b7e2281af7828bc646c031c326f9441d2720e07d878b161c42de90d0770edaf1df67b006b77b233b1a1b21352e346903
7
+ data.tar.gz: 8e2bf840b44027bfbe263607654e11ae4557d0bdbb0867e3cfad51f823f7e9427205c3ed296461c2c5414d354ad505d64e3a76a37256175d21bc5f947cbeaf8f
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'eac_git/local'
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 Subrepo < ::EacRubyUtils::Console::DocoptRunner
12
+ class Fix
13
+ runner_with :help do
14
+ desc 'Fix git-subrepos\' parent property.'
15
+ end
16
+
17
+ def run
18
+ loop do
19
+ break if fix
20
+
21
+ amend_each
22
+ rebase_fixup
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def amend_each
29
+ infov 'Dirty files', local_repos.dirty_files.count
30
+ local_repos.dirty_files.each do |file|
31
+ infov ' * Ammending', file.path
32
+ ::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file.path).run
33
+ end
34
+ end
35
+
36
+ def fix
37
+ infom 'Checking/fixing...'
38
+ c = new_check(true)
39
+ c.show_result
40
+ !c.result.error?
41
+ end
42
+
43
+ def new_check(fix_parent = false)
44
+ r = ::Avm::Git::SubrepoChecks.new(local_repos).add_all_subrepos
45
+ r.fix_parent = fix_parent
46
+ r
47
+ end
48
+
49
+ def local_repos_uncached
50
+ ::EacGit::Local.new(runner_context.call(:git))
51
+ end
52
+
53
+ def rebase_fixup
54
+ local_repos.command('rebase', '-i', 'origin/master', '--autosquash').envvar(
55
+ 'GIT_SEQUENCE_EDITOR', 'true'
56
+ ).or(
57
+ local_repos.command('rebase', '--continue').envvar('GIT_SEQUENCE_EDITOR', 'true')
58
+ ).system!
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.79.0'
5
+ VERSION = '0.80.0'
6
6
  end
7
7
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/hash/indifferent_access'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'eac_ruby_utils/envs/command/extra_options'
3
+ require 'eac_ruby_utils/core_ext'
6
4
  require 'eac_ruby_utils/envs/process'
7
5
  require 'eac_ruby_utils/envs/spawn'
8
6
  require 'pp'
@@ -11,8 +9,8 @@ require 'shellwords'
11
9
  module EacRubyUtils
12
10
  module Envs
13
11
  class Command
14
- include EacRubyUtils::Console::Speaker
15
- include EacRubyUtils::Envs::Command::ExtraOptions
12
+ require_sub __FILE__, include_modules: true
13
+ enable_console_speaker
16
14
 
17
15
  def initialize(env, command, extra_options = {})
18
16
  @env = env
@@ -47,7 +45,7 @@ module EacRubyUtils
47
45
  c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
48
46
  append_command_options(
49
47
  @env.command_line(
50
- append_chdir(append_pipe(append_envvars(c)))
48
+ append_chdir(append_concat(append_envvars(c)))
51
49
  ),
52
50
  options
53
51
  )
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/struct'
4
+
5
+ module EacRubyUtils
6
+ module Envs
7
+ class Command
8
+ module Concat
9
+ def concat(operator, other_command)
10
+ duplicate_by_extra_options(concat: ::EacRubyUtils::Struct.new(
11
+ operator: operator, command: other_command
12
+ ))
13
+ end
14
+
15
+ def or(other_command)
16
+ concat('||', other_command)
17
+ end
18
+
19
+ def pipe(other_command)
20
+ concat('|', other_command)
21
+ end
22
+
23
+ private
24
+
25
+ def append_concat(command)
26
+ extra_options[:concat].if_present(command) do |v|
27
+ "#{command} #{v.operator} #{v.command.command}"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ module Envs
5
+ class Command
6
+ module Envvars
7
+ def envvar(name, value)
8
+ duplicate_by_extra_options(envvars: envvars.merge(name => value))
9
+ end
10
+
11
+ private
12
+
13
+ def append_envvars(command)
14
+ e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
15
+ e.present? ? "#{e} #{command}" : command
16
+ end
17
+
18
+ def envvars
19
+ extra_options[:envvars] ||= {}.with_indifferent_access
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -12,39 +12,18 @@ module EacRubyUtils
12
12
  duplicate_by_extra_options(chdir: dir)
13
13
  end
14
14
 
15
- def envvar(name, value)
16
- duplicate_by_extra_options(envvars: envvars.merge(name => value))
17
- end
18
-
19
15
  def status_result(status_code, result)
20
16
  duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
21
17
  end
22
18
 
23
- def pipe(other_command)
24
- duplicate_by_extra_options(pipe: other_command)
25
- end
26
-
27
19
  private
28
20
 
29
21
  attr_reader :extra_options
30
22
 
31
- def envvars
32
- extra_options[:envvars] ||= {}.with_indifferent_access
33
- end
34
-
35
23
  def status_results
36
24
  extra_options[:status_results] ||= {}.with_indifferent_access
37
25
  end
38
26
 
39
- def append_envvars(command)
40
- e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
41
- e.present? ? "#{e} #{command}" : command
42
- end
43
-
44
- def append_pipe(command)
45
- extra_options[:pipe].present? ? "#{command} | #{extra_options[:pipe].command}" : command
46
- end
47
-
48
27
  def append_chdir(command)
49
28
  extra_options[:chdir].present? ? "(cd '#{extra_options[:chdir]}' ; #{command} )" : command
50
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.54.0'
4
+ VERSION = '0.55.0'
5
5
  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.79.0
4
+ version: 0.80.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-12-12 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -509,6 +509,7 @@ files:
509
509
  - lib/avm/tools/runner/git/subrepo.rb
510
510
  - lib/avm/tools/runner/git/subrepo/check.rb
511
511
  - lib/avm/tools/runner/git/subrepo/clone.rb
512
+ - lib/avm/tools/runner/git/subrepo/fix.rb
512
513
  - lib/avm/tools/runner/instance.rb
513
514
  - lib/avm/tools/runner/instance/info.rb
514
515
  - lib/avm/tools/runner/launcher.rb
@@ -929,6 +930,8 @@ files:
929
930
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs.rb
930
931
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb
931
932
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb
933
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb
934
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb
932
935
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
933
936
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb
934
937
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb