avm-tools 0.129.1 → 0.132.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/tools/runner/app_src.rb +4 -14
  3. data/lib/avm/tools/runner/source_generate.rb +2 -35
  4. data/lib/avm/tools/version.rb +1 -1
  5. metadata +4 -46
  6. data/lib/avm/eac_writings_base0/apache_host.rb +0 -17
  7. data/lib/avm/eac_writings_base0/commons.rb +0 -12
  8. data/lib/avm/eac_writings_base0/deploy.rb +0 -36
  9. data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
  10. data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
  11. data/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
  12. data/lib/avm/eac_writings_base0/file_build.rb +0 -45
  13. data/lib/avm/eac_writings_base0/instance.rb +0 -11
  14. data/lib/avm/eac_writings_base0/project.rb +0 -33
  15. data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
  16. data/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
  17. data/lib/avm/eac_writings_base0/project_build.rb +0 -117
  18. data/lib/avm/eac_writings_base0.rb +0 -9
  19. data/lib/avm/rails.rb +0 -9
  20. data/lib/avm/ruby/bundler.rb +0 -11
  21. data/lib/avm/ruby/gems/generator.rb +0 -165
  22. data/lib/avm/ruby/gems.rb +0 -11
  23. data/lib/avm/ruby.rb +0 -9
  24. data/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
  25. data/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
  26. data/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
  27. data/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
  28. data/lib/avm/tools/runner/eac_writings_base0.rb +0 -14
  29. data/lib/avm/tools/runner/ruby/gems/generate.rb +0 -39
  30. data/lib/avm/tools/runner/ruby/gems.rb +0 -19
  31. data/lib/avm/tools/runner/ruby/rubocop.rb +0 -30
  32. data/lib/avm/tools/runner/ruby.rb +0 -17
  33. data/template/avm/eac_writings_base0/commons/all.tex +0 -5
  34. data/template/avm/eac_writings_base0/commons/ebook.tex +0 -11
  35. data/template/avm/eac_writings_base0/commons/images.tex +0 -11
  36. data/template/avm/eac_writings_base0/commons/links.tex +0 -2
  37. data/template/avm/eac_writings_base0/commons/portuguese.tex +0 -8
  38. data/template/avm/eac_writings_base0/commons/source_code/java.tex +0 -15
  39. data/template/avm/eac_writings_base0/commons/source_code.tex +0 -21
  40. data/template/avm/eac_writings_base0/commons/utils.tex +0 -6
  41. data/template/avm/eac_writings_base0/deploy/index.html.template +0 -9
  42. data/template/avm/ruby/gems/generator/gemspec.template +0 -18
  43. data/template/avm/ruby/gems/generator/root_lib.template +0 -7
  44. data/template/avm/ruby/gems/generator/static/Gemfile +0 -5
  45. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +0 -3
  46. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +0 -4
  47. data/template/avm/ruby/gems/generator/version.template +0 -5
