avm-tools 0.94.2 → 0.98.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/docker/runner.rb +22 -30
- data/lib/avm/eac_asciidoctor_base0/deploy.rb +5 -5
- data/lib/avm/eac_rails_base1/runner/bundle.rb +0 -1
- data/lib/avm/eac_rails_base1/runner/code_runner.rb +0 -1
- data/lib/avm/eac_rails_base1/runner/rails_server.rb +0 -1
- 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/issue/complete/_test.rb +2 -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 +41 -0
- data/lib/avm/patches/class.rb +4 -0
- data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
- data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +2 -2
- 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/ruby/rubocop/_configured.rb +2 -2
- data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
- data/lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb +14 -0
- data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +19 -7
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -2
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -2
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -2
- data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -2
- data/lib/avm/tools/runner/app_src/info.rb +22 -0
- data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +1 -1
- data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +1 -1
- data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +84 -0
- data/lib/avm/tools/runner/{local_project → app_src}/test.rb +6 -9
- data/lib/avm/tools/runner/app_src/update.rb +22 -0
- data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
- data/lib/avm/tools/runner/eac_asciidoctor_base0.rb +0 -1
- data/lib/avm/tools/runner/eac_rails_base0.rb +0 -1
- data/lib/avm/tools/runner/eac_redmine_base0.rb +0 -1
- data/lib/avm/tools/runner/eac_wordpress_base0.rb +0 -1
- data/lib/avm/tools/runner/eac_writings_base0.rb +0 -1
- data/lib/avm/tools/runner/git.rb +0 -1
- data/lib/avm/tools/runner/git/commit.rb +0 -1
- data/lib/avm/tools/runner/git/dirty_files.rb +17 -22
- data/lib/avm/tools/runner/git/issue.rb +21 -36
- data/lib/avm/tools/runner/git/organize.rb +6 -9
- data/lib/avm/tools/runner/git/revisions_test.rb +14 -25
- data/lib/avm/tools/runner/git/subrepo.rb +3 -6
- data/lib/avm/tools/runner/git/subrepo/check.rb +10 -13
- data/lib/avm/tools/runner/git/subrepo/clone.rb +2 -3
- data/lib/avm/tools/runner/git/subrepo/fix.rb +2 -3
- 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/sources/configuration.rb +57 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
- data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
- 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/avm-eac_asciidoctor_base0/Gemfile +5 -0
- data/vendor/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +20 -0
- data/{lib/avm/local_projects.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0.rb} +1 -1
- data/{lib/avm/eac_asciidoctor_base0/project.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb} +2 -4
- data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +19 -0
- data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +49 -0
- data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +30 -0
- data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +30 -0
- data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +54 -0
- data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +7 -0
- data/vendor/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +3 -0
- data/vendor/avm-eac_asciidoctor_base0/spec/spec_helper.rb +102 -0
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- 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/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/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/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/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/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 +4 -3
- 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/patches/kernel/nyi.rb +4 -2
- 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/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 +120 -39
- data/lib/avm/eac_asciidoctor_base0/build.rb +0 -47
- data/lib/avm/eac_asciidoctor_base0/build/file.rb +0 -28
- data/lib/avm/instances/configuration.rb +0 -55
- data/lib/avm/instances/configuration/_locale.rb +0 -16
- data/lib/avm/instances/configuration/_rubocop.rb +0 -24
- data/lib/avm/instances/configuration/_tests.rb +0 -27
- data/lib/avm/local_projects/instance.rb +0 -62
- data/lib/avm/tools/runner/local_project/eac_asciidoctor_base0.rb +0 -32
- data/lib/avm/tools/runner/local_project/info.rb +0 -25
- data/lib/avm/tools/runner/local_project/update.rb +0 -25
- 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
@@ -1,25 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
3
|
+
require 'avm/core_ext'
|
5
4
|
require 'avm/self'
|
6
5
|
|
7
6
|
module Avm
|
8
7
|
module Tools
|
9
8
|
class Runner
|
10
|
-
class Self
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Usage:
|
17
|
-
__PROGRAM__ [options] __SUBCOMMANDS__
|
18
|
-
__PROGRAM__ -h | --help
|
19
|
-
|
20
|
-
Options:
|
21
|
-
-h --help Show this screen.
|
22
|
-
DOCOPT
|
9
|
+
class Self
|
10
|
+
require_sub __FILE__
|
11
|
+
runner_with :help, :subcommands do
|
12
|
+
desc 'Utilities for self avm-tools.'
|
13
|
+
subcommands
|
14
|
+
end
|
23
15
|
|
24
16
|
def instance
|
25
17
|
::Avm::Self.instance
|
data/lib/avm/tools/version.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe ::RuboCop, slow: true do
|
6
|
-
include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
|
7
|
-
end
|
3
|
+
::EacRubyGemSupport::Rspec.default.describe_rubocop
|
@@ -97,4 +97,6 @@ RSpec.configure do |config|
|
|
97
97
|
# # test failures related to randomization by passing the same `--seed` value
|
98
98
|
# # as the one that triggered the failure.
|
99
99
|
# Kernel.srand config.seed
|
100
|
+
require 'eac_ruby_gem_support/rspec'
|
101
|
+
::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__))
|
100
102
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/configs'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Apps
|
9
|
+
module Sources
|
10
|
+
class Configuration < ::EacRubyUtils::Configs
|
11
|
+
require_sub __FILE__
|
12
|
+
|
13
|
+
FILENAMES = %w[.avm.yml .avm.yaml].freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def find_by_path(path)
|
17
|
+
path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
|
18
|
+
internal_find_path(path.expand_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_in_path(path)
|
22
|
+
absolute_pathname = path.to_pathname.expand_path
|
23
|
+
if absolute_pathname.directory?
|
24
|
+
FILENAMES.each do |filename|
|
25
|
+
file = absolute_pathname.join(filename)
|
26
|
+
return new(file) if file.exist?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def internal_find_path(absolute_pathname)
|
35
|
+
r = find_in_path(absolute_pathname)
|
36
|
+
return r if r.present?
|
37
|
+
|
38
|
+
internal_find_path(absolute_pathname.dirname) unless absolute_pathname.root?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(path)
|
43
|
+
super(nil, storage_path: path)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Utility to read a configuration as a [EacRubyUtils::Envs::Command].
|
47
|
+
# @return [EacRubyUtils::Envs::Command]
|
48
|
+
def read_command(key)
|
49
|
+
read_entry(key).if_present do |v|
|
50
|
+
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
51
|
+
::EacRubyUtils::Envs.local.command(args).chdir(::File.dirname(storage_path))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
require 'i18n'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Apps
|
8
|
+
module Sources
|
9
|
+
class Configuration < ::EacRubyUtils::Configs
|
10
|
+
LOCALE_KEY = :locale
|
11
|
+
|
12
|
+
def locale
|
13
|
+
read_entry(LOCALE_KEY) || ::I18n.default_locale
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module Apps
|
5
|
+
module Sources
|
6
|
+
class Configuration < ::EacRubyUtils::Configs
|
7
|
+
RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
|
8
|
+
RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
|
9
|
+
|
10
|
+
def rubocop_command
|
11
|
+
read_command(RUBOCOP_COMMAND_KEY)
|
12
|
+
end
|
13
|
+
|
14
|
+
def rubocop_gemfile
|
15
|
+
gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
|
16
|
+
return nil if gemfile_path.blank?
|
17
|
+
|
18
|
+
gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
|
19
|
+
return gemfile_path if gemfile_path.file?
|
20
|
+
|
21
|
+
raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Apps
|
7
|
+
module Sources
|
8
|
+
class Configuration < ::EacRubyUtils::Configs
|
9
|
+
BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
|
10
|
+
TEST_COMMAND_KEY = 'test.command'
|
11
|
+
|
12
|
+
def any_test_command
|
13
|
+
bundle_test_command || test_command
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_command
|
17
|
+
read_command(TEST_COMMAND_KEY)
|
18
|
+
end
|
19
|
+
|
20
|
+
def bundle_test_command
|
21
|
+
read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
|
22
|
+
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
23
|
+
::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,7 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe ::RuboCop, slow: true do
|
6
|
-
include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
|
7
|
-
end
|
3
|
+
::EacRubyGemSupport::Rspec.default.describe_rubocop
|
@@ -97,4 +97,7 @@ RSpec.configure do |config|
|
|
97
97
|
# # test failures related to randomization by passing the same `--seed` value
|
98
98
|
# # as the one that triggered the failure.
|
99
99
|
# Kernel.srand config.seed
|
100
|
+
|
101
|
+
require 'eac_ruby_gem_support/rspec'
|
102
|
+
::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
|
100
103
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'avm/eac_asciidoctor_base0/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'avm-eac_asciidoctor_base0'
|
9
|
+
s.version = Avm::EacAsciidoctorBase0::VERSION
|
10
|
+
s.authors = ['Put here the authors']
|
11
|
+
s.summary = 'Put here de description.'
|
12
|
+
|
13
|
+
s.files = Dir['{lib}/**/*']
|
14
|
+
|
15
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.63'
|
16
|
+
s.add_dependency 'os'
|
17
|
+
s.add_dependency 'rouge', '~> 3.26'
|
18
|
+
|
19
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacAsciidoctorBase0
|
7
|
+
module Sources
|
8
|
+
class Base
|
9
|
+
common_constructor :root do
|
10
|
+
self.root = root.to_pathname
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
root.basename.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/fs/clearable_directory'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Build
|
10
|
+
require_sub __FILE__
|
11
|
+
enable_console_speaker
|
12
|
+
enable_simple_cache
|
13
|
+
enable_listable
|
14
|
+
lists.add_symbol :option, :target_directory
|
15
|
+
common_constructor :project, :options, default: [{}] do
|
16
|
+
self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
|
17
|
+
end
|
18
|
+
|
19
|
+
SOURCE_EXTNAMES = %w[.adoc .asc].freeze
|
20
|
+
|
21
|
+
def run
|
22
|
+
infov 'Files to build', source_files.count
|
23
|
+
target_directory.clear
|
24
|
+
source_files.each(&:run)
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_target_directory
|
28
|
+
project.root.join('build')
|
29
|
+
end
|
30
|
+
|
31
|
+
def target_directory
|
32
|
+
::EacRubyUtils::Fs::ClearableDirectory.new(
|
33
|
+
options[OPTION_TARGET_DIRECTORY] || default_target_directory
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def source_files_uncached
|
38
|
+
r = []
|
39
|
+
project.root.children.each do |child|
|
40
|
+
next unless SOURCE_EXTNAMES.include?(child.extname)
|
41
|
+
|
42
|
+
r << ::Avm::EacAsciidoctorBase0::Sources::Build::File.new(self, child.basename)
|
43
|
+
end
|
44
|
+
r
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacAsciidoctorBase0
|
7
|
+
module Sources
|
8
|
+
class Build
|
9
|
+
class File
|
10
|
+
enable_console_speaker
|
11
|
+
common_constructor :build, :subpath
|
12
|
+
|
13
|
+
def run
|
14
|
+
infov 'Building', subpath
|
15
|
+
::Asciidoctor.convert_file source_path.to_path,
|
16
|
+
to_file: target_path.to_path, safe: :unsafe, mkdirs: true
|
17
|
+
end
|
18
|
+
|
19
|
+
def source_path
|
20
|
+
build.project.root.join(subpath)
|
21
|
+
end
|
22
|
+
|
23
|
+
def target_path
|
24
|
+
build.target_directory.join(subpath).basename_sub('.*') { |b| "#{b}.html" }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_asciidoctor_base0/sources/base'
|
4
|
+
require 'eac_ruby_base0/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Runner
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
runner_with :help, :subcommands do
|
13
|
+
desc 'EacAsciidoctorBase0 utitilies for local projects.'
|
14
|
+
subcommands
|
15
|
+
end
|
16
|
+
|
17
|
+
def project_banner
|
18
|
+
infov 'Project', project.name
|
19
|
+
infov 'Path', project.root
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def project_uncached
|
25
|
+
::Avm::EacAsciidoctorBase0::Sources::Base.new(runner_context.call(:instance_path))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_asciidoctor_base0/sources/build'
|
4
|
+
require 'eac_ruby_base0/core_ext'
|
5
|
+
require 'os'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacAsciidoctorBase0
|
9
|
+
module Sources
|
10
|
+
class Runner
|
11
|
+
class Build
|
12
|
+
runner_with :help do
|
13
|
+
desc 'Build the project'
|
14
|
+
arg_opt '-d', '--target-dir', 'Directory to build'
|
15
|
+
bool_opt '--open', 'Show the result.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
start_banner
|
20
|
+
build.run
|
21
|
+
open
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def build_uncached
|
27
|
+
::Avm::EacAsciidoctorBase0::Sources::Build.new(runner_context.call(:project),
|
28
|
+
target_directory: parsed.target_dir)
|
29
|
+
end
|
30
|
+
|
31
|
+
def default_target_directory
|
32
|
+
runner_context.call(:project).root.join('build')
|
33
|
+
end
|
34
|
+
|
35
|
+
def open
|
36
|
+
return unless parsed.open?
|
37
|
+
|
38
|
+
infom "Opening \"#{open_path}\"..."
|
39
|
+
::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
|
40
|
+
end
|
41
|
+
|
42
|
+
def open_path
|
43
|
+
build.source_files.first.target_path
|
44
|
+
end
|
45
|
+
|
46
|
+
def start_banner
|
47
|
+
runner_context.call(:project_banner)
|
48
|
+
infov 'Target directory', build.target_directory
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|