avm-tools 0.94.0 → 0.96.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/app_src.rb +60 -0
- data/lib/avm/core_ext.rb +4 -0
- data/lib/avm/eac_webapp_base0/instance.rb +5 -2
- data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +1 -0
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
- data/lib/avm/git/file_auto_fixup.rb +12 -2
- data/lib/avm/instances/base.rb +6 -12
- data/lib/avm/instances/base/entry_keys.rb +17 -0
- data/lib/{eac_launcher → avm/launcher}/instances/error.rb +0 -0
- data/lib/avm/launcher/instances/runner_helper.rb +42 -0
- data/lib/avm/patches/class.rb +4 -0
- data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
- data/lib/avm/patches/object.rb +4 -0
- data/lib/avm/patches/object/fs_cache.rb +16 -0
- data/lib/avm/ruby/bundler.rb +11 -0
- data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
- data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
- data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
- data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
- data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
- data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
- data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
- data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
- data/lib/avm/ruby/gems/generator.rb +1 -5
- data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
- data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +2 -3
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/info.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +3 -7
- data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +4 -8
- data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +11 -14
- data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +84 -0
- data/lib/avm/tools/runner/{local_project → app_src}/test.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/update.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
- data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
- data/lib/avm/tools/runner/launcher.rb +3 -6
- data/lib/avm/tools/runner/launcher/instances.rb +10 -21
- data/lib/avm/tools/runner/launcher/projects.rb +10 -18
- data/lib/avm/tools/runner/launcher/publish.rb +18 -26
- data/lib/avm/tools/runner/ruby/rubocop.rb +9 -25
- data/lib/avm/tools/runner/self.rb +7 -15
- data/lib/avm/tools/runner/self/docker.rb +1 -1
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher/instances.rb +1 -1
- data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
- data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
- data/vendor/avm-apps/avm-apps.gemspec +1 -1
- data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
- data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
- data/vendor/avm-apps/spec/spec_helper.rb +3 -0
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_cli/spec/spec_helper.rb +3 -0
- data/vendor/eac_docker/eac_docker.gemspec +1 -1
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_docker/spec/spec_helper.rb +3 -0
- data/vendor/eac_git/eac_git.gemspec +2 -1
- data/vendor/eac_git/lib/eac_git/local.rb +4 -0
- data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
- data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
- data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
- data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
- data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
- data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
- data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_git/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/{lib/avm/local_projects.rb → vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb} +2 -2
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -5
- data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
- data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
- data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
- metadata +77 -32
- data/lib/avm/local_projects/instance.rb +0 -62
- data/lib/eac_launcher/instances/runner_helper.rb +0 -42
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/ruby/bundler/incompatible_parser/gem_conflict'
|
5
|
+
require 'avm/ruby/bundler/incompatible_parser/line_factory'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Ruby
|
9
|
+
module Bundler
|
10
|
+
class IncompatibleParser
|
11
|
+
class LineBuffer
|
12
|
+
class << self
|
13
|
+
def from_file(path)
|
14
|
+
new(::File.read(path.to_s))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :gems_in_conflict
|
19
|
+
|
20
|
+
def initialize(content)
|
21
|
+
self.gems_in_conflict = []
|
22
|
+
self.parsing_required = false
|
23
|
+
content.each_line { |string_line| add_line(LineFactory.new(string_line)) }
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_accessor :parsing_required
|
29
|
+
attr_writer :gems_in_conflict
|
30
|
+
|
31
|
+
def add_line(line)
|
32
|
+
return if line.blank?
|
33
|
+
|
34
|
+
return if LineFactory::TYPES.any? do |type|
|
35
|
+
next false unless line.result.is_a?(type)
|
36
|
+
|
37
|
+
send("on_#{type.name.demodulize.underscore.variableize}_line", line.result)
|
38
|
+
true
|
39
|
+
end
|
40
|
+
|
41
|
+
return unless parsing_required
|
42
|
+
|
43
|
+
raise(::ArgumentError, "Unparsed line: \"#{line.content}\"")
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_gem_conflict_line(result)
|
47
|
+
self.parsing_required = true
|
48
|
+
gems_in_conflict << result
|
49
|
+
end
|
50
|
+
|
51
|
+
def on_in_gemfile_line(result)
|
52
|
+
# Do nothing
|
53
|
+
end
|
54
|
+
|
55
|
+
def on_depends_on_line(result)
|
56
|
+
current_gem_conflict.add_depends_on(result)
|
57
|
+
end
|
58
|
+
|
59
|
+
def on_version_requirement_line(result)
|
60
|
+
current_gem_conflict.add_version_requirement(result)
|
61
|
+
end
|
62
|
+
|
63
|
+
def current_gem_conflict
|
64
|
+
raise 'No gems in conflict' if gems_in_conflict.none?
|
65
|
+
raise 'Last gem is blank' if gems_in_conflict.last.blank?
|
66
|
+
|
67
|
+
gems_in_conflict.last
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/ruby/bundler/incompatible_parser/depends_on'
|
5
|
+
require 'avm/ruby/bundler/incompatible_parser/gem_conflict'
|
6
|
+
require 'avm/ruby/bundler/incompatible_parser/in_gemfile'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Ruby
|
10
|
+
module Bundler
|
11
|
+
class IncompatibleParser
|
12
|
+
class LineFactory
|
13
|
+
TYPES = [GemConflict, InGemfile, DependsOn, VersionRequirement].freeze
|
14
|
+
|
15
|
+
enable_simple_cache
|
16
|
+
common_constructor :content do
|
17
|
+
self.content = content.strip
|
18
|
+
end
|
19
|
+
|
20
|
+
delegate :blank?, to: :content
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def result_uncached
|
25
|
+
TYPES.lazy.map { |type| type.parse(content) }.find(&:present?)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Ruby
|
7
|
+
module Bundler
|
8
|
+
class IncompatibleParser
|
9
|
+
class LineParserBase
|
10
|
+
class << self
|
11
|
+
def parse(line_content)
|
12
|
+
const_get('LINE_PARSER').parse(line_content)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Ruby
|
8
|
+
module Bundler
|
9
|
+
class IncompatibleParser
|
10
|
+
class VersionRequirement < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
|
11
|
+
LINE_PARSER = /\A([a-z][a-z_0-9]*)(?: \((.+)\))?\z/
|
12
|
+
.to_parser { |m| new(m[1], m[2]) }
|
13
|
+
|
14
|
+
enable_simple_cache
|
15
|
+
attr_accessor :stack
|
16
|
+
|
17
|
+
common_constructor :gem_name, :requirements_source
|
18
|
+
|
19
|
+
def data
|
20
|
+
{ requirements_source: requirements_source, stack: stack.map(&:data) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -8,7 +8,7 @@ module Avm
|
|
8
8
|
module Gems
|
9
9
|
class Generator
|
10
10
|
IDENT = ' '
|
11
|
-
JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock
|
11
|
+
JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
|
12
12
|
TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
|
13
13
|
|
14
14
|
enable_console_speaker
|
@@ -92,10 +92,6 @@ module Avm
|
|
92
92
|
template_apply('root_lib', "lib/#{lib_path}.rb")
|
93
93
|
end
|
94
94
|
|
95
|
-
def generate_rspec
|
96
|
-
self_gem.bundle('exec', 'rspec').chdir_root.execute!
|
97
|
-
end
|
98
|
-
|
99
95
|
def generate_static
|
100
96
|
template.child('static').apply(self, root_directory)
|
101
97
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/app_src'
|
4
4
|
require 'eac_cli/core_ext'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module Tools
|
8
8
|
class Runner
|
9
|
-
class
|
9
|
+
class AppSrc
|
10
10
|
require_sub __FILE__
|
11
11
|
runner_with :help, :subcommands do
|
12
12
|
desc 'Utilities for local projects.'
|
@@ -22,7 +22,7 @@ module Avm
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def instance_uncached
|
25
|
-
::Avm::
|
25
|
+
::Avm::AppSrc.new(instance_path)
|
26
26
|
end
|
27
27
|
|
28
28
|
def instance_path_uncached
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/core_ext'
|
3
4
|
require 'avm/eac_asciidoctor_base0/build'
|
4
5
|
require 'avm/eac_asciidoctor_base0/project'
|
5
|
-
require 'eac_cli/core_ext'
|
6
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
7
6
|
|
8
7
|
module Avm
|
9
8
|
module Tools
|
10
9
|
class Runner
|
11
|
-
class
|
10
|
+
class AppSrc
|
12
11
|
class EacAsciidoctorBase0
|
13
12
|
class Build
|
14
13
|
runner_with :help do
|
@@ -1,19 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/patches/eac_ruby_gems_utils/gem'
|
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
|
-
class
|
9
|
+
class AppSrc
|
12
10
|
class Ruby
|
13
11
|
require_sub __FILE__
|
14
|
-
|
15
|
-
|
16
|
-
runner_definition do
|
12
|
+
runner_with :help, :subcommands do
|
17
13
|
desc 'Ruby utitilies for local projects.'
|
18
14
|
subcommands
|
19
15
|
end
|
@@ -1,19 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
3
|
+
require 'eac_ruby_base0/core_ext'
|
6
4
|
|
7
5
|
module Avm
|
8
6
|
module Tools
|
9
7
|
class Runner
|
10
|
-
class
|
8
|
+
class AppSrc
|
11
9
|
class Ruby
|
12
|
-
class Bundler
|
10
|
+
class Bundler
|
13
11
|
require_sub __FILE__
|
14
|
-
|
15
|
-
|
16
|
-
runner_definition do
|
12
|
+
runner_with :help, :subcommands do
|
17
13
|
desc 'Ruby\'s bundler utitilies for local projects.'
|
18
14
|
subcommands
|
19
15
|
end
|
@@ -1,18 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
3
|
+
require 'eac_ruby_base0/core_ext'
|
5
4
|
|
6
5
|
module Avm
|
7
6
|
module Tools
|
8
7
|
class Runner
|
9
|
-
class
|
8
|
+
class AppSrc
|
10
9
|
class Ruby
|
11
|
-
class Bundler
|
12
|
-
class GemfileLock
|
13
|
-
|
14
|
-
|
15
|
-
runner_definition do
|
10
|
+
class Bundler
|
11
|
+
class GemfileLock
|
12
|
+
runner_with :help do
|
16
13
|
desc 'Manipulage a "Gemfile.lock" file.'
|
17
14
|
bool_opt '-c', '--continue', 'Continue Git rebase/cherry-pick.'
|
18
15
|
bool_opt '-i', '--install', 'Run "bundle install".'
|
@@ -34,7 +31,7 @@ module Avm
|
|
34
31
|
private
|
35
32
|
|
36
33
|
def complete?
|
37
|
-
!option_or_all?(
|
34
|
+
!option_or_all?(:recursive) || !conflict?
|
38
35
|
end
|
39
36
|
|
40
37
|
def rebasing?
|
@@ -51,21 +48,21 @@ module Avm
|
|
51
48
|
end
|
52
49
|
|
53
50
|
def bundle_install
|
54
|
-
return unless check_capability(__method__, :ruby_gem,
|
51
|
+
return unless check_capability(__method__, :ruby_gem, :install)
|
55
52
|
|
56
53
|
infom '"bundle install"...'
|
57
54
|
bundle_run('install')
|
58
55
|
end
|
59
56
|
|
60
57
|
def bundle_update
|
61
|
-
return unless check_capability(__method__, :ruby_gem,
|
58
|
+
return unless check_capability(__method__, :ruby_gem, :update)
|
62
59
|
|
63
60
|
infom '"bundle update"...'
|
64
61
|
bundle_run('update')
|
65
62
|
end
|
66
63
|
|
67
64
|
def git_continue
|
68
|
-
return unless check_capability(__method__, :git_repo,
|
65
|
+
return unless check_capability(__method__, :git_repo, :continue)
|
69
66
|
|
70
67
|
infom "Adding \"#{gemfile_lock}\"..."
|
71
68
|
instance.git_repo.command('add', gemfile_lock).execute!
|
@@ -115,11 +112,11 @@ module Avm
|
|
115
112
|
end
|
116
113
|
|
117
114
|
def option_or_all?(option)
|
118
|
-
|
115
|
+
parsed[option] || parsed.all?
|
119
116
|
end
|
120
117
|
|
121
118
|
def instance
|
122
|
-
|
119
|
+
runner_context.call(:instance)
|
123
120
|
end
|
124
121
|
|
125
122
|
def check_capability(caller, capability, option)
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/fs_cache'
|
4
|
+
require 'avm/ruby/bundler/incompatible_parser'
|
5
|
+
require 'eac_ruby_base0/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner
|
10
|
+
class AppSrc
|
11
|
+
class Ruby
|
12
|
+
class Bundler
|
13
|
+
class Incompatible
|
14
|
+
runner_with :help do
|
15
|
+
desc 'Identify incompatible gems in a "Gemfile.lock" file.'
|
16
|
+
bool_opt '-l', '--last', 'Process the last \"bundle update\" result.'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
infov 'Cache path', fs_cache.content_path
|
21
|
+
infov 'Cached?', fs_cache.cached?
|
22
|
+
parser.gems_in_conflict.each do |gem_in_conflict|
|
23
|
+
print_gem_in_conflict(gem_in_conflict)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def bundle_update
|
30
|
+
infom 'Running "bundle update"...'
|
31
|
+
instance.ruby_gem.bundle('update').execute[:stdout]
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_path
|
35
|
+
fs_cache.write(bundle_update) unless fs_cache.cached? && parsed.last?
|
36
|
+
fs_cache.content_path
|
37
|
+
end
|
38
|
+
|
39
|
+
def fs_cache_uncached
|
40
|
+
::Avm.fs_cache.child(self.class.name.variableize)
|
41
|
+
.child(instance.path.to_s.variableize)
|
42
|
+
end
|
43
|
+
|
44
|
+
def gem_title(gem_in_conflict)
|
45
|
+
gem_in_conflict.gem_name
|
46
|
+
end
|
47
|
+
|
48
|
+
def instance
|
49
|
+
runner_context.call(:instance)
|
50
|
+
end
|
51
|
+
|
52
|
+
def parser_uncached
|
53
|
+
::Avm::Ruby::Bundler::IncompatibleParser.new(content_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
def print_gem_in_conflict(gem_in_conflict)
|
57
|
+
infov 'Gem', gem_title(gem_in_conflict)
|
58
|
+
gem_in_conflict.versions_requirements.each do |requirement|
|
59
|
+
print_requirement(requirement)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def print_requirement(req)
|
64
|
+
infov ' ' + requirement_title(req), requirement_value(req)
|
65
|
+
end
|
66
|
+
|
67
|
+
def requirement_stack(req)
|
68
|
+
req.stack.map { |d| "#{d.gem_name} (#{d.version})" }.join(' > '.green)
|
69
|
+
end
|
70
|
+
|
71
|
+
def requirement_title(req)
|
72
|
+
req.requirements_source.if_present('*')
|
73
|
+
end
|
74
|
+
|
75
|
+
def requirement_value(req)
|
76
|
+
requirement_stack(req)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|