avm-tools 0.73.0 → 0.74.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/{stereotypes/eac_rails_base0.rb → eac_rails_base0.rb} +1 -3
  3. data/lib/avm/eac_redmine_base0.rb +9 -0
  4. data/lib/avm/{stereotypes/eac_webapp_base0.rb → eac_webapp_base0.rb} +1 -3
  5. data/lib/avm/eac_writings_base0.rb +9 -0
  6. data/lib/avm/eac_writings_base0/commons.rb +12 -0
  7. data/lib/avm/eac_writings_base0/file_build.rb +45 -0
  8. data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +19 -0
  9. data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +23 -0
  10. data/lib/avm/eac_writings_base0/file_build/tex_source.rb +33 -0
  11. data/lib/avm/eac_writings_base0/project.rb +33 -0
  12. data/lib/avm/eac_writings_base0/project_build.rb +117 -0
  13. data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +47 -0
  14. data/lib/avm/eac_writings_base0/project_build/copy_files.rb +42 -0
  15. data/lib/avm/executables.rb +1 -1
  16. data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -0
  17. data/lib/avm/projects/stereotypes/git_subtree/warp.rb +3 -0
  18. data/lib/avm/tools/runner/local_project/eac_writings_base0.rb +35 -0
  19. data/lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb +48 -0
  20. data/lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb +37 -0
  21. data/lib/avm/tools/runner/local_project/eac_writings_base0/info.rb +36 -0
  22. data/lib/avm/tools/version.rb +1 -1
  23. data/template/avm/eac_writings_base0/commons/all.tex +5 -0
  24. data/template/avm/eac_writings_base0/commons/ebook.tex +11 -0
  25. data/template/avm/eac_writings_base0/commons/images.tex +11 -0
  26. data/template/avm/eac_writings_base0/commons/links.tex +2 -0
  27. data/template/avm/eac_writings_base0/commons/portuguese.tex +8 -0
  28. data/template/avm/eac_writings_base0/commons/source_code.tex +21 -0
  29. data/template/avm/eac_writings_base0/commons/source_code/java.tex +15 -0
  30. data/template/avm/eac_writings_base0/commons/utils.tex +6 -0
  31. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
  32. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +4 -0
  33. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  34. metadata +28 -5
  35. data/lib/avm/stereotypes/eac_redmine_base0.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af0f11c7a0f00c23780d97a299a822c01a7466d5f229d4c0cbe137d11dbce8c5
4
- data.tar.gz: 06d5dfc23be320ea36ccdf30af582effae03309c29377912760a23c832f7fac3
3
+ metadata.gz: a4460b770d82c88ec42b81c1fa27af44d87957e92dcb46c32721a72ce64f3dc7
4
+ data.tar.gz: 4f79e81ef512e596af26e0fd18c13582518778233042ee05a1d846f6afd405a6
5
5
  SHA512:
6
- metadata.gz: e4b9ac7532a83c97b55c32d5655c6ae86d83d8b182eabbd9bc1dff629ca297c36c4190dea0c444b3b51dfb3a436368757b47feaa13e16ca40c8421b83966a25e
7
- data.tar.gz: f97b797046e7e73c40b15b6c789982c2fcc095d2a01a0cbd37e4db3f483433319e36b3fc40da872625f4de4c0a636983c31ca1e6dfc95c965324b433be2d3c07
6
+ metadata.gz: c2520c8c2b7a9805ddd0a856b1ed8c9ec019d71abd6023bdb69bc4e5ab27ba7c3cfc4e7eb3b02c9051b9dca97e2196e51455843344d305fce1a466ba89bce7d7
7
+ data.tar.gz: 707b05197a270bd6442994390347713770505105ad1aeb32e6220f96571e184c78dd4ded315d9a993cbe45d0bd28a3e6b09dc708bd3fa39af291fb0df5f6b94f
@@ -4,8 +4,6 @@ require 'eac_ruby_utils/require_sub'
4
4
  ::EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module Avm
7
- module Stereotypes
8
- module EacRailsBase0
9
- end
7
+ module EacRailsBase0
10
8
  end