data/lib/avm/rails.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Rails
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Ruby
7
- module Bundler
8
- require_sub __FILE__
9
- end
10
- end
11
- end
@@ -1,165 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_ruby_base1/sources/base'
4
- require 'eac_templates/core_ext'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module Avm
8
- module Ruby
9
- module Gems
10
- class Generator
11
- IDENT = ' '
12
- JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
13
- TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
14
-
15
- enable_speaker
16
- enable_simple_cache
17
- common_constructor :root_directory, :options, default: [{}] do
18
- self.root_directory = root_directory.to_pathname
19
- run
20
- end
21
-
22
- def eac_ruby_gem_support_version
23
- dependency_version('eac_ruby_gem_support')
24
- end
25
-
26
- def eac_ruby_utils_version
27
- dependency_version('eac_ruby_utils')
28
- end
29
-
30
- def name
31
- root_directory.basename.to_s
32
- end
33
-
34
- def lib_path
35
- name.split('-').join('/')
36
- end
37
-
38
- def root_module
39
- lib_path.camelize
40
- end
41
-
42
- def root_module_close
43
- root_module_components.count.times.map do |index|
44
- (IDENT * index) + 'end'
45
- end.reverse.join("\n")
46
- end
47
-
48
- def root_module_inner_identation
49
- IDENT * root_module_components.count
50
- end
51
-
52
- def root_module_open
53
- root_module_components.each_with_index.map do |component, index|
54
- (IDENT * index) + 'module ' + component
55
- end.join("\n")
56
- end
57
-
58
- def root_module_components
59
- root_module.split('::')
60
- end
61
-
62
- protected
63
-
64
- def apply_to_root_directory(template, subpath)
65
- if template.is_a?(::EacTemplates::Directory)
66
- template.children.each do |child|
67
- apply_to_root_directory(child, subpath.join(child.basename))
68
- end
69
- elsif template.is_a?(::EacTemplates::File)
70
- template.apply_to_file(template_variables, root_directory.join(subpath))
71
- else
72
- raise "Unknown template object: #{template}"
73
- end
74
- end
75
-
76
- def dependency_version(gem_name)
77
- VersionBuilder.new(gem_name, options).to_s
78
- end
79
-
80
- def generate_gemspec
81
- template_apply('gemspec', "#{name}.gemspec")
82
- end
83
-
84
- def generate_gemfile_lock
85
- self_gem.bundle('install').chdir_root.execute!
86
- end
87
-
88
- def generate_root_directory
89
- root_directory.mkpath
90
- end
91
-
92
- def generate_root_lib
93
- template_apply('root_lib', "lib/#{lib_path}.rb")
94
- end
95
-
96
- def generate_static
97
- template.child('static').apply(self, root_directory)
98
- end
99
-
100
- def generate_version_lib
101
- template_apply('version', "lib/#{lib_path}/version.rb")
102
- end
103
-
104
- def run
105
- infov 'Root directory', root_directory
106
- infov 'Gem name', name
107
- JOBS.each do |job|
108
- infom "Generating #{job.humanize}..."
109
- send("generate_#{job}")
110
- end
111
- end
112
-
113
- def self_gem_uncached
114
- ::Avm::EacRubyBase1::Sources::Base.new(root_directory)
115
- end
116
-
117
- def template_apply(from, to)
118
- target = root_directory.join(to)
119
- target.dirname.mkpath
120
- template.child("#{from}.template").apply_to_file(self, target.to_path)
121
- end
122
-
123
- class VersionBuilder
124
- enable_simple_cache
125
- common_constructor :gem_name, :options
126
-
127
- def to_s
128
- r = "'~> #{two_segments}'"
129
- r += ", '>= #{three_segments}'" if segments.count >= 3 && segments[2].positive?
130
- r
131
- end
132
-
133
- # @return [Gem::Version]
134
- def version
135
- (options_version || default_version)
136
- end
137
-
138
- def two_segments
139
- segments.first(2).join('.')
140
- end
141
-
142
- def three_segments
143
- segments.first(3).join('.')
144
- end
145
-
146
- private
147
-
148
- def segments_uncached
149
- version.release.to_s.split('.').map(&:to_i)
150
- end
151
-
152
- def default_version
153
- ::Gem.loaded_specs[gem_name].version
154
- end
155
-
156
- def options_version
157
- options["#{gem_name}_version".to_sym].if_present do |v|
158
- ::Gem::Version.new(v)
159
- end
160
- end
161
- end
162
- end
163
- end
164
- end
165
- end
data/lib/avm/ruby/gems.rb DELETED
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Ruby
7
- module Gems
8
- require_sub __FILE__
9
- end
10
- end
11
- end
data/lib/avm/ruby.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Ruby
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_writings_base0/project_build'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class AppSrc
10
- class EacWritingsBase0
11
- class BuildChapters
12
- runner_with :help do
13
- arg_opt '-o', '--output-dir', 'Output chapters to specific directory.'
14
- end
15
-
16
- def run
17
- runner_context.call(:project_banner)
18
- output_dir.mkpath
19
- project.chapters.each_with_index do |c, i|
20
- ::Avm::EacWritingsBase0::ProjectBuild.new(project, chapter_build_options(c, i))
21
- end
22
- end
23
-
24
- private
25
-
26
- def chapter_build_options(chapter, index)
27
- output_name = "#{(index + 1).to_s.rjust(3, '0')}_#{chapter}.pdf"
28
- { output_file: output_dir.join(output_name), chapter: chapter }
29
- end
30
-
31
- def output_dir_uncached
32
- (
33
- parsed.output_dir || project.default_output_dir.join('chapters')
34
- ).to_pathname
35
- end
36
-
37
- def project
38
- runner_context.call(:project)
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_writings_base0/project_build'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class AppSrc
10
- class EacWritingsBase0
11
- class BuildSingle
12
- runner_with :help do
13
- arg_opt '-s', '--source-dir', 'Write .tex source code in specific directory.'
14
- arg_opt '-f', '--output-file', 'Output to specific file.'
15
- arg_opt '-c', '--chapter', 'Write only the chapter <chapter>.'
16
- bool_opt '-o', '--open', 'Open the file after build.'
17
- end
18
-
19
- def run
20
- runner_context.call(:project_banner)
21
- infov 'Build options', build_options
22
- ::Avm::EacWritingsBase0::ProjectBuild.new(runner_context.call(:project), parsed)
23
- end
24
-
25
- private
26
-
27
- def build_options
28
- parsed.slice_fetch(:output_file, :open, :chapter, :source_dir)
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_writings_base0/project_build'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class AppSrc
10
- class EacWritingsBase0
11
- class Info
12
- runner_with :help do
13
- desc 'Information about a loca EacRailsBase0 local project.'
14
- end
15
-
16
- def run
17
- runner_context.call(:project_banner)
18
- infov 'Chapters', project.chapters.count
19
- project.chapters.each_with_index do |chapter, index|
20
- infov " * #{index + 1}", chapter
21
- end
22
- end
23
-
24
- private
25
-
26
- def project
27
- runner_context.call(:project)
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_writings_base0/project'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class AppSrc
10
- class EacWritingsBase0
11
- require_sub __FILE__
12
- enable_simple_cache
13
-
14
- runner_with :help, :subcommands do
15
- desc 'EacWritingsBase0 utitilies for local projects.'
16
- subcommands
17
- end
18
-
19
- def project_banner
20
- infov 'Project', project.name
21
- infov 'Path', project.root
22
- end
23
-
24
- private
25
-
26
- def project_uncached
27
- ::Avm::EacWritingsBase0::Project.new(runner_context.call(:instance_path))
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_webapp_base0/runner'
4
- require 'avm/eac_writings_base0'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class EacWritingsBase0 < ::Avm::EacWebappBase0::Runner
10
- require_sub __FILE__
11
- end
12
- end
13
- end
14
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/ruby/gems/generator'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class Ruby
10
- class Gems
11
- class Generate
12
- runner_with :help do
13
- desc 'Create a gem.'
14
- arg_opt '--eac-ruby-utils-version', 'Version for "eac_ruby_utils" gem.'
15
- arg_opt '--eac-ruby-gem-support-version', 'Version for "eac_ruby_gem_support" gem.'
16
- pos_arg :path
17
- end
18
-
19
- def run
20
- success "Gem \"#{generator.name}\" created in \"#{generator.root_directory}\""
21
- end
22
-
23
- private
24
-
25
- def generator_uncached
26
- ::Avm::Ruby::Gems::Generator.new(parsed.path, generator_options)
27
- end
28
-
29
- def generator_options
30
- %w[eac_ruby_utils eac_ruby_gem_support].map do |gem_name|
31
- ["#{gem_name}_version".to_sym, parsed.fetch("#{gem_name.variableize}_version")]
32
- end.to_h
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/core_ext'
4
-
5
- module Avm
6
- module Tools
7
- class Runner
8
- class Ruby
9
- class Gems
10
- require_sub __FILE__
11
- runner_with :help, :subcommands do
12
- desc 'Rubygems utilities for AVM.'
13
- subcommands
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/tools/core_ext'
4
- require 'avm/eac_ruby_base1/rubocop'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class Ruby
10
- class Rubocop
11
- runner_with :help do
12
- desc 'Runs Rubocop (https://rubygems.org/gems/rubocop).'
13
- arg_opt '-C', 'Caminho para executar o Rubocop [default: .].'
14
- pos_arg :rubocop_args, repeat: true, optional: true
15
- end
16
-
17
- def run
18
- ::Avm::EacRubyBase1::Rubocop.new(path, parsed.rubocop_args).run
19
- end
20
-
21
- private
22
-
23
- def path
24
- ::Pathname.new(parsed.c || '.').expand_path
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/core_ext'
4
-
5
- module Avm
6
- module Tools
7
- class Runner
8
- class Ruby
9
- require_sub __FILE__
10
- runner_with :help, :subcommands do
11
- desc 'Ruby utilities for AVM.'
12
- subcommands
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,5 +0,0 @@
1
- \input{commons/links}
2
- \input{commons/portuguese}
3
- \input{commons/source_code}
4
- \input{commons/utils}
5
- \input{commons/images}
@@ -1,11 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- \usepackage{hyperref}
2
- \hypersetup{colorlinks=true}
@@ -1,8 +0,0 @@
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
- }
@@ -1,15 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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}
@@ -1,6 +0,0 @@
1
- \newcommand{\todo}[0] {
2
- \textcolor{red}{\textbf{TO-DO}}
3
- }
4
- \newcommand{\dq}[1] {
5
- ``#1''
6
- }
@@ -1,9 +0,0 @@
1
- <html>
2
- <head>
3
- <title>%%title%%</title>
4
- </head>
5
- <body>
6
- <h1>%%title%%</h1>
7
- <a href="%%pdf_path%%">PDF</a>
8
- </body>
9
- </html>
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
-
5
- require '%%LIB_PATH%%/version'
6
-
7
- Gem::Specification.new do |s|
8
- s.name = '%%NAME%%'
9
- s.version = %%ROOT_MODULE%%::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', %%EAC_RUBY_UTILS_VERSION%%
16
-
17
- s.add_development_dependency 'eac_ruby_gem_support', %%EAC_RUBY_GEM_SUPPORT_VERSION%%
18
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- %%ROOT_MODULE_OPEN%%
6
- %%ROOT_MODULE_INNER_IDENTATION%%require_sub __FILE__
7
- %%ROOT_MODULE_CLOSE%%
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- %%ROOT_MODULE_OPEN%%
4
- %%ROOT_MODULE_INNER_IDENTATION%%VERSION = '0.0.0'
5
- %%ROOT_MODULE_CLOSE%%