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.
Files changed (133) 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_rails_base0/instance.rb +2 -5
  4. data/lib/avm/{rails/runners.rb → eac_rails_base1.rb} +2 -4
  5. data/lib/avm/{rails → eac_rails_base1}/instance.rb +8 -3
  6. data/lib/avm/eac_rails_base1/runner.rb +12 -0
  7. data/lib/avm/eac_rails_base1/runner/bundle.rb +28 -0
  8. data/lib/avm/eac_rails_base1/runner/code_runner.rb +28 -0
  9. data/lib/avm/eac_rails_base1/runner_with/bundle.rb +57 -0
  10. data/lib/avm/{stereotypes/rails.rb → eac_redmine_base0.rb} +2 -4
  11. data/lib/avm/eac_redmine_base0/instance.rb +2 -4
  12. data/lib/avm/{stereotypes/eac_ubuntu_base0.rb → eac_ubuntu_base0.rb} +1 -3
  13. data/lib/avm/{stereotypes/eac_webapp_base0.rb → eac_webapp_base0.rb} +1 -3
  14. data/lib/avm/eac_webapp_base0/deploy.rb +17 -40
  15. data/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
  16. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +13 -0
  17. data/lib/avm/eac_webapp_base0/deploy/version.rb +4 -0
  18. data/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
  19. data/lib/avm/eac_webapp_base0/instance.rb +2 -2
  20. data/lib/avm/eac_webapp_base0/runner.rb +12 -0
  21. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +2 -3
  22. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -1
  23. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  24. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  25. data/lib/avm/eac_webapp_base0/runner/deploy.rb +4 -16
  26. data/lib/avm/eac_wordpress_base0.rb +9 -0
  27. data/lib/avm/eac_wordpress_base0/apache_host.rb +25 -0
  28. data/lib/avm/eac_wordpress_base0/deploy.rb +10 -0
  29. data/lib/avm/eac_wordpress_base0/instance.rb +24 -0
  30. data/lib/avm/eac_writings_base0.rb +9 -0
  31. data/lib/avm/eac_writings_base0/apache_host.rb +17 -0
  32. data/lib/avm/eac_writings_base0/commons.rb +12 -0
  33. data/lib/avm/eac_writings_base0/deploy.rb +36 -0
  34. data/lib/avm/eac_writings_base0/file_build.rb +45 -0
  35. data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +19 -0
  36. data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +23 -0
  37. data/lib/avm/eac_writings_base0/file_build/tex_source.rb +33 -0
  38. data/lib/avm/eac_writings_base0/instance.rb +11 -0
  39. data/lib/avm/eac_writings_base0/project.rb +33 -0
  40. data/lib/avm/eac_writings_base0/project_build.rb +117 -0
  41. data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +47 -0
  42. data/lib/avm/eac_writings_base0/project_build/copy_files.rb +42 -0
  43. data/lib/avm/executables.rb +1 -1
  44. data/lib/avm/files/appendable.rb +55 -0
  45. data/lib/avm/files/appendable/file_content.rb +24 -0
  46. data/lib/avm/files/appendable/plain_directory.rb +25 -0
  47. data/lib/avm/files/appendable/resource_base.rb +13 -0
  48. data/lib/avm/files/appendable/tar_output_command.rb +26 -0
  49. data/lib/avm/files/appendable/templatized_directory.rb +28 -0
  50. data/lib/avm/files/appender.rb +11 -0
  51. data/lib/avm/files/deploy.rb +72 -0
  52. data/lib/avm/git/commit/deploy.rb +8 -61
  53. data/lib/avm/instances/base/auto_values.rb +2 -1
  54. data/lib/avm/instances/base/auto_values/mailer.rb +34 -0
  55. data/lib/avm/instances/entry_keys.rb +4 -0
  56. data/lib/avm/instances/runner.rb +40 -0
  57. data/lib/avm/{stereotypes/postgresql.rb → postgresql.rb} +1 -3
  58. data/lib/avm/postgresql/instance.rb +63 -0
  59. data/lib/avm/postgresql/instance/data_unit.rb +39 -0
  60. data/lib/avm/postgresql/instance_with.rb +18 -0
  61. data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -0
  62. data/lib/avm/projects/stereotypes/git_subtree/warp.rb +3 -0
  63. data/lib/avm/tools/runner.rb +3 -3
  64. data/lib/avm/tools/runner/eac_rails_base0.rb +5 -18
  65. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +1 -1
  66. data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +7 -12
  67. data/lib/avm/tools/runner/eac_rails_base0/runner.rb +3 -3
  68. data/lib/avm/tools/runner/eac_redmine_base0.rb +5 -23
  69. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
  70. data/lib/avm/tools/runner/eac_redmine_base0/docker.rb +1 -1
  71. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +3 -3
  72. data/lib/avm/tools/runner/eac_wordpress_base0.rb +5 -24
  73. data/lib/avm/tools/runner/{eac_rails_base0/data.rb → eac_writings_base0.rb} +4 -4
  74. data/lib/avm/tools/runner/git/deploy.rb +1 -1
  75. data/lib/avm/tools/runner/local_project/eac_writings_base0.rb +35 -0
  76. data/lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb +48 -0
  77. data/lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb +37 -0
  78. data/lib/avm/tools/runner/local_project/eac_writings_base0/info.rb +36 -0
  79. data/lib/avm/tools/version.rb +1 -1
  80. data/template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template +11 -0
  81. data/template/avm/{stereotypes/eac_ubuntu_base0 → eac_ubuntu_base0}/docker_image/Dockerfile +0 -0
  82. data/template/avm/{stereotypes/eac_wordpress_base0 → eac_wordpress_base0}/deploy/wp-config.php.template +0 -0
  83. data/template/avm/eac_writings_base0/commons/all.tex +5 -0
  84. data/template/avm/eac_writings_base0/commons/ebook.tex +11 -0
  85. data/template/avm/eac_writings_base0/commons/images.tex +11 -0
  86. data/template/avm/eac_writings_base0/commons/links.tex +2 -0
  87. data/template/avm/eac_writings_base0/commons/portuguese.tex +8 -0
  88. data/template/avm/eac_writings_base0/commons/source_code.tex +21 -0
  89. data/template/avm/eac_writings_base0/commons/source_code/java.tex +15 -0
  90. data/template/avm/eac_writings_base0/commons/utils.tex +6 -0
  91. data/template/avm/eac_writings_base0/deploy/index.html.template +9 -0
  92. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +12 -0
  93. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +43 -0
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +12 -31
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +8 -40
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +41 -0
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
  100. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +21 -58
  101. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +8 -0
  102. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +67 -0
  103. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +39 -0
  104. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +4 -0
  105. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  106. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
  107. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +15 -0
  108. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +52 -13
  109. metadata +71 -36
  110. data/lib/avm/git/commit/deploy/appended.rb +0 -37
  111. data/lib/avm/git/commit/deploy/appended/base.rb +0 -17
  112. data/lib/avm/git/commit/deploy/appended/directory.rb +0 -32
  113. data/lib/avm/git/commit/deploy/appended/file_content.rb +0 -28
  114. data/lib/avm/rails/runners/bundle.rb +0 -35
  115. data/lib/avm/rails/runners/runner.rb +0 -48
  116. data/lib/avm/stereotypes/eac_redmine_base0.rb +0 -11
  117. data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +0 -27
  118. data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +0 -12
  119. data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +0 -26
  120. data/lib/avm/stereotypes/postgresql/instance.rb +0 -65
  121. data/lib/avm/stereotypes/postgresql/instance/data_unit.rb +0 -41
  122. data/lib/avm/stereotypes/postgresql/instance_with.rb +0 -20
  123. data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +0 -16
  124. data/lib/avm/tools/runner/eac_rails_base0/bundle.rb +0 -14
  125. data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +0 -15
  126. data/lib/avm/tools/runner/eac_redmine_base0/bundle.rb +0 -14
  127. data/lib/avm/tools/runner/eac_redmine_base0/data.rb +0 -27
  128. data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +0 -16
  129. data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +0 -15
  130. data/lib/avm/tools/runner/eac_redmine_base0/runner.rb +0 -14
  131. data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +0 -17
  132. data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +0 -15
  133. data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +0 -15
