avm-tools 0.93.0 → 0.94.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/git/auto_commit/commit_info.rb +2 -1
- data/lib/avm/git/auto_commit/rules.rb +4 -4
- data/lib/avm/git/auto_commit/rules/new.rb +24 -0
- data/lib/avm/git/auto_commit/rules/nth.rb +8 -0
- data/lib/avm/git/auto_commit_path.rb +0 -21
- data/lib/avm/git/file_auto_fixup.rb +8 -2
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
- data/lib/avm/tools/runner/git/auto_commit.rb +28 -28
- data/lib/avm/tools/version.rb +1 -1
- metadata +3 -3
- data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5c0c0b3a077d30739e756476f997c1d74acc2f6cbf52ba89ca55efecc87879a
|
4
|
+
data.tar.gz: e26b9535c059c92e9a401db8552d33ca16f8ee38bf9743100cb61cbcf2d27c39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce8b71b8307d328e7a8ecb64d6c860eea72a47c22a769de30c101686b7089b9e6ee1d05a932c311139e3ba554bff03fae9d091cd9c1eb97ae2cb6d8135e8ee6b
|
7
|
+
data.tar.gz: eb891b911edc41e6989ab28f59f79b47e9d49ad18454cb8178a49f3e87f79f3b36206057476aa524d7a197d333228f551dfcce43553ae4aac2369382e62b94bf
|
@@ -8,10 +8,11 @@ module Avm
|
|
8
8
|
class CommitInfo
|
9
9
|
enable_immutable
|
10
10
|
|
11
|
-
immutable_accessor :fixup
|
11
|
+
immutable_accessor :fixup, :message
|
12
12
|
|
13
13
|
def git_commit_args
|
14
14
|
r = fixup.if_present([]) { |v| ['--fixup', v.sha1] }
|
15
|
+
r += message.if_present([]) { |v| ['--message', v] }
|
15
16
|
return r if r.any?
|
16
17
|
|
17
18
|
raise 'Argument list is empty'
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
4
|
|
5
|
+
::EacRubyUtils.require_sub __FILE__
|
6
|
+
|
5
7
|
module Avm
|
6
8
|
module Git
|
7
9
|
module AutoCommit
|
8
10
|
module Rules
|
9
|
-
|
10
|
-
|
11
|
-
RULES_CLASSES = %w[last manual nth unique]
|
11
|
+
RULES_CLASSES = %w[last manual new nth unique]
|
12
12
|
.map { |key| ::Avm::Git::AutoCommit::Rules.const_get(key.camelcase) }
|
13
13
|
|
14
14
|
class << self
|
@@ -22,7 +22,7 @@ module Avm
|
|
22
22
|
def rule_class_by_key(key)
|
23
23
|
RULES_CLASSES.find { |klass| klass.keys.include?(key) } ||
|
24
24
|
raise("Rule not find with key \"#{key}\" (Available: " +
|
25
|
-
RULES_CLASSES.flat_map(&:keys) + ')')
|
25
|
+
RULES_CLASSES.flat_map(&:keys).join(', ') + ')')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit/rules/base'
|
4
|
+
require 'avm/git/auto_commit_path'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
module AutoCommit
|
9
|
+
module Rules
|
10
|
+
class New < ::Avm::Git::AutoCommit::Rules::Base
|
11
|
+
class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
|
12
|
+
def auto_commit_path
|
13
|
+
::Avm::Git::AutoCommitPath.new(file.git, file.path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def commit_info
|
17
|
+
new_commit_info.message(auto_commit_path.commit_message)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -6,31 +6,10 @@ module Avm
|
|
6
6
|
module Git
|
7
7
|
class AutoCommitPath
|
8
8
|
require_sub __FILE__, include_modules: true
|
9
|
-
enable_console_speaker
|
10
9
|
common_constructor :git, :path do
|
11
10
|
self.path = path.to_pathname
|
12
11
|
end
|
13
12
|
|
14
|
-
CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
15
|
-
|
16
|
-
def run
|
17
|
-
banner
|
18
|
-
commit
|
19
|
-
end
|
20
|
-
|
21
|
-
def banner
|
22
|
-
infom "Checking \"#{relative_path}\""
|
23
|
-
infov ' * Class name', class_name
|
24
|
-
infov ' * Commit message', commit_message
|
25
|
-
end
|
26
|
-
|
27
|
-
def commit
|
28
|
-
infom ' * Commiting...'
|
29
|
-
git.system!('reset', 'HEAD')
|
30
|
-
git.system!('add', '--', relative_path.to_path)
|
31
|
-
git.system!('commit', '-m', commit_message, '--', relative_path.to_path)
|
32
|
-
end
|
33
|
-
|
34
13
|
def class_name
|
35
14
|
ruby_class_name || relative_path.to_path
|
36
15
|
end
|
@@ -10,10 +10,16 @@ module Avm
|
|
10
10
|
enable_simple_cache
|
11
11
|
enable_listable
|
12
12
|
|
13
|
-
common_constructor :git, :path, :rules
|
13
|
+
common_constructor :git, :path, :rules do
|
14
|
+
self.path = path.to_pathname
|
15
|
+
end
|
14
16
|
|
15
17
|
COMMITS_SEARCH_INTERVAL = 'origin/master..HEAD'
|
16
18
|
|
19
|
+
def git_relative_path
|
20
|
+
path.to_pathname.relative_path_from(git.root_path)
|
21
|
+
end
|
22
|
+
|
17
23
|
def run
|
18
24
|
start_banner
|
19
25
|
run_commit || warn("No rule returned commit information for \"#{path}\"")
|
@@ -22,7 +28,7 @@ module Avm
|
|
22
28
|
private
|
23
29
|
|
24
30
|
def commit_args
|
25
|
-
commit_info.if_present([], &:git_commit_args) + ['--',
|
31
|
+
commit_info.if_present([], &:git_commit_args) + ['--', git_relative_path]
|
26
32
|
end
|
27
33
|
|
28
34
|
def commit_info_uncached
|
@@ -1,18 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_redmine_base0/core_update'
|
4
|
-
require 'eac_cli/
|
5
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_cli/core_ext'
|
7
5
|
|
8
6
|
module Avm
|
9
7
|
module Tools
|
10
8
|
class Runner
|
11
9
|
class EacRedmineBase0 < ::Avm::EacRailsBase1::Runner
|
12
|
-
class CoreUpdate
|
13
|
-
|
14
|
-
|
15
|
-
runner_definition do
|
10
|
+
class CoreUpdate
|
11
|
+
runner_with :help do
|
16
12
|
arg_opt '-u', '--url', 'Core\'s package URL.'
|
17
13
|
arg_opt '-v', '--version', 'Core\'s version.'
|
18
14
|
desc 'Update instance\' core.'
|
@@ -32,7 +28,7 @@ module Avm
|
|
32
28
|
end
|
33
29
|
|
34
30
|
def update
|
35
|
-
::Avm::EacRedmineBase0::CoreUpdate.new(
|
31
|
+
::Avm::EacRedmineBase0::CoreUpdate.new(runner_context.call(:instance), version, url).run
|
36
32
|
end
|
37
33
|
|
38
34
|
def url
|
@@ -40,7 +36,7 @@ module Avm
|
|
40
36
|
end
|
41
37
|
|
42
38
|
def url_by_version
|
43
|
-
|
39
|
+
parsed.version.if_present do |v|
|
44
40
|
"https://www.redmine.org/releases/redmine-#{v}.tar.gz"
|
45
41
|
end
|
46
42
|
end
|
@@ -52,11 +48,11 @@ module Avm
|
|
52
48
|
end
|
53
49
|
|
54
50
|
def version
|
55
|
-
|
51
|
+
parsed.version || version_by_url
|
56
52
|
end
|
57
53
|
|
58
54
|
def version_by_url
|
59
|
-
|
55
|
+
parsed.url.if_present do |v|
|
60
56
|
/(\d+.\d+.\d+)/.if_match(v, false) { |m| m[1] }
|
61
57
|
end
|
62
58
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/git/auto_commit_path'
|
4
|
-
require 'avm/files/formatter'
|
5
3
|
require 'eac_cli/core_ext'
|
4
|
+
require 'avm/files/formatter'
|
5
|
+
require 'avm/git/file_auto_fixup'
|
6
|
+
require 'avm/git/auto_commit/rules'
|
6
7
|
|
7
8
|
module Avm
|
8
9
|
module Tools
|
@@ -10,54 +11,53 @@ module Avm
|
|
10
11
|
class Git
|
11
12
|
class AutoCommit
|
12
13
|
runner_with :help do
|
13
|
-
desc '
|
14
|
+
desc 'Auto fixup files.'
|
14
15
|
bool_opt '-d', '--dirty', 'Select dirty files.'
|
15
16
|
bool_opt '-f', '--format', 'Format files before commit.'
|
16
|
-
|
17
|
+
arg_opt '-r', '--rule', 'Apply a rule in the specified order.', repeat: true
|
18
|
+
pos_arg :files, repeat: true, optional: true
|
17
19
|
end
|
18
20
|
|
19
21
|
def run
|
20
|
-
clear_stage
|
21
|
-
banner
|
22
22
|
format_files
|
23
|
-
|
23
|
+
files.each do |file|
|
24
|
+
::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file, rules).run
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
def
|
29
|
-
|
30
|
+
def files_uncached
|
31
|
+
(files_from_option + dirty_files).sort.uniq
|
30
32
|
end
|
31
33
|
|
32
|
-
def
|
33
|
-
|
34
|
-
runner_context.call(:git).system!('reset', 'HEAD')
|
35
|
-
end
|
36
|
-
|
37
|
-
def dirty_paths
|
38
|
-
return [] unless parsed.dirty?
|
39
|
-
|
40
|
-
runner_context.call(:git).dirty_files.map do |d|
|
41
|
-
runner_context.call(:git).root_path.join / d.path
|
42
|
-
end
|
34
|
+
def files_from_option
|
35
|
+
parsed.files.map { |p| p.to_pathname.expand_path }
|
43
36
|
end
|
44
37
|
|
45
38
|
def format_files
|
46
39
|
return unless parsed.format?
|
47
40
|
|
48
41
|
infom 'Formating files...'
|
49
|
-
::Avm::Files::Formatter.new(
|
50
|
-
::Avm::Files::Formatter::OPTION_APPLY => true).run
|
42
|
+
::Avm::Files::Formatter.new(files, ::Avm::Files::Formatter::OPTION_APPLY => true).run
|
51
43
|
end
|
52
44
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
56
|
-
|
45
|
+
def dirty_files
|
46
|
+
return [] unless parsed.dirty?
|
47
|
+
|
48
|
+
runner_context.call(:git).dirty_files.map do |file|
|
49
|
+
file.path.to_pathname.expand_path(runner_context.call(:git).root_path)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def rules
|
54
|
+
parsed.rule.map do |rule_string|
|
55
|
+
::Avm::Git::AutoCommit::Rules.parse(rule_string)
|
56
|
+
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
60
|
-
|
59
|
+
def select
|
60
|
+
parsed.last? ? 1 : parsed.select
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/avm/tools/version.rb
CHANGED
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.94.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: 2021-02-
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -408,6 +408,7 @@ files:
|
|
408
408
|
- lib/avm/git/auto_commit/rules/base.rb
|
409
409
|
- lib/avm/git/auto_commit/rules/last.rb
|
410
410
|
- lib/avm/git/auto_commit/rules/manual.rb
|
411
|
+
- lib/avm/git/auto_commit/rules/new.rb
|
411
412
|
- lib/avm/git/auto_commit/rules/nth.rb
|
412
413
|
- lib/avm/git/auto_commit/rules/unique.rb
|
413
414
|
- lib/avm/git/auto_commit_path.rb
|
@@ -542,7 +543,6 @@ files:
|
|
542
543
|
- lib/avm/tools/runner/files/rotate.rb
|
543
544
|
- lib/avm/tools/runner/git.rb
|
544
545
|
- lib/avm/tools/runner/git/auto_commit.rb
|
545
|
-
- lib/avm/tools/runner/git/auto_fixup.rb
|
546
546
|
- lib/avm/tools/runner/git/commit.rb
|
547
547
|
- lib/avm/tools/runner/git/deploy.rb
|
548
548
|
- lib/avm/tools/runner/git/dirty_files.rb
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/core_ext'
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
-
require 'avm/git/file_auto_fixup'
|
6
|
-
require 'avm/git/auto_commit/rules'
|
7
|
-
|
8
|
-
module Avm
|
9
|
-
module Tools
|
10
|
-
class Runner
|
11
|
-
class Git
|
12
|
-
class AutoFixup
|
13
|
-
runner_with :help do
|
14
|
-
desc 'Auto fixup files.'
|
15
|
-
arg_opt '-r', '--rule', 'Apply a rule in the specified order.', repeat: true
|
16
|
-
pos_arg :files, repeat: true, optional: true
|
17
|
-
end
|
18
|
-
|
19
|
-
def run
|
20
|
-
files.each do |file|
|
21
|
-
::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file, rules).run
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def files
|
28
|
-
files_from_option || dirty_files
|
29
|
-
end
|
30
|
-
|
31
|
-
def files_from_option
|
32
|
-
r = parsed.files
|
33
|
-
r.any? ? r.map { |p| p.to_pathname.expand_path } : nil
|
34
|
-
end
|
35
|
-
|
36
|
-
def dirty_files
|
37
|
-
runner_context.call(:git).dirty_files.map(&:path)
|
38
|
-
end
|
39
|
-
|
40
|
-
def rules
|
41
|
-
parsed.rule.map do |rule_string|
|
42
|
-
::Avm::Git::AutoCommit::Rules.parse(rule_string)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def select
|
47
|
-
parsed.last? ? 1 : parsed.select
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|