eac_tools 0.29.0 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +31 -25
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/runners/base/lib_rename.rb +77 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/namespace_replacer.rb +55 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/update_dependencies_requirements.rb +21 -7
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-files/Gemfile +8 -0
- data/sub/avm-files/avm-files.gemspec +22 -0
- data/sub/avm-files/lib/avm/files/appendable/file_content.rb +24 -0
- data/sub/avm-files/lib/avm/files/appendable/plain_directory.rb +25 -0
- data/sub/avm-files/lib/avm/files/appendable/resource_base.rb +13 -0
- data/sub/avm-files/lib/avm/files/appendable/tar_output_command.rb +26 -0
- data/sub/avm-files/lib/avm/files/appendable/templatized_directory.rb +29 -0
- data/sub/avm-files/lib/avm/files/appendable.rb +55 -0
- data/sub/avm-files/lib/avm/files/appender.rb +11 -0
- data/sub/avm-files/lib/avm/files/deploy.rb +71 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/base.rb +62 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/generic_plain.rb +34 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/html.rb +45 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/javascript.rb +24 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/json.rb +27 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/php.rb +22 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/python.rb +22 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/ruby.rb +22 -0
- data/sub/avm-files/lib/avm/files/formatter/formats/xml.rb +28 -0
- data/sub/avm-files/lib/avm/files/formatter/formats.rb +13 -0
- data/sub/avm-files/lib/avm/files/formatter/utf8_assert.rb +74 -0
- data/sub/avm-files/lib/avm/files/formatter.rb +90 -0
- data/sub/avm-files/lib/avm/files/runner_with/file_replacer.rb +34 -0
- data/sub/avm-files/lib/avm/files/runner_with/filesystem_traverser.rb +54 -0
- data/sub/avm-files/lib/avm/files/runner_with.rb +11 -0
- data/sub/avm-files/lib/avm/files/text_replacer/gsub.rb +24 -0
- data/sub/avm-files/lib/avm/files/text_replacer.rb +32 -0
- data/sub/avm-files/lib/avm/files/version.rb +7 -0
- data/sub/avm-files/lib/avm/files.rb +9 -0
- data/sub/avm-files/spec/rubocop_spec.rb +3 -0
- data/sub/avm-files/spec/spec_helper.rb +4 -0
- data/sub/avm-tools/avm-tools.gemspec +5 -5
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_cli/eac_cli.gemspec +3 -3
- data/sub/eac_cli/lib/eac_cli/core_ext.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +7 -3
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- metadata +42 -12
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +0 -5
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +0 -5
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1385a1932c7e4a6b89b66db8ea6084663a9c690571b00ca73465b47421ddd2
|
4
|
+
data.tar.gz: 7dd2dab5f79240a7b8087532ee959accaf130ac12f4c6d9745b86a0ab85efd5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b28b72f7c1eafb7ca609ab9b0450cc07254316756668ae980af135710fa01dcd364d18bc403c2912b50dd1c3e6c5832f220c59aa8aaac7b2366436801aebb4a
|
7
|
+
data.tar.gz: e6fcad611277f1d36707f180da96fed11a25a98139e5cc889bb5aa3e5728d42d3a9fa4667d70f1055fdff114291dbc364b099d4fb72615696d6d6be1e19a05fc
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.
|
4
|
+
eac_tools (0.30.0)
|
5
5
|
avm (~> 0.43)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.7)
|
7
7
|
avm-eac_generic_base0 (~> 0.5)
|
@@ -10,10 +10,10 @@ PATH
|
|
10
10
|
avm-eac_rails_base1 (~> 0.6)
|
11
11
|
avm-eac_redmine_base0 (~> 0.14)
|
12
12
|
avm-eac_redmine_plugin_base0 (~> 0.3)
|
13
|
-
avm-eac_ruby_base1 (~> 0.
|
13
|
+
avm-eac_ruby_base1 (~> 0.21)
|
14
14
|
avm-eac_webapp_base0 (~> 0.8)
|
15
15
|
avm-eac_wordpress_base0 (~> 0.2)
|
16
|
-
avm-tools (~> 0.136)
|
16
|
+
avm-tools (~> 0.136, >= 0.136.1)
|
17
17
|
eac_ruby_utils (~> 0.103)
|
18
18
|
|
19
19
|
PATH
|
@@ -80,10 +80,10 @@ PATH
|
|
80
80
|
PATH
|
81
81
|
remote: sub/avm-eac_ruby_base1
|
82
82
|
specs:
|
83
|
-
avm-eac_ruby_base1 (0.
|
83
|
+
avm-eac_ruby_base1 (0.21.0)
|
84
84
|
avm (~> 0.41, >= 0.41.1)
|
85
85
|
avm-eac_generic_base0 (~> 0.5)
|
86
|
-
eac_ruby_utils (~> 0.
|
86
|
+
eac_ruby_utils (~> 0.103)
|
87
87
|
|
88
88
|
PATH
|
89
89
|
remote: sub/avm-eac_webapp_base0
|
@@ -103,21 +103,31 @@ PATH
|
|
103
103
|
avm-eac_webapp_base0 (~> 0.6)
|
104
104
|
eac_ruby_utils (~> 0.102)
|
105
105
|
|
106
|
+
PATH
|
107
|
+
remote: sub/avm-files
|
108
|
+
specs:
|
109
|
+
avm-files (0.4.0)
|
110
|
+
avm (~> 0.43)
|
111
|
+
eac_cli (~> 0.28)
|
112
|
+
eac_fs (~> 0.12, >= 0.12.3)
|
113
|
+
eac_ruby_utils (~> 0.103)
|
114
|
+
eac_templates (~> 0.3, >= 0.3.2)
|
115
|
+
|
106
116
|
PATH
|
107
117
|
remote: sub/avm-tools
|
108
118
|
specs:
|
109
|
-
avm-tools (0.136.
|
110
|
-
aranha-parsers (~> 0.14, >= 0.14.
|
119
|
+
avm-tools (0.136.1)
|
120
|
+
aranha-parsers (~> 0.14, >= 0.14.3)
|
111
121
|
avm (~> 0.42)
|
112
|
-
avm-eac_ruby_base1 (~> 0.
|
122
|
+
avm-eac_ruby_base1 (~> 0.21)
|
113
123
|
avm-eac_ubuntu_base0 (~> 0.3)
|
114
|
-
avm-files (~> 0.
|
124
|
+
avm-files (~> 0.4)
|
115
125
|
avm-git (~> 0.4)
|
116
126
|
clipboard (~> 1.3, >= 1.3.6)
|
117
127
|
curb (~> 0.9, >= 0.9.11)
|
118
128
|
eac_git (~> 0.12, >= 0.12.2)
|
119
|
-
eac_ruby_base0 (~> 0.
|
120
|
-
eac_templates (~> 0.3, >= 0.3.
|
129
|
+
eac_ruby_base0 (~> 0.17)
|
130
|
+
eac_templates (~> 0.3, >= 0.3.2)
|
121
131
|
git (~> 1.12)
|
122
132
|
ruby-progressbar (~> 1.11)
|
123
133
|
|
@@ -138,10 +148,10 @@ PATH
|
|
138
148
|
PATH
|
139
149
|
remote: sub/eac_cli
|
140
150
|
specs:
|
141
|
-
eac_cli (0.
|
142
|
-
colorize (~> 0.8.1)
|
143
|
-
eac_config (~> 0.
|
144
|
-
eac_ruby_utils (~> 0.
|
151
|
+
eac_cli (0.28.0)
|
152
|
+
colorize (~> 0.8, >= 0.8.1)
|
153
|
+
eac_config (~> 0.11, >= 0.11.1)
|
154
|
+
eac_ruby_utils (~> 0.103)
|
145
155
|
|
146
156
|
PATH
|
147
157
|
remote: sub/eac_config
|
@@ -168,11 +178,11 @@ PATH
|
|
168
178
|
PATH
|
169
179
|
remote: sub/eac_ruby_base0
|
170
180
|
specs:
|
171
|
-
eac_ruby_base0 (0.
|
172
|
-
avm-eac_ruby_base1 (~> 0.
|
173
|
-
eac_cli (~> 0.
|
174
|
-
eac_fs (~> 0.
|
175
|
-
eac_ruby_utils (~> 0.
|
181
|
+
eac_ruby_base0 (0.17.0)
|
182
|
+
avm-eac_ruby_base1 (~> 0.21)
|
183
|
+
eac_cli (~> 0.28)
|
184
|
+
eac_fs (~> 0.12, >= 0.12.3)
|
185
|
+
eac_ruby_utils (~> 0.103)
|
176
186
|
|
177
187
|
PATH
|
178
188
|
remote: sub/eac_ruby_utils
|
@@ -213,11 +223,6 @@ GEM
|
|
213
223
|
avm (~> 0.7)
|
214
224
|
eac_ruby_utils (~> 0.77, >= 0.77.1)
|
215
225
|
eac_templates (~> 0.3)
|
216
|
-
avm-files (0.3.2)
|
217
|
-
avm (~> 0.6)
|
218
|
-
eac_fs (~> 0.5)
|
219
|
-
eac_ruby_utils (~> 0.76)
|
220
|
-
eac_templates (~> 0.2)
|
221
226
|
avm-git (0.4.0)
|
222
227
|
avm-files (~> 0.1)
|
223
228
|
eac_git (~> 0.11)
|
@@ -351,6 +356,7 @@ DEPENDENCIES
|
|
351
356
|
avm-eac_ruby_base1!
|
352
357
|
avm-eac_webapp_base0!
|
353
358
|
avm-eac_wordpress_base0!
|
359
|
+
avm-files!
|
354
360
|
avm-tools!
|
355
361
|
eac_cli!
|
356
362
|
eac_config!
|
data/lib/eac_tools/version.rb
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency 'avm', '~> 0.41', '>= 0.41.1'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.103'
|
18
18
|
|
19
19
|
s.add_development_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.1'
|
20
20
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'avm/eac_ruby_base1/sources/namespace_replacer'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRubyBase1
|
8
|
+
module Runners
|
9
|
+
class Base
|
10
|
+
class LibRename
|
11
|
+
runner_with :help, :file_replacer do
|
12
|
+
desc 'Rename Ruby modules classes Ruby.'
|
13
|
+
arg_opt '-f', '--from', 'Rename "from".'
|
14
|
+
arg_opt '-t', '--to', 'Rename "to".'
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
start_banner
|
19
|
+
validate
|
20
|
+
replacements_banner
|
21
|
+
run_filesystem_traverser
|
22
|
+
success 'Done!'
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate
|
26
|
+
%w[from to].each do |opt|
|
27
|
+
fatal_error "No \"#{opt}\" option" if send(opt).blank?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def start_banner
|
32
|
+
infov 'From', from
|
33
|
+
infov 'To', to
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def namespace_replacer_uncached
|
39
|
+
::Avm::EacRubyBase1::Sources::NamespaceReplacer.new(from, to)
|
40
|
+
end
|
41
|
+
|
42
|
+
def text_replacer
|
43
|
+
@text_replacer ||= super.gsub(from, to).gsub(from_path, to_path)
|
44
|
+
.gsub(namespace_replacer.from_result, namespace_replacer.to_result)
|
45
|
+
end
|
46
|
+
|
47
|
+
def replace_file?(file)
|
48
|
+
file.extname == '.rb'
|
49
|
+
end
|
50
|
+
|
51
|
+
def replacements_banner
|
52
|
+
infov 'Replacements', text_replacer.replacements.count
|
53
|
+
text_replacer.replacements.each do |rep|
|
54
|
+
infov ' * ', rep
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def from
|
59
|
+
parsed.from.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def to
|
63
|
+
parsed.to.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def from_path
|
67
|
+
from.underscore
|
68
|
+
end
|
69
|
+
|
70
|
+
def to_path
|
71
|
+
to.underscore
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module EacRubyBase1
|
5
|
+
module Sources
|
6
|
+
class NamespaceReplacer
|
7
|
+
common_constructor :from, :to
|
8
|
+
|
9
|
+
def concat_regex(regexes)
|
10
|
+
r = regexes.first
|
11
|
+
regexes[1..-1].each do |x|
|
12
|
+
r = ::Regexp.new(r.source + x.source)
|
13
|
+
end
|
14
|
+
r
|
15
|
+
end
|
16
|
+
|
17
|
+
def from_result
|
18
|
+
/\n#{from_open.source}(.+)#{from_close.source}/m
|
19
|
+
end
|
20
|
+
|
21
|
+
def from_open
|
22
|
+
concat_regex(from.split('::')
|
23
|
+
.map { |v| / *(?:class|module) +#{::Regexp.quote(v)} *\n/m })
|
24
|
+
end
|
25
|
+
|
26
|
+
def from_close
|
27
|
+
concat_regex(from.split('::').count.times.map { / *end *\n/m })
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_result
|
31
|
+
"\n\n#{to_open}\\1#{to_close}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_open
|
35
|
+
s = ''
|
36
|
+
to.split('::').each_with_index do |part, index|
|
37
|
+
s += (' ' * index) + "module #{part}\n"
|
38
|
+
end
|
39
|
+
s
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_close
|
43
|
+
parts = to.split('::')
|
44
|
+
s = ''
|
45
|
+
parts.each_with_index do |_part, index|
|
46
|
+
tabc = (parts.count - 1 - index)
|
47
|
+
tabc -= 1 if index.zero?
|
48
|
+
s += (' ' * tabc) + "end\n"
|
49
|
+
end
|
50
|
+
s
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -16,13 +16,9 @@ module Avm
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
infov 'Gem to update', gem_name
|
23
|
-
::Avm::EacRubyBase1::Sources::UpdateDependencyRequirements
|
24
|
-
.new(runner_context.call(:source), gem_name).perform
|
25
|
-
end
|
19
|
+
start_banner
|
20
|
+
update_gemfile_lock
|
21
|
+
process_all_gems
|
26
22
|
end
|
27
23
|
|
28
24
|
def gemspec
|
@@ -47,6 +43,24 @@ module Avm
|
|
47
43
|
|
48
44
|
gemspec.dependencies.map(&:gem_name)
|
49
45
|
end
|
46
|
+
|
47
|
+
def process_all_gems
|
48
|
+
gem_names.each do |gem_name|
|
49
|
+
infov 'Gem to update', gem_name
|
50
|
+
::Avm::EacRubyBase1::Sources::UpdateDependencyRequirements
|
51
|
+
.new(runner_context.call(:source), gem_name).perform
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def start_banner
|
56
|
+
runner_context.call(:source_banner)
|
57
|
+
infov 'Gems to update', gem_names.count
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_gemfile_lock
|
61
|
+
infom 'Updating Gemfile\'s lock...'
|
62
|
+
runner_context.call(:source).bundle('update').execute!
|
63
|
+
end
|
50
64
|
end
|
51
65
|
end
|
52
66
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'avm/files/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'avm-files'
|
9
|
+
s.version = Avm::Files::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 'avm', '~> 0.43'
|
16
|
+
s.add_dependency 'eac_cli', '~> 0.28'
|
17
|
+
s.add_dependency 'eac_fs', '~> 0.12', '>= 0.12.3'
|
18
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.103'
|
19
|
+
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
|
20
|
+
|
21
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
22
|
+
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,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,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/files/appendable/resource_base'
|
5
|
+
require 'eac_templates/directory'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Files
|
9
|
+
module Appendable
|
10
|
+
class TemplatizedDirectory < ::Avm::Files::Appendable::ResourceBase
|
11
|
+
attr_reader :source_path
|
12
|
+
|
13
|
+
def initialize(appender, source_path)
|
14
|
+
super(appender)
|
15
|
+
@source_path = source_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def write_on(target_dir)
|
19
|
+
raise 'Variables source not set' if appender.variables_source.blank?
|
20
|
+
|
21
|
+
::EacTemplates::Directory.new(source_path).apply(
|
22
|
+
appender.variables_source,
|
23
|
+
target_dir
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
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,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'addressable'
|
4
|
+
require 'avm/files/appendable'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Files
|
9
|
+
class Deploy
|
10
|
+
include ::Avm::Files::Appendable
|
11
|
+
enable_simple_cache
|
12
|
+
|
13
|
+
attr_reader :build_dir, :target_env, :target_path
|
14
|
+
|
15
|
+
common_constructor :target_env, :target_path
|
16
|
+
|
17
|
+
def run
|
18
|
+
on_build_dir do
|
19
|
+
copy_content_to_build_dir
|
20
|
+
mkdir_target
|
21
|
+
clear_content
|
22
|
+
send_untar_package
|
23
|
+
set_target_permission
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def on_build_dir
|
30
|
+
@build_dir = ::Dir.mktmpdir
|
31
|
+
yield
|
32
|
+
ensure
|
33
|
+
::FileUtils.rm_rf(@build_dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
def copy_content_to_build_dir
|
37
|
+
write_appended_on(build_dir)
|
38
|
+
end
|
39
|
+
|
40
|
+
def mkdir_target
|
41
|
+
target_env.command('mkdir', '-p', target_path).execute!
|
42
|
+
end
|
43
|
+
|
44
|
+
def clear_content
|
45
|
+
target_env.command(
|
46
|
+
'find', target_path, '-mindepth', '1', '-maxdepth', '1', '-exec', 'rm', '-rf', '{}', ';'
|
47
|
+
).execute!
|
48
|
+
end
|
49
|
+
|
50
|
+
def send_untar_package
|
51
|
+
tar_build_command.pipe(untar_build_command).execute!
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_target_permission
|
55
|
+
target_env.command('chmod', '755', target_path).execute!
|
56
|
+
end
|
57
|
+
|
58
|
+
def tar_build_command
|
59
|
+
source_env.command('tar', '-czO', '-C', build_dir, '.')
|
60
|
+
end
|
61
|
+
|
62
|
+
def untar_build_command
|
63
|
+
target_env.command('tar', '-xzf', '-', '-C', target_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
def source_env
|
67
|
+
::EacRubyUtils::Envs.local
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|