avm-tools 0.72.0 → 0.75.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/{stereotypes/eac_rails_base0.rb → eac_rails_base0.rb} +1 -3
- data/lib/avm/eac_rails_base0/instance.rb +2 -5
- data/lib/avm/{rails/runners.rb → eac_rails_base1.rb} +2 -4
- data/lib/avm/{rails → eac_rails_base1}/instance.rb +8 -3
- data/lib/avm/eac_rails_base1/runner.rb +12 -0
- data/lib/avm/eac_rails_base1/runner/bundle.rb +28 -0
- data/lib/avm/eac_rails_base1/runner/code_runner.rb +28 -0
- data/lib/avm/eac_rails_base1/runner_with/bundle.rb +57 -0
- data/lib/avm/{stereotypes/rails.rb → eac_redmine_base0.rb} +2 -4
- data/lib/avm/eac_redmine_base0/instance.rb +2 -4
- data/lib/avm/{stereotypes/eac_ubuntu_base0.rb → eac_ubuntu_base0.rb} +1 -3
- data/lib/avm/{stereotypes/eac_webapp_base0.rb → eac_webapp_base0.rb} +1 -3
- data/lib/avm/eac_webapp_base0/deploy.rb +17 -40
- data/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
- data/lib/avm/eac_webapp_base0/deploy/git_info.rb +13 -0
- data/lib/avm/eac_webapp_base0/deploy/version.rb +4 -0
- data/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
- data/lib/avm/eac_webapp_base0/instance.rb +2 -2
- data/lib/avm/eac_webapp_base0/runner.rb +12 -0
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +2 -3
- data/lib/avm/eac_webapp_base0/runner/data.rb +1 -1
- 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/eac_webapp_base0/runner/deploy.rb +4 -16
- data/lib/avm/eac_wordpress_base0.rb +9 -0
- data/lib/avm/eac_wordpress_base0/apache_host.rb +25 -0
- data/lib/avm/eac_wordpress_base0/deploy.rb +10 -0
- data/lib/avm/eac_wordpress_base0/instance.rb +24 -0
- data/lib/avm/eac_writings_base0.rb +9 -0
- data/lib/avm/eac_writings_base0/apache_host.rb +17 -0
- data/lib/avm/eac_writings_base0/commons.rb +12 -0
- data/lib/avm/eac_writings_base0/deploy.rb +36 -0
- data/lib/avm/eac_writings_base0/file_build.rb +45 -0
- data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +19 -0
- data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +23 -0
- data/lib/avm/eac_writings_base0/file_build/tex_source.rb +33 -0
- data/lib/avm/eac_writings_base0/instance.rb +11 -0
- data/lib/avm/eac_writings_base0/project.rb +33 -0
- data/lib/avm/eac_writings_base0/project_build.rb +117 -0
- data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +47 -0
- data/lib/avm/eac_writings_base0/project_build/copy_files.rb +42 -0
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/files/appendable.rb +55 -0
- data/lib/avm/files/appendable/file_content.rb +24 -0
- data/lib/avm/files/appendable/plain_directory.rb +25 -0
- data/lib/avm/files/appendable/resource_base.rb +13 -0
- data/lib/avm/files/appendable/tar_output_command.rb +26 -0
- data/lib/avm/files/appendable/templatized_directory.rb +28 -0
- data/lib/avm/files/appender.rb +11 -0
- data/lib/avm/files/deploy.rb +72 -0
- data/lib/avm/git/commit/deploy.rb +8 -61
- data/lib/avm/instances/base/auto_values.rb +2 -1
- data/lib/avm/instances/base/auto_values/mailer.rb +34 -0
- data/lib/avm/instances/entry_keys.rb +4 -0
- data/lib/avm/instances/runner.rb +40 -0
- data/lib/avm/{stereotypes/postgresql.rb → postgresql.rb} +1 -3
- data/lib/avm/postgresql/instance.rb +63 -0
- data/lib/avm/postgresql/instance/data_unit.rb +39 -0
- data/lib/avm/postgresql/instance_with.rb +18 -0
- data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -0
- data/lib/avm/projects/stereotypes/git_subtree/warp.rb +3 -0
- data/lib/avm/tools/runner.rb +3 -3
- data/lib/avm/tools/runner/eac_rails_base0.rb +5 -18
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +1 -1
- data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +7 -12
- data/lib/avm/tools/runner/eac_rails_base0/runner.rb +3 -3
- data/lib/avm/tools/runner/eac_redmine_base0.rb +5 -23
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
- data/lib/avm/tools/runner/eac_redmine_base0/docker.rb +1 -1
- data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +3 -3
- data/lib/avm/tools/runner/eac_wordpress_base0.rb +5 -24
- data/lib/avm/tools/runner/{eac_rails_base0/data.rb → eac_writings_base0.rb} +4 -4
- data/lib/avm/tools/runner/git/deploy.rb +1 -1
- data/lib/avm/tools/runner/local_project/eac_writings_base0.rb +35 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb +48 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb +37 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base0/info.rb +36 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template +11 -0
- data/template/avm/{stereotypes/eac_ubuntu_base0 → eac_ubuntu_base0}/docker_image/Dockerfile +0 -0
- data/template/avm/{stereotypes/eac_wordpress_base0 → eac_wordpress_base0}/deploy/wp-config.php.template +0 -0
- data/template/avm/eac_writings_base0/commons/all.tex +5 -0
- data/template/avm/eac_writings_base0/commons/ebook.tex +11 -0
- data/template/avm/eac_writings_base0/commons/images.tex +11 -0
- data/template/avm/eac_writings_base0/commons/links.tex +2 -0
- data/template/avm/eac_writings_base0/commons/portuguese.tex +8 -0
- data/template/avm/eac_writings_base0/commons/source_code.tex +21 -0
- data/template/avm/eac_writings_base0/commons/source_code/java.tex +15 -0
- data/template/avm/eac_writings_base0/commons/utils.tex +6 -0
- data/template/avm/eac_writings_base0/deploy/index.html.template +9 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +12 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +43 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +12 -31
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +8 -40
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +41 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +21 -58
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +8 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +67 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +39 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +15 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +52 -13
- metadata +71 -36
- data/lib/avm/git/commit/deploy/appended.rb +0 -37
- data/lib/avm/git/commit/deploy/appended/base.rb +0 -17
- data/lib/avm/git/commit/deploy/appended/directory.rb +0 -32
- data/lib/avm/git/commit/deploy/appended/file_content.rb +0 -28
- data/lib/avm/rails/runners/bundle.rb +0 -35
- data/lib/avm/rails/runners/runner.rb +0 -48
- data/lib/avm/stereotypes/eac_redmine_base0.rb +0 -11
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +0 -27
- data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +0 -12
- data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +0 -26
- data/lib/avm/stereotypes/postgresql/instance.rb +0 -65
- data/lib/avm/stereotypes/postgresql/instance/data_unit.rb +0 -41
- data/lib/avm/stereotypes/postgresql/instance_with.rb +0 -20
- data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +0 -16
- data/lib/avm/tools/runner/eac_rails_base0/bundle.rb +0 -14
- data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +0 -15
- data/lib/avm/tools/runner/eac_redmine_base0/bundle.rb +0 -14
- data/lib/avm/tools/runner/eac_redmine_base0/data.rb +0 -27
- data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +0 -16
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +0 -15
- data/lib/avm/tools/runner/eac_redmine_base0/runner.rb +0 -14
- data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +0 -17
- data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +0 -15
- data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +0 -15
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/instances/base'
|
4
|
-
require 'avm/
|
4
|
+
require 'avm/postgresql/instance_with'
|
5
5
|
require 'avm/data/instance/files_unit'
|
6
6
|
require 'avm/data/instance/package'
|
7
7
|
require 'avm/eac_webapp_base0/deploy/file_unit'
|
@@ -9,7 +9,7 @@ require 'avm/eac_webapp_base0/deploy/file_unit'
|
|
9
9
|
module Avm
|
10
10
|
module EacWebappBase0
|
11
11
|
class Instance < ::Avm::Instances::Base
|
12
|
-
include ::Avm::
|
12
|
+
include ::Avm::Postgresql::InstanceWith
|
13
13
|
|
14
14
|
def stereotype_name
|
15
15
|
self.class.name.desconstantize.demodulize
|
@@ -5,13 +5,12 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module EacWebappBase0
|
8
|
-
|
8
|
+
class Runner < ::Avm::Instances::Runner
|
9
9
|
class ApacheHost < ::EacRubyUtils::Console::DocoptRunner
|
10
10
|
include ::EacCli::DefaultRunner
|
11
11
|
|
12
|
-
stereotype_name = name.deconstantize.demodulize
|
13
12
|
runner_definition do
|
14
|
-
desc
|
13
|
+
desc 'Configure Apache virtual host for instance.'
|
15
14
|
bool_opt '-c', '--certbot', 'Install certbot.'
|
16
15
|
end
|
17
16
|
|
@@ -7,7 +7,7 @@ require 'avm/data/package/dump'
|
|
7
7
|
|
8
8
|
module Avm
|
9
9
|
module EacWebappBase0
|
10
|
-
|
10
|
+
class Runner < ::Avm::Instances::Runner
|
11
11
|
class Data < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
class Dump < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
include ::EacRubyUtils::SimpleCache
|
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/simple_cache'
|
|
6
6
|
|
7
7
|
module Avm
|
8
8
|
module EacWebappBase0
|
9
|
-
|
9
|
+
class Runner < ::Avm::Instances::Runner
|
10
10
|
class Data < ::EacRubyUtils::Console::DocoptRunner
|
11
11
|
class Load < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
include ::EacRubyUtils::SimpleCache
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/instances/runner'
|
3
4
|
require 'avm/path_string'
|
4
5
|
require 'eac_ruby_utils/console/docopt_runner'
|
5
6
|
require 'eac_ruby_utils/console/speaker'
|
6
7
|
|
7
8
|
module Avm
|
8
9
|
module EacWebappBase0
|
9
|
-
|
10
|
+
class Runner < ::Avm::Instances::Runner
|
10
11
|
class Deploy < ::EacRubyUtils::Console::DocoptRunner
|
11
12
|
include ::EacRubyUtils::Console::Speaker
|
12
13
|
|
13
14
|
DOC = <<~DOCOPT
|
14
|
-
Deploy for
|
15
|
+
Deploy for instance.
|
15
16
|
|
16
17
|
Usage:
|
17
18
|
__PROGRAM__ [options]
|
@@ -22,22 +23,9 @@ module Avm
|
|
22
23
|
-r --reference=<git-reference> Git reference to deploy.
|
23
24
|
-a --append-dirs=<append-dirs> Append directories to deploy (List separated by ":").
|
24
25
|
DOCOPT
|
25
|
-
def initialize(settings = {})
|
26
|
-
super settings.merge(doc: DOC.gsub('%%STEREOTYPE_NAME%%', stereotype_name))
|
27
|
-
end
|
28
26
|
|
29
27
|
def deploy_class
|
30
|
-
stereotype_module.const_get('Deploy')
|
31
|
-
end
|
32
|
-
|
33
|
-
def stereotype_module
|
34
|
-
::Avm::Stereotypes.const_get(stereotype_name)
|
35
|
-
rescue ::NameError
|
36
|
-
::Avm.const_get(stereotype_name)
|
37
|
-
end
|
38
|
-
|
39
|
-
def stereotype_name
|
40
|
-
self.class.name.deconstantize.demodulize
|
28
|
+
context(:stereotype_module).const_get('Deploy')
|
41
29
|
end
|
42
30
|
|
43
31
|
def run
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_webapp_base0/apache_host'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWordpressBase0
|
7
|
+
class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
|
8
|
+
def document_root
|
9
|
+
instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
10
|
+
end
|
11
|
+
|
12
|
+
def extra_content
|
13
|
+
"AssignUserID #{system_user} #{system_group}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def system_user
|
17
|
+
instance.read_entry('system.username')
|
18
|
+
end
|
19
|
+
|
20
|
+
def system_group
|
21
|
+
instance.read_entry('system.groupname')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/entry_keys'
|
4
|
+
require 'avm/eac_webapp_base0/instance'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacWordpressBase0
|
8
|
+
class Instance < ::Avm::EacWebappBase0::Instance
|
9
|
+
FILES_UNITS = { uploads: 'wp-content/uploads', themes: 'wp-content/themes' }.freeze
|
10
|
+
|
11
|
+
def database_unit
|
12
|
+
web_url = read_entry(::Avm::Instances::EntryKeys::WEB_URL)
|
13
|
+
super.after_load do
|
14
|
+
info 'Fixing web addresses...'
|
15
|
+
run_sql(<<~SQL)
|
16
|
+
update wp_options
|
17
|
+
set option_value = '#{web_url}'
|
18
|
+
where option_name in ('siteurl', 'home')
|
19
|
+
SQL
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_webapp_base0/apache_host'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWritingsBase0
|
7
|
+
class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
|
8
|
+
def document_root
|
9
|
+
instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
10
|
+
end
|
11
|
+
|
12
|
+
def extra_content
|
13
|
+
''
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_webapp_base0/deploy'
|
4
|
+
require 'avm/eac_writings_base0/project'
|
5
|
+
require 'avm/eac_writings_base0/project_build'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacWritingsBase0
|
9
|
+
class Deploy < ::Avm::EacWebappBase0::Deploy
|
10
|
+
def build_content
|
11
|
+
::Avm::EacWritingsBase0::ProjectBuild.new(project, output_file:
|
12
|
+
build_dir.join(pdf_path))
|
13
|
+
end
|
14
|
+
|
15
|
+
def title
|
16
|
+
instance.id.humanize
|
17
|
+
end
|
18
|
+
|
19
|
+
def pdf_path
|
20
|
+
"#{instance.id.underscore}.pdf"
|
21
|
+
end
|
22
|
+
|
23
|
+
def variables_source
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def project_uncached
|
30
|
+
::Avm::EacWritingsBase0::Project.new(
|
31
|
+
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
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
|