avm-tools 0.82.1 → 0.83.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_writings_base1.rb +9 -0
- data/lib/avm/eac_writings_base1/build.rb +45 -0
- data/lib/avm/eac_writings_base1/build/file.rb +28 -0
- data/lib/avm/eac_writings_base1/project.rb +13 -0
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/tools/runner/local_project/eac_writings_base1.rb +32 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base1/build.rb +48 -0
- data/lib/avm/tools/version.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +3 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +5 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d469de0c152bb7c3b2f23bf083a10d66bed14ee4963cd6a6502ac8ef545145c9
|
4
|
+
data.tar.gz: 04a3077630a42a18df2a82ab7cf2874aa7f16b133d3ab99d899dc34e3231a571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a82ad8c06b90942d34e09e4c388a7b5335561026b5f4b63c62c1a623daca8c99ae10410caa70207e63cb3487b11c1aa84adab5a1a206e8c00cd5448a1c5ea4f3
|
7
|
+
data.tar.gz: 932ce1dad2c115a3a04998b4bed1697e179f257beba3f35af343f02f51274cbe8d25ace9f2ca9667289da18561dbcff9ab40dbe87fd04ebaaaac740efd601336
|
@@ -0,0 +1,45 @@
|
|
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 EacWritingsBase1
|
8
|
+
class Build
|
9
|
+
require_sub __FILE__
|
10
|
+
enable_console_speaker
|
11
|
+
enable_simple_cache
|
12
|
+
enable_listable
|
13
|
+
lists.add_symbol :option, :target_directory
|
14
|
+
common_constructor :project, :options, default: [{}] do
|
15
|
+
self.options = options.symbolize_keys
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
infov 'Files to build', source_files.count
|
20
|
+
target_directory.clear
|
21
|
+
source_files.each(&:run)
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_target_directory
|
25
|
+
project.root.join('build')
|
26
|
+
end
|
27
|
+
|
28
|
+
def target_directory
|
29
|
+
::EacRubyUtils::Fs::ClearableDirectory.new(
|
30
|
+
options[OPTION_TARGET_DIRECTORY].if_present(default_target_directory)
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def source_files_uncached
|
35
|
+
r = []
|
36
|
+
project.root.children.each do |child|
|
37
|
+
next unless child.extname == '.asc'
|
38
|
+
|
39
|
+
r << ::Avm::EacWritingsBase1::Build::File.new(self, child.basename)
|
40
|
+
end
|
41
|
+
r
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/executables'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWritingsBase1
|
7
|
+
class Build
|
8
|
+
class File
|
9
|
+
enable_console_speaker
|
10
|
+
common_constructor :build, :subpath
|
11
|
+
|
12
|
+
def run
|
13
|
+
infov 'Building', subpath
|
14
|
+
target_path.parent.mkpath
|
15
|
+
::Avm::Executables.asciidoc.command('--out-file', target_path, source_path).system!
|
16
|
+
end
|
17
|
+
|
18
|
+
def source_path
|
19
|
+
build.project.root.join(subpath)
|
20
|
+
end
|
21
|
+
|
22
|
+
def target_path
|
23
|
+
build.target_directory.join(subpath).basename_sub('.*') { |b| "#{b}.html" }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/avm/executables.rb
CHANGED
@@ -14,7 +14,7 @@ module Avm
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
%w[docker file git latex php-cs-fixer tidy yapf xdg-open].each do |program|
|
17
|
+
%w[asciidoc docker file git latex php-cs-fixer tidy yapf xdg-open].each do |program|
|
18
18
|
define_method(program.underscore + '_uncached') do
|
19
19
|
env.executable(program, '--version')
|
20
20
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
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 EacWritingsBase1
|
11
|
+
require_sub __FILE__
|
12
|
+
|
13
|
+
runner_with :help, :subcommands do
|
14
|
+
desc 'EacWritingsBase0 utitilies for local projects.'
|
15
|
+
subcommands
|
16
|
+
end
|
17
|
+
|
18
|
+
def project_banner
|
19
|
+
infov 'Project', project.name
|
20
|
+
infov 'Path', project.root
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def project_uncached
|
26
|
+
::Avm::EacWritingsBase0::Project.new(runner_context.call(:instance_path))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_writings_base1/build'
|
4
|
+
require 'avm/eac_writings_base1/project'
|
5
|
+
require 'eac_cli/core_ext'
|
6
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class EacWritingsBase1
|
13
|
+
class Build
|
14
|
+
runner_with :help do
|
15
|
+
desc 'Build the project'
|
16
|
+
arg_opt '-d', '--target-dir', 'Directory to build'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
start_banner
|
21
|
+
build.run
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def build_uncached
|
27
|
+
::Avm::EacWritingsBase1::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 start_banner
|
36
|
+
runner_context.call(:project_banner)
|
37
|
+
infov 'Target directory', build.target_directory
|
38
|
+
end
|
39
|
+
#
|
40
|
+
# def target_directory_uncached
|
41
|
+
# .if_present(default_target_directory).to_pathname
|
42
|
+
# end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
@@ -27,7 +27,9 @@ module EacCli
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def help_text
|
30
|
-
::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s
|
30
|
+
r = ::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s
|
31
|
+
r += help_extra_text if respond_to?(:help_extra_text)
|
32
|
+
r
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -31,6 +31,11 @@ module EacCli
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def help_extra_text
|
35
|
+
(['Subcommands:'] + available_subcommands.keys.map { |s| " #{s}" })
|
36
|
+
.map { |v| "#{v}\n" }.join
|
37
|
+
end
|
38
|
+
|
34
39
|
def method_missing(method_name, *arguments, &block)
|
35
40
|
return run_with_subcommand(*arguments, &block) if
|
36
41
|
run_with_subcommand_alias_run?(method_name)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/runner'
|
4
|
+
require 'eac_cli/runner_with/help'
|
4
5
|
require 'eac_cli/runner_with/subcommands'
|
5
6
|
|
6
7
|
RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
@@ -53,4 +54,32 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
53
54
|
expect { instance.run }.to raise_error(::EacCli::Parser::Error)
|
54
55
|
end
|
55
56
|
end
|
57
|
+
|
58
|
+
context 'with help' do
|
59
|
+
let(:instance) { parent_runner.create(%w[--help]) }
|
60
|
+
let(:expected_output) do
|
61
|
+
<<~OUTPUT
|
62
|
+
A stub root runner.
|
63
|
+
|
64
|
+
Usage:
|
65
|
+
__PROGRAM__ [options] __SUBCOMMANDS__ [<subcommand_args>...]
|
66
|
+
__PROGRAM__ --help
|
67
|
+
|
68
|
+
Options:
|
69
|
+
-r --root-var=<value> A root variable.
|
70
|
+
-h --help Show help.
|
71
|
+
|
72
|
+
Subcommands:
|
73
|
+
child-cmd
|
74
|
+
OUTPUT
|
75
|
+
end
|
76
|
+
|
77
|
+
before do
|
78
|
+
parent_runner.include(::EacCli::RunnerWith::Help)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'show help text' do
|
82
|
+
expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
|
83
|
+
end
|
84
|
+
end
|
56
85
|
end
|
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.83.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: 2020-12-
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -346,6 +346,10 @@ files:
|
|
346
346
|
- lib/avm/eac_writings_base0/project_build.rb
|
347
347
|
- lib/avm/eac_writings_base0/project_build/chapters_content.rb
|
348
348
|
- lib/avm/eac_writings_base0/project_build/copy_files.rb
|
349
|
+
- lib/avm/eac_writings_base1.rb
|
350
|
+
- lib/avm/eac_writings_base1/build.rb
|
351
|
+
- lib/avm/eac_writings_base1/build/file.rb
|
352
|
+
- lib/avm/eac_writings_base1/project.rb
|
349
353
|
- lib/avm/executables.rb
|
350
354
|
- lib/avm/files.rb
|
351
355
|
- lib/avm/files/appendable.rb
|
@@ -522,6 +526,8 @@ files:
|
|
522
526
|
- lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb
|
523
527
|
- lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb
|
524
528
|
- lib/avm/tools/runner/local_project/eac_writings_base0/info.rb
|
529
|
+
- lib/avm/tools/runner/local_project/eac_writings_base1.rb
|
530
|
+
- lib/avm/tools/runner/local_project/eac_writings_base1/build.rb
|
525
531
|
- lib/avm/tools/runner/local_project/info.rb
|
526
532
|
- lib/avm/tools/runner/local_project/ruby.rb
|
527
533
|
- lib/avm/tools/runner/local_project/ruby/bundler.rb
|