avm-tools 0.64.2 → 0.69.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_rails_base0/apache_host.rb +17 -0
- data/lib/avm/eac_rails_base0/deploy.rb +50 -0
- data/lib/avm/eac_rails_base0/instance.rb +14 -0
- data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +2 -2
- data/lib/avm/eac_webapp_base0/apache_host.rb +103 -0
- data/lib/avm/eac_webapp_base0/deploy.rb +102 -0
- data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +25 -0
- data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +41 -0
- data/lib/avm/eac_webapp_base0/deploy/git_info.rb +49 -0
- data/lib/avm/eac_webapp_base0/deploy/version.rb +20 -0
- data/lib/avm/eac_webapp_base0/instance.rb +50 -0
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +39 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +25 -0
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +69 -0
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +66 -0
- data/lib/avm/eac_webapp_base0/runner/deploy.rb +59 -0
- data/lib/avm/instances/configuration/_locale.rb +16 -0
- data/lib/avm/local_projects/instance.rb +28 -1
- data/lib/avm/patches/i18n.rb +22 -0
- data/lib/avm/patches/object/i18n.rb +17 -0
- data/lib/avm/patches/object/template.rb +3 -3
- data/lib/avm/projects/stereotype.rb +3 -2
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +2 -2
- data/lib/avm/projects/stereotypes/rails_application.rb +2 -0
- data/lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb +18 -0
- data/lib/avm/projects/stereotypes/rails_application/update.rb +14 -0
- data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +9 -0
- data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +61 -0
- data/lib/avm/self.rb +5 -1
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +2 -2
- data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +2 -2
- data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +2 -2
- data/lib/avm/tools/runner/eac_rails_base0.rb +2 -2
- data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +3 -26
- data/lib/avm/tools/runner/eac_rails_base0/data.rb +2 -2
- data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +3 -3
- data/lib/avm/tools/runner/eac_redmine_base0/data.rb +1 -1
- data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +1 -0
- data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +3 -25
- data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +2 -2
- data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +2 -2
- data/lib/avm/tools/runner/local_project.rb +5 -0
- data/lib/avm/tools/runner/local_project/ruby.rb +24 -0
- data/lib/avm/tools/runner/local_project/ruby/bundler.rb +25 -0
- data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +138 -0
- data/lib/avm/tools/runner/local_project/test.rb +34 -0
- data/lib/avm/tools/runner/local_project/update.rb +1 -2
- data/lib/avm/tools/runner/local_project/version_bump.rb +89 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/avm/version.rb +45 -0
- data/lib/eac_launcher/git/sub_warp_base.rb +1 -1
- data/lib/eac_launcher/publish/base.rb +1 -1
- data/template/avm/{stereotypes/eac_rails_base0 → eac_rails_base0}/deploy/config/database.yml.template +0 -0
- data/template/avm/{stereotypes/eac_webapp_base0 → eac_webapp_base0}/apache_host/no_ssl.conf +0 -0
- data/vendor/eac_cli/Gemfile +5 -0
- data/vendor/eac_cli/eac_cli.gemspec +18 -0
- data/vendor/eac_cli/lib/eac_cli.rb +7 -0
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +22 -0
- data/vendor/eac_cli/lib/eac_cli/definition.rb +72 -0
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -0
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +27 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +77 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +45 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +14 -0
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +56 -0
- data/vendor/eac_cli/lib/eac_cli/parser/error.rb +15 -0
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +105 -0
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +21 -0
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +49 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +87 -0
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +18 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +5 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +70 -0
- data/vendor/eac_cli/spec/rubocop_spec.rb +7 -0
- data/vendor/eac_cli/spec/spec_helper.rb +100 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +15 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +40 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +5 -34
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +42 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +4 -4
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +6 -0
- 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/console/docopt_runner/_subcommands.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +18 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_respond.rb +22 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +47 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +15 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +46 -0
- metadata +64 -19
- data/lib/avm/local_projects/jobs/update.rb +0 -29
- data/lib/avm/stereotypes/eac_rails_base0/apache_host.rb +0 -19
- data/lib/avm/stereotypes/eac_rails_base0/deploy.rb +0 -52
- data/lib/avm/stereotypes/eac_rails_base0/instance.rb +0 -16
- data/lib/avm/stereotypes/eac_webapp_base0/apache_host.rb +0 -97
- data/lib/avm/stereotypes/eac_webapp_base0/deploy.rb +0 -104
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/appended_directories.rb +0 -27
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb +0 -43
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb +0 -51
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/version.rb +0 -22
- data/lib/avm/stereotypes/eac_webapp_base0/instance.rb +0 -52
- data/lib/avm/stereotypes/eac_webapp_base0/runner/data.rb +0 -27
- data/lib/avm/stereotypes/eac_webapp_base0/runner/data/dump.rb +0 -71
- data/lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb +0 -68
- data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +0 -61
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/eac_webapp_base0/runner/deploy'
|
4
4
|
require 'avm/stereotypes/eac_wordpress_base0/deploy'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module Tools
|
8
8
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
9
9
|
class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
|
10
|
-
class Deploy < ::Avm::
|
10
|
+
class Deploy < ::Avm::EacWebappBase0::Runner::Deploy
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
require 'eac_cli/default_runner'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class Ruby < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
require_sub __FILE__
|
14
|
+
include ::EacCli::DefaultRunner
|
15
|
+
|
16
|
+
runner_definition do
|
17
|
+
desc 'Ruby utitilies for local projects.'
|
18
|
+
subcommands
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/default_runner'
|
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 Ruby < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class Bundler < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
require_sub __FILE__
|
14
|
+
include ::EacCli::DefaultRunner
|
15
|
+
|
16
|
+
runner_definition do
|
17
|
+
desc 'Ruby\'s bundler utitilies for local projects.'
|
18
|
+
subcommands
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/default_runner'
|
4
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
9
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Ruby < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class Bundler < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class GemfileLock < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
include ::EacCli::DefaultRunner
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
desc 'Manipulage a "Gemfile.lock" file.'
|
17
|
+
bool_opt '-c', '--continue', 'Continue Git rebase/cherry-pick.'
|
18
|
+
bool_opt '-i', '--install', 'Run "bundle install".'
|
19
|
+
bool_opt '-u', '--update', 'Run "bundle update".'
|
20
|
+
bool_opt '-r', '--recursive', 'Run until Git rebase/cherry-pick is finished.'
|
21
|
+
bool_opt '-a', '--all', 'Same as "-ciru".'
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
loop do
|
26
|
+
git_reset_checkout
|
27
|
+
bundle_update
|
28
|
+
bundle_install
|
29
|
+
git_continue
|
30
|
+
break if complete?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def complete?
|
37
|
+
!option_or_all?('--recursive') || !conflict?
|
38
|
+
end
|
39
|
+
|
40
|
+
def rebasing?
|
41
|
+
instance.git_repo.root_path.join('.git', 'rebase-merge').exist?
|
42
|
+
end
|
43
|
+
|
44
|
+
def git_reset_checkout
|
45
|
+
return unless check_capability(__method__, :git_repo, nil)
|
46
|
+
|
47
|
+
infom 'Reseting...'
|
48
|
+
instance.git_repo.command('reset', gemfile_lock).system!
|
49
|
+
infom 'Checkouting...'
|
50
|
+
instance.git_repo.command('checkout', '--', gemfile_lock).system!
|
51
|
+
end
|
52
|
+
|
53
|
+
def bundle_install
|
54
|
+
return unless check_capability(__method__, :ruby_gem, '--install')
|
55
|
+
|
56
|
+
infom '"bundle install"...'
|
57
|
+
bundle_run('install')
|
58
|
+
end
|
59
|
+
|
60
|
+
def bundle_update
|
61
|
+
return unless check_capability(__method__, :ruby_gem, '--update')
|
62
|
+
|
63
|
+
infom '"bundle update"...'
|
64
|
+
bundle_run('update')
|
65
|
+
end
|
66
|
+
|
67
|
+
def git_continue
|
68
|
+
return unless check_capability(__method__, :git_repo, '--continue')
|
69
|
+
|
70
|
+
infom "Adding \"#{gemfile_lock}\"..."
|
71
|
+
instance.git_repo.command('add', gemfile_lock).execute!
|
72
|
+
if rebase_conflict?
|
73
|
+
git_continue_run('rebase')
|
74
|
+
elsif cherry_conflict?
|
75
|
+
git_continue_run('cherry-pick')
|
76
|
+
else
|
77
|
+
raise 'Unknown how to continue'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def git_continue_run(command)
|
82
|
+
infom "\"#{command}\" --continue..."
|
83
|
+
cmd = instance.git_repo.command(command, '--continue').envvar('GIT_EDITOR', 'true')
|
84
|
+
return unless !cmd.system && !conflict?
|
85
|
+
|
86
|
+
fatal_error "\"#{cmd}\" failed and there is no conflict"
|
87
|
+
end
|
88
|
+
|
89
|
+
def gemfile_lock
|
90
|
+
'Gemfile.lock'
|
91
|
+
end
|
92
|
+
|
93
|
+
def git_uncached
|
94
|
+
::EacGit::Local.new(git_path)
|
95
|
+
end
|
96
|
+
|
97
|
+
def bundle_run(*args)
|
98
|
+
instance.ruby_gem.bundle(*args).system!
|
99
|
+
end
|
100
|
+
|
101
|
+
def git_path
|
102
|
+
'.'
|
103
|
+
end
|
104
|
+
|
105
|
+
def conflict?
|
106
|
+
rebase_conflict? || cherry_conflict?
|
107
|
+
end
|
108
|
+
|
109
|
+
def rebase_conflict?
|
110
|
+
instance.git_repo.root_path.join('.git', 'REBASE_HEAD').exist?
|
111
|
+
end
|
112
|
+
|
113
|
+
def cherry_conflict?
|
114
|
+
instance.git_repo.root_path.join('.git', 'CHERRY_PICK_HEAD').exist?
|
115
|
+
end
|
116
|
+
|
117
|
+
def option_or_all?(option)
|
118
|
+
options.fetch(option) || options.fetch('--all')
|
119
|
+
end
|
120
|
+
|
121
|
+
def instance
|
122
|
+
context(:instance)
|
123
|
+
end
|
124
|
+
|
125
|
+
def check_capability(caller, capability, option)
|
126
|
+
return false unless option.blank? || option_or_all?(option)
|
127
|
+
return true if instance.respond_to?(capability)
|
128
|
+
|
129
|
+
warn "Cannot run #{caller}: instance has no capability \"#{capability}\""
|
130
|
+
false
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
9
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Test < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
include ::EacCli::DefaultRunner
|
12
|
+
|
13
|
+
runner_definition do
|
14
|
+
desc 'Test local project.'
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
context(:instance_banner)
|
19
|
+
infov 'Test command', test_command
|
20
|
+
if test_command.present?
|
21
|
+
test_command.system!
|
22
|
+
else
|
23
|
+
fatal_error 'No test command found'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_command
|
28
|
+
context(:instance).configuration.if_present(&:any_test_command)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/local_projects/jobs/update'
|
4
3
|
require 'eac_ruby_utils/console/docopt_runner'
|
5
4
|
require 'eac_ruby_utils/core_ext'
|
6
5
|
|
@@ -17,7 +16,7 @@ module Avm
|
|
17
16
|
|
18
17
|
def run
|
19
18
|
infov 'Path', context(:instance).path
|
20
|
-
|
19
|
+
context(:instance).run_job(:update)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/version'
|
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 VersionBump < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
include ::EacCli::DefaultRunner
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Bump version of a local project.'
|
16
|
+
arg_opt '-n', '--new', 'Set new version.'
|
17
|
+
arg_opt '-s', '--segment', 'Increment de <segment>-th segment (Left-most is 0)'
|
18
|
+
bool_opt '-M', '--major', 'Same as --segment=0.'
|
19
|
+
bool_opt '-m', '--minor', 'Same as --segment=1.'
|
20
|
+
bool_opt '-p', '--patch', 'Same as --segment=2.'
|
21
|
+
bool_opt '-y', '--yes', 'Bump without confirmation.'
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
start_banner
|
26
|
+
version_changed? ? run_version_changed : run_version_unchanged
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_version_changed
|
30
|
+
infom 'Version changed'
|
31
|
+
if confirm?
|
32
|
+
context(:instance).run_job(:version_bump, target_version)
|
33
|
+
success 'Bumped'
|
34
|
+
else
|
35
|
+
fatal_error 'Bump unconfirmed'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def run_version_unchanged
|
40
|
+
success 'Version unchanged'
|
41
|
+
end
|
42
|
+
|
43
|
+
def start_banner
|
44
|
+
context(:instance_banner)
|
45
|
+
infov 'Current version', current_version.if_present('-')
|
46
|
+
infov 'Target version', target_version.if_present('-')
|
47
|
+
end
|
48
|
+
|
49
|
+
def confirm?
|
50
|
+
options.fetch('--yes') || request_input('Confirm version bump?', bool: true)
|
51
|
+
end
|
52
|
+
|
53
|
+
def current_version_uncached
|
54
|
+
context(:instance).if_respond('version')
|
55
|
+
end
|
56
|
+
|
57
|
+
def target_version_uncached
|
58
|
+
r = current_version
|
59
|
+
%w[new segment major minor patch].each do |option|
|
60
|
+
option_value = options.fetch("--#{option}")
|
61
|
+
next if option_value.blank?
|
62
|
+
|
63
|
+
r = send("target_version_from_#{option}", r, option_value)
|
64
|
+
end
|
65
|
+
r
|
66
|
+
end
|
67
|
+
|
68
|
+
def target_version_from_new(_current, option_value)
|
69
|
+
::Avm::Version.new(option_value)
|
70
|
+
end
|
71
|
+
|
72
|
+
def target_version_from_segment(current, option_value)
|
73
|
+
current.increment_segment(option_value.to_i)
|
74
|
+
end
|
75
|
+
|
76
|
+
%w[major minor patch].each_with_index do |segment, segment_index|
|
77
|
+
define_method "target_version_from_#{segment}" do |current, _option_value|
|
78
|
+
target_version_from_segment(current, segment_index)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def version_changed?
|
83
|
+
target_version != current_version
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
data/lib/avm/version.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
# A sequence of segments of integer versions (Ex.: 2, 1.0.1, 3.0.0.0.0).
|
5
|
+
class Version
|
6
|
+
include ::Comparable
|
7
|
+
|
8
|
+
SEGMENT_SEPARATOR = '.'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def segments_from_mixed(segments)
|
12
|
+
(segments.is_a?(::Enumerable) ? segments.to_a : segments.to_s.split(SEGMENT_SEPARATOR))
|
13
|
+
.map(&:to_i)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :segments
|
18
|
+
|
19
|
+
def initialize(segments)
|
20
|
+
@segments = self.class.segments_from_mixed(segments).freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
delegate :[], to: :segments
|
24
|
+
|
25
|
+
def <=>(other)
|
26
|
+
segments <=> other.segments
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
segments.join(SEGMENT_SEPARATOR)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Avm::Version]
|
34
|
+
def increment_segment(segment_index)
|
35
|
+
x = [segments.count, segment_index + 1].max.times.map do |index|
|
36
|
+
value = index < segments.count ? segments[index] : 0
|
37
|
+
next value if index < segment_index
|
38
|
+
next value + 1 if index == segment_index
|
39
|
+
|
40
|
+
0
|
41
|
+
end
|
42
|
+
self.class.new x
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -12,7 +12,7 @@ module EacLauncher
|
|
12
12
|
r = find_parent_instance(instance.parent)
|
13
13
|
return r if r
|
14
14
|
|
15
|
-
::
|
15
|
+
::Avm::Launcher::Errors::Base.new('Git parent not found')
|
16
16
|
end
|
17
17
|
|
18
18
|
def find_parent_instance(current)
|
@@ -35,7 +35,7 @@ module EacLauncher
|
|
35
35
|
|
36
36
|
def check_with_rescue
|
37
37
|
internal_check
|
38
|
-
rescue ::
|
38
|
+
rescue ::Avm::Launcher::Errors::Base => e
|
39
39
|
::EacLauncher::Publish::CheckResult.blocked("Error: #{e}")
|
40
40
|
rescue ::EacLauncher::Git::Error => e
|
41
41
|
::EacLauncher::Publish::CheckResult.blocked("Git error: #{e}")
|
File without changes
|
File without changes
|