@@ -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
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Files
7
+ module Appendable
8
+ require_sub __FILE__
9
+
10
+ attr_reader :variables_source
11
+
12
+ def appended
13
+ @appended ||= []
14
+ end
15
+
16
+ def append_templatized_directories(directories)
17
+ directories.each { |directory| append_templatized_directory(directory) }
18
+ self
19
+ end
20
+
21
+ def append_plain_directory(directory)
22
+ appended << ::Avm::Files::Appendable::PlainDirectory.new(self, directory)
23
+ self
24
+ end
25
+
26
+ def append_tar_output_command(tar_command)
27
+ appended << ::Avm::Files::Appendable::TarOutputCommand.new(self, tar_command)
28
+ self
29
+ end
30
+
31
+ def append_templatized_directory(directory)
32
+ appended << ::Avm::Files::Appendable::TemplatizedDirectory.new(self, directory)
33
+ self
34
+ end
35
+
36
+ def append_file_content(target_path, content)
37
+ appended << ::Avm::Files::Appendable::FileContent
38
+ .new(self, target_path, content)
39
+ self
40
+ end
41
+
42
+ def variables_source_set(source)
43
+ @variables_source = source
44
+ self
45
+ end
46
+
47
+ def write_appended_on(target_dir)
48
+ target_dir = target_dir.to_pathname
49
+ raise "\"#{target_dir}\" is not a directory" unless target_dir.directory?
50
+
51
+ appended.each { |append| append.write_on(target_dir) }
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/files/appendable/resource_base'
5
+
6
+ module Avm
7
+ module Files
8
+ module Appendable
9
+ class FileContent < ::Avm::Files::Appendable::ResourceBase
10
+ attr_reader :target_path, :content
11
+
12
+ def initialize(deploy, target_path, content)
13
+ super(deploy)
14
+ @target_path = target_path
15
+ @content = content
16
+ end
17
+
18
+ def write_on(target_dir)
19
+ target_dir.join(target_path).write(content)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/files/appendable/resource_base'
5
+
6
+ module Avm
7
+ module Files
8
+ module Appendable
9
+ class PlainDirectory < ::Avm::Files::Appendable::ResourceBase
10
+ attr_reader :source_path
11
+
12
+ def initialize(appender, source_path)
13
+ super(appender)
14
+ @source_path = source_path.to_pathname
15
+ end
16
+
17
+ def write_on(target_dir)
18
+ raise "\"#{source_path}\" is not a directory" unless source_path.directory?
19
+
20
+ ::FileUtils.cp_r("#{source_path}/.", target_dir.to_path)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Files
7
+ module Appendable
8
+ class ResourceBase
9
+ common_constructor :appender
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/envs'
5
+ require 'avm/files/appendable/resource_base'
6
+
7
+ module Avm
8
+ module Files
9
+ module Appendable
10
+ class TarOutputCommand < ::Avm::Files::Appendable::ResourceBase
11
+ attr_reader :command
12
+
13
+ def initialize(appender, command)
14
+ super(appender)
15
+ @command = command
16
+ end
17
+
18
+ def write_on(target_dir)
19
+ command.pipe(
20
+ ::EacRubyUtils::Envs.local.command('tar', '-xf', '-', '-C', target_dir)
21
+ ).execute!
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/files/appendable/resource_base'
5
+
6
+ module Avm
7
+ module Files
8
+ module Appendable
9
+ class TemplatizedDirectory < ::Avm::Files::Appendable::ResourceBase
10
+ attr_reader :source_path
11
+
12
+ def initialize(appender, source_path)
13
+ super(appender)
14
+ @source_path = source_path
15
+ end
16
+
17
+ def write_on(target_dir)
18
+ raise 'Variables source not set' if appender.variables_source.blank?
19
+
20
+ ::EacRubyUtils::Templates::Directory.new(source_path).apply(
21
+ appender.variables_source,
22
+ target_dir
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/files/appendable'
4
+
5
+ module Avm
6
+ module Files
7
+ class Appender
8
+ include ::Avm::Files::Appendable
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+ require 'avm/files/appendable'
5
+ require 'avm/patches/object/template'
6
+ require 'eac_ruby_utils/core_ext'
7
+
8
+ module Avm
9
+ module Files
10
+ class Deploy
11
+ include ::Avm::Files::Appendable
12
+ enable_simple_cache
13
+
14
+ attr_reader :build_dir, :target_env, :target_path
15
+
16
+ common_constructor :target_env, :target_path
17
+
18
+ def run
19
+ on_build_dir do
20
+ copy_content_to_build_dir
21
+ mkdir_target
22
+ clear_content
23
+ send_untar_package
24
+ set_target_permission
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def on_build_dir
31
+ @build_dir = ::Dir.mktmpdir
32
+ yield
33
+ ensure
34
+ ::FileUtils.rm_rf(@build_dir)
35
+ end
36
+
37
+ def copy_content_to_build_dir
38
+ write_appended_on(build_dir)
39
+ end
40
+
41
+ def mkdir_target
42
+ target_env.command('mkdir', '-p', target_path).execute!
43
+ end
44
+
45
+ def clear_content
46
+ target_env.command(
47
+ 'find', target_path, '-mindepth', '1', '-maxdepth', '1', '-exec', 'rm', '-rf', '{}', ';'
48
+ ).execute!
49
+ end
50
+
51
+ def send_untar_package
52
+ tar_build_command.pipe(untar_build_command).execute!
53
+ end
54
+
55
+ def set_target_permission
56
+ target_env.command('chmod', '755', target_path).execute!
57
+ end
58
+
59
+ def tar_build_command
60
+ source_env.command('tar', '-czO', '-C', build_dir, '.')
61
+ end
62
+
63
+ def untar_build_command
64
+ target_env.command('tar', '-xzf', '-', '-C', target_path)
65
+ end
66
+
67
+ def source_env
68
+ ::EacRubyUtils::Envs.local
69
+ end
70
+ end
71
+ end
72
+ end