11
9
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+
5
+ module Avm
6
+ module EacRedmineBase0
7
+ ::EacRubyUtils.require_sub(__FILE__)
8
+ end
9
+ end
@@ -4,8 +4,6 @@ require 'eac_ruby_utils/require_sub'
4
4
  ::EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module Avm
7
- module Stereotypes
8
- module EacWebappBase0
9
- end
7
+ module EacWebappBase0
10
8
  end
11
9
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWritingsBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches/object/template'
4
+ require 'singleton'
5
+
6
+ module Avm
7
+ module EacWritingsBase0
8
+ class Commons
9
+ include ::Singleton
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWritingsBase0
7
+ class FileBuild
8
+ require_sub __FILE__
9
+ include ::Avm::EacWritingsBase0::FileBuild::BaseStereotype
10
+ DEFAULT_STEREOTYPES = [::Avm::EacWritingsBase0::FileBuild::ChapterIndex,
11
+ ::Avm::EacWritingsBase0::FileBuild::TexSource].freeze
12
+
13
+ class << self
14
+ def stereotypes
15
+ DEFAULT_STEREOTYPES
16
+ end
17
+ end
18
+
19
+ common_constructor :project, :subpath do
20
+ self.class.stereotypes.each do |stereotype|
21
+ singleton_class.prepend(stereotype) if stereotype.match?(subpath)
22
+ end
23
+ end
24
+
25
+ def build_to_dir(build_root_target_dir)
26
+ create_target_dir(build_root_target_dir)
27
+ copy(target_path(build_root_target_dir))
28
+ end
29
+
30
+ private
31
+
32
+ def create_target_dir(build_root_target_dir)
33
+ FileUtils.mkdir_p(File.dirname(target_path(build_root_target_dir)))
34
+ end
35
+
36
+ def source_path
37
+ File.join(project.root, subpath)
38
+ end
39
+
40
+ def target_path(build_root_target_dir)
41
+ File.join(build_root_target_dir, target_subpath)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWritingsBase0
5
+ class FileBuild
6
+ module BaseStereotype
7
+ private
8
+
9
+ def target_subpath
10
+ subpath
11
+ end
12
+
13
+ def copy(target_path)
14
+ FileUtils.copy_file(source_path, target_path)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWritingsBase0
5
+ class FileBuild
6
+ module ChapterIndex
7
+ class << self
8
+ def match?(subpath)
9
+ ::File.basename(subpath) == 'index.tex'
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def target_subpath
16
+ ::Avm::EacWritingsBase0::ProjectBuild.chapter_filename(
17
+ File.basename(File.dirname(subpath))
18
+ ) + '.tex'
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWritingsBase0
5
+ class FileBuild
6
+ module TexSource
7
+ class << self
8
+ def match?(subpath)
9
+ ::File.extname(subpath) == '.tex'
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def copy(target_path)
16
+ ::File.write(target_path, target_content)
17
+ end
18
+
19
+ def target_content
20
+ s = ::File.read(source_path)
21
+ replacements.each do |from, to|
22
+ s = s.gsub(from, to)
23
+ end
24
+ s
25
+ end
26
+
27
+ def replacements
28
+ { '%dir%' => ::File.dirname(subpath) }
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWritingsBase0
7
+ class Project
8
+ common_constructor :root do
9
+ self.root = root.to_pathname
10
+ end
11
+
12
+ def chapters
13
+ chapters_file.read.split("\n").map(&:strip).reject { |c| c == '' }
14
+ end
15
+
16
+ def chapters_file
17
+ root.join('chapters')
18
+ end
19
+
20
+ def name
21
+ root.basename.to_s
22
+ end
23
+
24
+ def default_output_dir
25
+ root.join('dist')
26
+ end
27
+
28
+ def default_output_file
29
+ root.join("#{name}.pdf")
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/executables'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/fs/temp'
6
+ require 'eac_ruby_utils/fs/clearable_directory'
7
+
8
+ module Avm
9
+ module EacWritingsBase0
10
+ class ProjectBuild
11
+ require_sub __FILE__, include_modules: true
12
+ enable_console_speaker
13
+
14
+ CONTENT_VAR = '%%%CONTENT%%%'
15
+
16
+ common_constructor :project, :options do
17
+ run
18
+ end
19
+
20
+ private
21
+
22
+ attr_reader :source_temp_dir
23
+
24
+ def run
25
+ start_banner
26
+ check_chapter
27
+ build
28
+ success('Done!')
29
+ end
30
+
31
+ def start_banner
32
+ infov('Chapter', chapter)
33
+ infov('Output file', output_file)
34
+ end
35
+
36
+ def build
37
+ on_temp_source_dir do
38
+ copy_project_files
39
+ copy_commons_files
40
+ include_content
41
+ compile
42
+ check
43
+ move_output_to_target
44
+ open_output
45
+ end
46
+ end
47
+
48
+ def check
49
+ return if ::File.size(temp_output_file).positive?
50
+
51
+ fatal_error("Zero-size file builded: #{temp_output_file}")
52
+ end
53
+
54
+ def compile
55
+ compile_command.execute!.each_line do |line|
56
+ if line.include?('No file')
57
+ raise 'Command returned without error, but there is at least one "No file" line in' \
58
+ "log: #{line}"
59
+ end
60
+ end
61
+ end
62
+
63
+ def compile_command
64
+ ::Avm::Executables.latex.command(*compile_command_args).chdir(source_temp_dir)
65
+ end
66
+
67
+ def compile_command_args
68
+ r = ["-output-director=#{build_dir}", '-output-format=pdf',
69
+ '-interaction=nonstopmode', '-halt-on-error', '-file-line-error']
70
+ r << if chapter.present?
71
+ "\\includeonly{#{chapter_filename(chapter)}}\\input{main.tex}"
72
+ else
73
+ './main.tex'
74
+ end
75
+ r
76
+ end
77
+
78
+ def move_output_to_target
79
+ File.rename(temp_output_file, output_file)
80
+ infov('Size', ::Filesize.from("#{File.size(output_file)} B").pretty)
81
+ end
82
+
83
+ def temp_output_file
84
+ File.join(build_dir, 'main.pdf')
85
+ end
86
+
87
+ def on_temp_source_dir
88
+ if options[:source_dir].present?
89
+ @source_temp_dir = ::EacRubyUtils::Fs::ClearableDirectory.new(options.source_dir).clear
90
+ yield
91
+ else
92
+ ::EacRubyUtils::Fs::Temp.on_directory do |directory|
93
+ @source_temp_dir = directory
94
+ yield
95
+ end
96
+ end
97
+ end
98
+
99
+ def build_dir
100
+ r = project.root.join('build')
101
+ r.mkpath
102
+ r
103
+ end
104
+
105
+ def output_file
106
+ (options[:output_file] || project.default_output_file)
107
+ end
108
+
109
+ def open_output
110
+ return unless options[:open]
111
+
112
+ infom("Opening \"#{output_file}\"")
113
+ ::Avm::Executables.xdg_open.command(output_file).system!
114
+ end
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWritingsBase0
5
+ class ProjectBuild
6
+ class << self
7
+ def chapter_filename(chapter_name)
8
+ "chapter_#{chapter_name}"
9
+ end
10
+ end
11
+
12
+ module ChaptersContent
13
+ private
14
+
15
+ def chapter
16
+ options[:chapter]
17
+ end
18
+
19
+ def chapter_filename(chapter_name)
20
+ ::Avm::EacWritingsBase0::ProjectBuild.chapter_filename(chapter_name)
21
+ end
22
+
23
+ def check_chapter
24
+ return unless chapter
25
+ return if project.chapters.include?(chapter)
26
+
27
+ fatal_error("Chapter not found: \"#{chapter}\" (List: #{project.chapters})")
28
+ end
29
+
30
+ def include_content
31
+ main_path = source_temp_dir.join('main.tex')
32
+ main_path.write(main_path.read.gsub(CONTENT_VAR, include_chapters_content))
33
+ end
34
+
35
+ def include_chapters_content
36
+ r = chapters_content
37
+ r = "\\maketitle\n\n#{r}" if chapter.blank?
38
+ r
39
+ end
40
+
41
+ def chapters_content
42
+ project.chapters.map { |c| "\\include{#{chapter_filename(c)}}" }.join("\n")
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_writings_base0/commons'
4
+ require 'avm/eac_writings_base0/file_build'
5
+
6
+ module Avm
7
+ module EacWritingsBase0
8
+ class ProjectBuild
9
+ module CopyFiles
10
+ def copy_project_files
11
+ copy_project_dir('.')
12
+ end
13
+
14
+ def copy_project_obj(subpath)
15
+ return if File.basename(subpath).start_with?('.')
16
+
17
+ if File.directory?(File.join(project.root, subpath))
18
+ copy_project_dir(subpath)
19
+ else
20
+ copy_project_file(subpath)
21
+ end
22
+ end
23
+
24
+ def copy_project_file(subpath)
25
+ ::Avm::EacWritingsBase0::FileBuild.new(project, subpath).build_to_dir(source_temp_dir)
26
+ end
27
+
28
+ def copy_project_dir(subpath)
29
+ Dir.entries(File.join(project.root, subpath)).each do |f|
30
+ copy_project_obj(File.join(subpath, f))
31
+ end
32
+ end
33
+
34
+ def copy_commons_files
35
+ target_dir = source_temp_dir.join('commons')
36
+ target_dir.mkpath
37
+ ::Avm::EacWritingsBase0::Commons.instance.template.apply(self, target_dir)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -14,7 +14,7 @@ module Avm
14
14
 
