avm-tools 0.89.0 → 0.94.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_asciidoctor_base0.rb +9 -0
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/apache_host.rb +1 -1
- data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -3
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build/file.rb +4 -4
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/deploy.rb +6 -6
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/instance.rb +1 -1
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/project.rb +1 -1
- data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
- data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
- data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
- data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
- data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/git/auto_commit/commit_info.rb +23 -0
- data/lib/avm/git/auto_commit/rules.rb +31 -0
- data/lib/avm/git/auto_commit/rules/base.rb +39 -0
- data/lib/avm/git/auto_commit/rules/last.rb +19 -0
- data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
- data/lib/avm/git/auto_commit/rules/new.rb +24 -0
- data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
- data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
- data/lib/avm/git/auto_commit_path.rb +0 -21
- data/lib/avm/git/file_auto_fixup.rb +20 -61
- data/lib/avm/tools/runner/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
- data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
- data/lib/avm/tools/runner/git/commit.rb +11 -20
- data/lib/avm/tools/runner/local_project/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
- data/lib/avm/tools/runner/local_project/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -9
- data/lib/avm/tools/runner/local_project/ruby.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby/bundler.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +1 -1
- data/lib/avm/tools/runner/ruby.rb +6 -14
- data/lib/avm/tools/runner/ruby/gems.rb +4 -7
- data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
- data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
- data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
- data/vendor/avm-apps/Gemfile +5 -0
- data/vendor/avm-apps/avm-apps.gemspec +18 -0
- data/{lib/avm/eac_writings_base1.rb → vendor/avm-apps/lib/avm/apps.rb} +1 -1
- data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
- data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
- data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
- data/vendor/avm-apps/spec/spec_helper.rb +100 -0
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
- data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +55 -16
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
- data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
- data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/git/auto_commit/commit_info'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module Avm
|
@@ -8,31 +9,30 @@ module Avm
|
|
8
9
|
enable_console_speaker
|
9
10
|
enable_simple_cache
|
10
11
|
enable_listable
|
11
|
-
lists.add_symbol :option, :select, :unique
|
12
12
|
|
13
|
-
common_constructor :git, :path, :
|
14
|
-
self.
|
13
|
+
common_constructor :git, :path, :rules do
|
14
|
+
self.path = path.to_pathname
|
15
15
|
end
|
16
16
|
|
17
|
-
COMMIT_FORMAT = '%h - %s (%cr)'
|
18
17
|
COMMITS_SEARCH_INTERVAL = 'origin/master..HEAD'
|
19
|
-
|
18
|
+
|
19
|
+
def git_relative_path
|
20
|
+
path.to_pathname.relative_path_from(git.root_path)
|
21
|
+
end
|
20
22
|
|
21
23
|
def run
|
22
24
|
start_banner
|
23
|
-
|
24
|
-
run_no_commits_found
|
25
|
-
elsif auto_selected_commit.present?
|
26
|
-
fixup_commit(auto_selected_commit)
|
27
|
-
else
|
28
|
-
run_commits_selection
|
29
|
-
end
|
25
|
+
run_commit || warn("No rule returned commit information for \"#{path}\"")
|
30
26
|
end
|
31
27
|
|
32
28
|
private
|
33
29
|
|
34
|
-
def
|
35
|
-
|
30
|
+
def commit_args
|
31
|
+
commit_info.if_present([], &:git_commit_args) + ['--', git_relative_path]
|
32
|
+
end
|
33
|
+
|
34
|
+
def commit_info_uncached
|
35
|
+
rules.lazy.map { |rule| rule.with_file(self).commit_info }.find(&:present?)
|
36
36
|
end
|
37
37
|
|
38
38
|
def start_banner
|
@@ -40,50 +40,13 @@ module Avm
|
|
40
40
|
infov ' Commits found', commits.count
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
def fixup_commit(commit)
|
48
|
-
infov ' Commit selected/found', format_commit(commit)
|
49
|
-
git.execute!('commit', '--fixup', commit.sha1, '--', path)
|
50
|
-
success " Fixup with \"#{format_commit(commit)}\""
|
51
|
-
end
|
52
|
-
|
53
|
-
def run_commits_selection
|
54
|
-
selected_commit = select_commit
|
55
|
-
if selected_commit
|
56
|
-
fixup_commit(selected_commit)
|
57
|
-
else
|
58
|
-
infom ' Skipped'
|
59
|
-
end
|
60
|
-
end
|
43
|
+
def run_commit
|
44
|
+
return false if commit_info.blank?
|
61
45
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
def selected_commit_by_unique
|
68
|
-
return unless options[OPTION_UNIQUE]
|
69
|
-
return commits.first if commits.first
|
70
|
-
end
|
71
|
-
|
72
|
-
def select_commit_by_select
|
73
|
-
options[OPTION_SELECT].if_present(&:to_i).if_present do |v|
|
74
|
-
commits.find { |commit| commit.position == v }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def commits_banner
|
79
|
-
commits.each_with_index do |commit, _index|
|
80
|
-
infov " #{commit.position}", format_commit(commit)
|
81
|
-
end
|
82
|
-
infov " #{SKIP_OPTION}", 'skip'
|
83
|
-
end
|
84
|
-
|
85
|
-
def commits_by_position
|
86
|
-
(commits.map { |commit| [commit.position.to_s, commit] } + [[SKIP_OPTION, nil]]).to_h
|
46
|
+
infov ' Commit arguments', ::Shellwords.join(commit_args)
|
47
|
+
git.execute!('commit', *commit_args)
|
48
|
+
success ' Commited'
|
49
|
+
true
|
87
50
|
end
|
88
51
|
|
89
52
|
def commits_uncached
|
@@ -93,10 +56,6 @@ module Avm
|
|
93
56
|
.each_with_index.map { |commit, index| CommitDelegator.new(commit, index) }
|
94
57
|
end
|
95
58
|
|
96
|
-
def format_commit(commit)
|
97
|
-
commit.format(COMMIT_FORMAT)
|
98
|
-
end
|
99
|
-
|
100
59
|
class CommitDelegator < ::SimpleDelegator
|
101
60
|
attr_reader :index
|
102
61
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_webapp_base0/runner'
|
4
|
-
require 'avm/
|
4
|
+
require 'avm/eac_asciidoctor_base0'
|
5
5
|
require 'eac_ruby_utils/console/docopt_runner'
|
6
6
|
|
7
7
|
module Avm
|
8
8
|
module Tools
|
9
9
|
class Runner
|
10
|
-
class
|
10
|
+
class EacAsciidoctorBase0 < ::Avm::EacWebappBase0::Runner
|
11
11
|
require_sub __FILE__
|
12
12
|
end
|
13
13
|
end
|
@@ -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,64 +1,63 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_cli/core_ext'
|
4
4
|
require 'avm/files/formatter'
|
5
|
-
require '
|
5
|
+
require 'avm/git/file_auto_fixup'
|
6
|
+
require 'avm/git/auto_commit/rules'
|
6
7
|
|
7
8
|
module Avm
|
8
9
|
module Tools
|
9
10
|
class Runner
|
10
11
|
class Git
|
11
|
-
class AutoCommit
|
12
|
-
|
13
|
-
|
14
|
-
runner_definition do
|
15
|
-
desc 'Commit with message based in content commited.'
|
12
|
+
class AutoCommit
|
13
|
+
runner_with :help do
|
14
|
+
desc 'Auto fixup files.'
|
16
15
|
bool_opt '-d', '--dirty', 'Select dirty files.'
|
17
16
|
bool_opt '-f', '--format', 'Format files before commit.'
|
18
|
-
|
17
|
+
arg_opt '-r', '--rule', 'Apply a rule in the specified order.', repeat: true
|
18
|
+
pos_arg :files, repeat: true, optional: true
|
19
19
|
end
|
20
20
|
|
21
21
|
def run
|
22
|
-
clear_stage
|
23
|
-
banner
|
24
22
|
format_files
|
25
|
-
|
23
|
+
files.each do |file|
|
24
|
+
::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file, rules).run
|
25
|
+
end
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def files_uncached
|
31
|
+
(files_from_option + dirty_files).sort.uniq
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
36
|
-
context(:git).system!('reset', 'HEAD')
|
34
|
+
def files_from_option
|
35
|
+
parsed.files.map { |p| p.to_pathname.expand_path }
|
37
36
|
end
|
38
37
|
|
39
|
-
def
|
40
|
-
return
|
38
|
+
def format_files
|
39
|
+
return unless parsed.format?
|
41
40
|
|
42
|
-
|
41
|
+
infom 'Formating files...'
|
42
|
+
::Avm::Files::Formatter.new(files, ::Avm::Files::Formatter::OPTION_APPLY => true).run
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
return unless
|
45
|
+
def dirty_files
|
46
|
+
return [] unless parsed.dirty?
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
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
51
|
end
|
52
52
|
|
53
|
-
def
|
54
|
-
|
55
|
-
.
|
56
|
-
|
57
|
-
.sort.uniq.map { |path| ::Avm::Git::AutoCommitPath.new(context(:git), path) }
|
53
|
+
def rules
|
54
|
+
parsed.rule.map do |rule_string|
|
55
|
+
::Avm::Git::AutoCommit::Rules.parse(rule_string)
|
56
|
+
end
|
58
57
|
end
|
59
58
|
|
60
|
-
def
|
61
|
-
|
59
|
+
def select
|
60
|
+
parsed.last? ? 1 : parsed.select
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
@@ -11,22 +11,13 @@ module Avm
|
|
11
11
|
module Tools
|
12
12
|
class Runner
|
13
13
|
class Git
|
14
|
-
class Commit
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
Usage:
|
22
|
-
__PROGRAM__ [options] <ref>
|
23
|
-
__PROGRAM__ -h | --help
|
24
|
-
|
25
|
-
Options:
|
26
|
-
-h --help Mostra esta ajuda.
|
27
|
-
-f --files Mostra os arquivos.
|
28
|
-
-s --size Mostra o tamanho de arquivos.
|
29
|
-
DOCOPT
|
14
|
+
class Commit
|
15
|
+
runner_with :help do
|
16
|
+
desc 'Mostra informações de um commit.'
|
17
|
+
bool_opt '-f', '--files', 'Mostra os arquivos.'
|
18
|
+
bool_opt '-s', '--size', 'Mostra o tamanho de arquivos.'
|
19
|
+
pos_arg :ref
|
20
|
+
end
|
30
21
|
|
31
22
|
def run
|
32
23
|
input_banner
|
@@ -64,7 +55,7 @@ module Avm
|
|
64
55
|
end
|
65
56
|
|
66
57
|
def files_banner
|
67
|
-
return unless
|
58
|
+
return unless parsed.files?
|
68
59
|
|
69
60
|
commit.files.each do |file|
|
70
61
|
infov " #{file.path}", file_value(file)
|
@@ -82,11 +73,11 @@ module Avm
|
|
82
73
|
end
|
83
74
|
|
84
75
|
def reference
|
85
|
-
|
76
|
+
parsed.ref
|
86
77
|
end
|
87
78
|
|
88
79
|
def git_uncached
|
89
|
-
::EacLauncher::Git::Base.new(
|
80
|
+
::EacLauncher::Git::Base.new(runner_context.call(:repository_path))
|
90
81
|
end
|
91
82
|
|
92
83
|
def commit_uncached
|
@@ -103,7 +94,7 @@ module Avm
|
|
103
94
|
end
|
104
95
|
|
105
96
|
def show_size?
|
106
|
-
|
97
|
+
parsed.size?
|
107
98
|
end
|
108
99
|
end
|
109
100
|
end
|
@@ -7,11 +7,11 @@ module Avm
|
|
7
7
|
module Tools
|
8
8
|
class Runner
|
9
9
|
class LocalProject
|
10
|
-
class
|
10
|
+
class EacAsciidoctorBase0
|
11
11
|
require_sub __FILE__
|
12
12
|
|
13
13
|
runner_with :help, :subcommands do
|
14
|
-
desc '
|
14
|
+
desc 'EacAsciidoctorBase0 utitilies for local projects.'
|
15
15
|
subcommands
|
16
16
|
end
|
17
17
|
|
data/lib/avm/tools/runner/local_project/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
4
|
-
require 'avm/
|
3
|
+
require 'avm/eac_asciidoctor_base0/build'
|
4
|
+
require 'avm/eac_asciidoctor_base0/project'
|
5
5
|
require 'eac_cli/core_ext'
|
6
6
|
require 'eac_ruby_utils/console/docopt_runner'
|
7
7
|
|
@@ -9,7 +9,7 @@ module Avm
|
|
9
9
|
module Tools
|
10
10
|
class Runner
|
11
11
|
class LocalProject
|
12
|
-
class
|
12
|
+
class EacAsciidoctorBase0
|
13
13
|
class Build
|
14
14
|
runner_with :help do
|
15
15
|
desc 'Build the project'
|
@@ -24,8 +24,8 @@ module Avm
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def build_uncached
|
27
|
-
::Avm::
|
28
|
-
|
27
|
+
::Avm::EacAsciidoctorBase0::Build.new(runner_context.call(:project),
|
28
|
+
target_directory: parsed.target_dir)
|
29
29
|
end
|
30
30
|
|
31
31
|
def default_target_directory
|
@@ -36,10 +36,6 @@ module Avm
|
|
36
36
|
runner_context.call(:project_banner)
|
37
37
|
infov 'Target directory', build.target_directory
|
38
38
|
end
|
39
|
-
#
|
40
|
-
# def target_directory_uncached
|
41
|
-
# .if_present(default_target_directory).to_pathname
|
42
|
-
# end
|
43
39
|
end
|
44
40
|
end
|
45
41
|
end
|
@@ -7,7 +7,7 @@ module Avm
|
|
7
7
|
module Tools
|
8
8
|
class Runner
|
9
9
|
class LocalProject
|
10
|
-
class Ruby
|
10
|
+
class Ruby
|
11
11
|
class Bundler < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
class GemfileLock < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
include ::EacCli::DefaultRunner
|
@@ -1,24 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
3
|
+
require 'eac_cli/core_ext'
|
5
4
|
|
6
5
|
module Avm
|
7
6
|
module Tools
|
8
7
|
class Runner
|
9
|
-
class Ruby
|
8
|
+
class Ruby
|
10
9
|
require_sub __FILE__
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Usage:
|
16
|
-
__PROGRAM__ [options] __SUBCOMMANDS__
|
17
|
-
__PROGRAM__ -h | --help
|
18
|
-
|
19
|
-
Options:
|
20
|
-
-h --help Show this screen.
|
21
|
-
DOCOPT
|
10
|
+
runner_with :help, :subcommands do
|
11
|
+
desc 'Ruby utilities for AVM.'
|
12
|
+
subcommands
|
13
|
+
end
|
22
14
|
end
|
23
15
|
end
|
24
16
|
end
|