15
15
  private
16
16
 
17
- %w[docker file git php-cs-fixer tidy yapf].each do |program|
17
+ %w[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
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_launcher/git/publish_base'
4
+
3
5
  module Avm
4
6
  module Projects
5
7
  module Stereotypes
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_launcher/git/warp_base'
4
+ require 'eac_launcher/git/sub_warp_base'
5
+
3
6
  module Avm
4
7
  module Projects
5
8
  module Stereotypes
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_writings_base0/project'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+
7
+ module Avm
8
+ module Tools
9
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
10
+ class LocalProject < ::EacRubyUtils::Console::DocoptRunner
11
+ class EacWritingsBase0 < ::EacRubyUtils::Console::DocoptRunner
12
+ require_sub __FILE__
13
+ runner_with
14
+ enable_simple_cache
15
+
16
+ runner_definition do
17
+ desc 'EacWritingsBase0 utitilies for local projects.'
18
+ subcommands
19
+ end
20
+
21
+ def project_banner
22
+ infov 'Project', project.name
23
+ infov 'Path', project.root
24
+ end
25
+
26
+ private
27
+
28
+ def project_uncached
29
+ ::Avm::EacWritingsBase0::Project.new(context(:instance_path))
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_writings_base0/project_build'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+
7
+ module Avm
8
+ module Tools
9
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
10
+ class LocalProject < ::EacRubyUtils::Console::DocoptRunner
11
+ class EacWritingsBase0 < ::EacRubyUtils::Console::DocoptRunner
12
+ class BuildChapters
13
+ runner_with
14
+
15
+ runner_definition do
16
+ arg_opt '-o', '--output-dir', 'Output chapters to specific directory.'
17
+ end
18
+
19
+ def run
20
+ runner_context.call(:project_banner)
21
+ output_dir.mkpath
22
+ project.chapters.each_with_index do |c, i|
23
+ ::Avm::EacWritingsBase0::ProjectBuild.new(project, chapter_build_options(c, i))
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def chapter_build_options(chapter, index)
30
+ output_name = "#{(index + 1).to_s.rjust(3, '0')}_#{chapter}.pdf"
31
+ { output_file: output_dir.join(output_name), chapter: chapter }
32
+ end
33
+
34
+ def output_dir_uncached
35
+ (
36
+ parsed.output_dir || project.default_output_dir.join('chapters')
37
+ ).to_pathname
38
+ end
39
+
40
+ def project
41
+ runner_context.call(:project)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_writings_base0/project_build'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+
7
+ module Avm
8
+ module Tools
9
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
10
+ class LocalProject < ::EacRubyUtils::Console::DocoptRunner
11
+ class EacWritingsBase0 < ::EacRubyUtils::Console::DocoptRunner
12
+ class BuildSingle
13
+ runner_with
14
+ runner_definition do
15
+ arg_opt '-s', '--source-dir', 'Write .tex source code in specific directory.'
16
+ arg_opt '-f', '--output-file', 'Output to specific file.'
17
+ arg_opt '-c', '--chapter', 'Write only the chapter <chapter>.'
18
+ bool_opt '-o', '--open', 'Open the file after build.'
19
+ end
20
+
21
+ def run
22
+ runner_context.call(:project_banner)
23
+ infov 'Build options', build_options
24
+ ::Avm::EacWritingsBase0::ProjectBuild.new(runner_context.call(:project), parsed)
25
+ end
26
+
27
+ private
28
+
29
+ def build_options
30
+ parsed.slice_fetch(:output_file, :open, :chapter, :source_dir)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_writings_base0/project_build'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+
7
+ module Avm
8
+ module Tools
9
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
10
+ class LocalProject < ::EacRubyUtils::Console::DocoptRunner
11
+ class EacWritingsBase0 < ::EacRubyUtils::Console::DocoptRunner
12
+ class Info
13
+ runner_with
14
+ runner_definition do
15
+ desc 'Information about a loca EacRailsBase0 local project.'
16
+ end
17
+
18
+ def run
19
+ runner_context.call(:project_banner)
20
+ infov 'Chapters', project.chapters.count
21
+ project.chapters.each_with_index do |chapter, index|
22
+ infov " * #{index + 1}", chapter
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def project
29
+ runner_context.call(:project)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.73.0'
5
+ VERSION = '0.74.0'
6
6
  end
7
7
  end
@@ -0,0 +1,5 @@
1
+ \input{commons/links}
2
+ \input{commons/portuguese}
3
+ \input{commons/source_code}
4
+ \input{commons/utils}
5
+ \input{commons/images}
@@ -0,0 +1,11 @@
1
+ \documentclass[a4paper,twoside,final,12pt,openany]{memoir}
2
+ \input{commons/all}
3
+ \setlength{\parindent}{0em}
4
+ \setlength{\parskip}{1em}
5
+ \setlrmarginsandblock{1cm}{1cm}{*}
6
+ \setulmarginsandblock{2cm}{2cm}{*}
7
+ \checkandfixthelayout
8
+
9
+ \newcommand{\chapref}[1] {
10
+ Cap. \ref{chap:#1} - \nameref{chap:#1}
11
+ }
@@ -0,0 +1,11 @@
1
+ \usepackage{graphicx}
2
+ \usepackage[font=small,labelfont=bf]{caption}
3
+
4
+ \newcommand{\inputimage}[2] {
5
+ \begin{minipage}{\linewidth}
6
+ \begin{center}
7
+ \includegraphics{#1}
8
+ \captionof{figure}{#2}
9
+ \end{center}
10
+ \end{minipage}
11
+ }
@@ -0,0 +1,2 @@
1
+ \usepackage{hyperref}
2
+ \hypersetup{colorlinks=true}
@@ -0,0 +1,8 @@
1
+ \usepackage[utf8]{inputenc}
2
+ \usepackage[portuguese]{babel}
3
+ \usepackage{listings}
4
+ \lstset{
5
+ inputencoding=utf8,
6
+ extendedchars=true,
7
+ literate={á}{{\'a}}1 {à}{{\`a}}1 {ã}{{\~a}}1 {â}{{\^a}}1 {é}{{\'e}}1 {ê}{{\^e}}1 {ë}{{\"e}}1 {í}{{\'i}}1 {ç}{{\c{c}}}1 {Ç}{{\c{C}}}1 {õ}{{\~o}}1 {Õ}{{\~O}}1 {ó}{{\'o}}1 {ô}{{\^o}}1 {ú}{{\'u}}1
8
+ }
@@ -0,0 +1,21 @@
1
+ \usepackage[dvipsnames]{xcolor}
2
+ \usepackage{listings}
3
+ \usepackage{courier}
4
+ \usepackage[T1]{fontenc}
5
+ \usepackage{textcomp}
6
+ \definecolor{code_background}{rgb}{0.95,0.95,0.95}
7
+ \lstset{
8
+ backgroundcolor=\color{code_background},
9
+ breakatwhitespace=false,
10
+ breaklines=true,
11
+ basicstyle=\ttfamily\color{black},
12
+ commentstyle = \ttfamily\color{gray},
13
+ keywordstyle=\ttfamily\color{blue},
14
+ stringstyle=\color{orange},
15
+ showstringspaces=false,
16
+ frame=single,
17
+ basicstyle=\ttfamily\tiny,
18
+ columns=flexible,
19
+ upquote=true,
20
+ }
21
+ \input{commons/source_code/java}
@@ -0,0 +1,15 @@
1
+ \lstloadlanguages{Java}
2
+ \newcommand{\java}[1] {
3
+ \lstinline[language=Java]{#1}
4
+ }
5
+ \newcommand{\javafile}[1] {
6
+ \begin{minipage}{\linewidth}
7
+ \lstinputlisting[language=Java,caption=$#1$]{#1}
8
+ \end{minipage}
9
+ }
10
+ \lstnewenvironment{javaenv} {
11
+ \lstset{language=Java}
12
+ \minipage\linewidth
13
+ } {
14
+ \endminipage
15
+ }
@@ -0,0 +1,6 @@
1
+ \newcommand{\todo}[0] {
2
+ \textcolor{red}{\textbf{TO-DO}}
3
+ }
4
+ \newcommand{\dq}[1] {
5
+ ``#1''
6
+ }
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'pathname'
5
+
6
+ module EacRubyUtils
7
+ module Fs
8
+ class ClearableDirectory < ::Pathname
9
+ CLEARABLE_BASENAME = '.clearable_directory'
10
+
11
+ def clear
12
+ validate_clearable
13
+ directory? ? clear_directory : clear_no_directory
14
+ mkpath
15
+ ::FileUtils.touch(clearable_note_file.to_path)
16
+ self
17
+ end
18
+
19
+ def clearable?
20
+ clearable_negate_message ? true : false
21
+ end
22
+
23
+ def clearable_negate_message
24
+ return if !exist? || empty?
25
+ return "Path \"#{self}\" exists, is not empty and is not a directory" unless directory?
26
+ return if clearable_note_file.exist?
27
+
28
+ "Directory \"#{self}\" is not empty and does not have a #{CLEARABLE_BASENAME} file"
29
+ end
30
+
31
+ def clearable_note_file
32
+ join(CLEARABLE_BASENAME)
33
+ end
34
+
35
+ def validate_clearable
36
+ message = clearable_negate_message
37
+ raise message if message
38
+ end
39
+
40
+ private
41
+
42
+ def clear_directory
43
+ children.each do |child|
44
+ if child.directory?
45
+ child.rmtree
46
+ elsif child.file?
47
+ child.unlink
48
+ end
49
+ end
50
+ end
51
+
52
+ def clear_no_directory
53
+ ::FileUtils.rm_rf(to_path)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -27,6 +27,10 @@ module EacRubyUtils
27
27
  property_method?(method_name) || super
28
28
  end
29
29
 
30
+ def slice_fetch(*keys)
31
+ self.class.new(keys.map { |key| [key, fetch(key)] }.to_h)
32
+ end
33
+
30
34
  def to_h
31
35
  data.dup
32
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.48.0'
4
+ VERSION = '0.49.0'
5
5
  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.73.0
4
+ version: 0.74.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-10-20 00:00:00.000000000 Z
11
+ date: 2020-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -290,10 +290,12 @@ files:
290
290
  - lib/avm/docker/image.rb
291
291
  - lib/avm/docker/registry.rb
292
292
  - lib/avm/docker/runner.rb
293
+ - lib/avm/eac_rails_base0.rb
293
294
  - lib/avm/eac_rails_base0/apache_host.rb
294
295
  - lib/avm/eac_rails_base0/apache_path.rb
295
296
  - lib/avm/eac_rails_base0/deploy.rb
296
297
  - lib/avm/eac_rails_base0/instance.rb
298
+ - lib/avm/eac_redmine_base0.rb
297
299
  - lib/avm/eac_redmine_base0/core_update.rb
298
300
  - lib/avm/eac_redmine_base0/data_unit.rb
299
301
  - lib/avm/eac_redmine_base0/deploy.rb
@@ -301,6 +303,7 @@ files:
301
303
  - lib/avm/eac_ubuntu_base0/apache.rb
302
304
  - lib/avm/eac_ubuntu_base0/apache/resource.rb
303
305
  - lib/avm/eac_ubuntu_base0/docker_image.rb
306
+ - lib/avm/eac_webapp_base0.rb
304
307
  - lib/avm/eac_webapp_base0/apache_host.rb
305
308
  - lib/avm/eac_webapp_base0/deploy.rb
306
309
  - lib/avm/eac_webapp_base0/deploy/appended_directories.rb
@@ -313,6 +316,16 @@ files:
313
316
  - lib/avm/eac_webapp_base0/runner/data/dump.rb
314
317
  - lib/avm/eac_webapp_base0/runner/data/load.rb
315
318
  - lib/avm/eac_webapp_base0/runner/deploy.rb
319
+ - lib/avm/eac_writings_base0.rb
320
+ - lib/avm/eac_writings_base0/commons.rb
321
+ - lib/avm/eac_writings_base0/file_build.rb
322
+ - lib/avm/eac_writings_base0/file_build/base_stereotype.rb
323
+ - lib/avm/eac_writings_base0/file_build/chapter_index.rb
324
+ - lib/avm/eac_writings_base0/file_build/tex_source.rb
325
+ - lib/avm/eac_writings_base0/project.rb
326
+ - lib/avm/eac_writings_base0/project_build.rb
327
+ - lib/avm/eac_writings_base0/project_build/chapters_content.rb
328
+ - lib/avm/eac_writings_base0/project_build/copy_files.rb
316
329
  - lib/avm/executables.rb
317
330
  - lib/avm/files.rb
318
331
  - lib/avm/files/formatter.rb
@@ -444,10 +457,7 @@ files:
444
457
  - lib/avm/self/instance/entry_keys.rb
445
458
  - lib/avm/self/root.rb
446
459
  - lib/avm/stereotypes.rb
447
- - lib/avm/stereotypes/eac_rails_base0.rb
448
- - lib/avm/stereotypes/eac_redmine_base0.rb
449
460
  - lib/avm/stereotypes/eac_ubuntu_base0.rb
450
- - lib/avm/stereotypes/eac_webapp_base0.rb
451
461
  - lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb
452
462
  - lib/avm/stereotypes/eac_wordpress_base0/deploy.rb
453
463
  - lib/avm/stereotypes/eac_wordpress_base0/instance.rb
@@ -501,6 +511,10 @@ files:
501
511
  - lib/avm/tools/runner/launcher/projects.rb
502
512
  - lib/avm/tools/runner/launcher/publish.rb
503
513
  - lib/avm/tools/runner/local_project.rb
514
+ - lib/avm/tools/runner/local_project/eac_writings_base0.rb
515
+ - lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb
516
+ - lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb
517
+ - lib/avm/tools/runner/local_project/eac_writings_base0/info.rb
504
518
  - lib/avm/tools/runner/local_project/info.rb
505
519
  - lib/avm/tools/runner/local_project/ruby.rb
506
520
  - lib/avm/tools/runner/local_project/ruby/bundler.rb
@@ -556,6 +570,14 @@ files:
556
570
  - template/avm/eac_redmine_base0/deploy/config/install.sh.template
557
571
  - template/avm/eac_redmine_base0/deploy/config/secrets.yml
558
572
  - template/avm/eac_webapp_base0/apache_host/no_ssl.conf
573
+ - template/avm/eac_writings_base0/commons/all.tex
574
+ - template/avm/eac_writings_base0/commons/ebook.tex
575
+ - template/avm/eac_writings_base0/commons/images.tex
576
+ - template/avm/eac_writings_base0/commons/links.tex
577
+ - template/avm/eac_writings_base0/commons/portuguese.tex
578
+ - template/avm/eac_writings_base0/commons/source_code.tex
579
+ - template/avm/eac_writings_base0/commons/source_code/java.tex
580
+ - template/avm/eac_writings_base0/commons/utils.tex
559
581
  - template/avm/ruby/gems/generator/gemspec.template
560
582
  - template/avm/ruby/gems/generator/root_lib.template
561
583
  - template/avm/ruby/gems/generator/static/Gemfile
@@ -898,6 +920,7 @@ files:
898
920
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
899
921
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb
900
922
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/fs.rb
923
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb
901
924
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/extname.rb
902
925
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp.rb
903
926
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/directory.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
-
5
- module Avm
6
- module Stereotypes
7
- module EacRedmineBase0
8
- ::EacRubyUtils.require_sub(__FILE__)
9
- end
10
- end
11
- end