eac_tools 0.48.0 → 0.49.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 +28 -23
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/registry/sources.rb +21 -0
- data/sub/avm/lib/avm/sources/base/stereotype.rb +18 -0
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +1 -1
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/data_unit.rb +13 -7
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +16 -1
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
- data/sub/avm-eac_ubuntu_base0/Gemfile +5 -0
- data/sub/avm-eac_ubuntu_base0/avm-eac_ubuntu_base0.gemspec +21 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/apache/resource.rb +59 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/apache.rb +26 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/docker_image.rb +29 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances/base.rb +22 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances.rb +11 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/rspec/ssh_docker_server.rb +84 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/rspec.rb +11 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/runners/base/docker.rb +19 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/runners/base.rb +28 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb +7 -0
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0.rb +9 -0
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/docker_image_spec.rb +16 -0
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/runners/base/docker_spec.rb +14 -0
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/runners/base_spec.rb +7 -0
- data/sub/avm-eac_ubuntu_base0/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_ubuntu_base0/spec/spec_helper.rb +4 -0
- data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/docker_image/Dockerfile.template +24 -0
- data/sub/{avm-tools/spec/spec_helper/stub_templates/stubbed_docker_server → avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server}/Dockerfile +0 -0
- data/sub/{avm-tools/spec/spec_helper/stub_templates/stubbed_docker_server → avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server}/id_rsa +0 -0
- data/sub/{avm-tools/spec/spec_helper/stub_templates/stubbed_docker_server → avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server}/id_rsa.pub +0 -0
- data/sub/avm-tools/avm-tools.gemspec +3 -3
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/avm-tools/spec/lib/avm/tools/runner/git/deploy_spec.rb +4 -2
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/composite_command.rb +14 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +2 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/{command_spec.rb → command/base_example.rb} +2 -5
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/local_env_spec.rb +11 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/ssh_env_spec.rb +17 -0
- metadata +46 -14
- data/sub/avm-tools/spec/spec_helper/stubbed_docker_server.rb +0 -93
- data/sub/avm-tools/spec/spec_helper/templates.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95ce6a42783daae88feb2f51ad5a030d0deec5bd232b54134e105ba3aa8e9977
|
4
|
+
data.tar.gz: cf6bd266decf81b7c6ff1ae75b28f7943772f83b7ea733ab3d73916be36f6c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48291d409c8e3c785a0c53911d566c7fefddc7b9380a6109f3ef83baf6bb9e37f11c401725fd6282d362b6883da37c026a7d1023d2f90bccc02a65c8155f5cd1
|
7
|
+
data.tar.gz: ed7abbbd834bb86398069f0b270e833d5f4a4d694da88e53602f06af44f6bc07a169d90cc297d0a212b5cad0ee7c47221fe212a72d80fbe43f3b4bd02e42760d
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.
|
5
|
-
avm (~> 0.
|
4
|
+
eac_tools (0.49.0)
|
5
|
+
avm (~> 0.58)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.13)
|
7
7
|
avm-eac_generic_base0 (~> 0.8)
|
8
8
|
avm-eac_latex_base0 (~> 0.3)
|
9
|
-
avm-eac_php_base0 (~> 0.4)
|
10
|
-
avm-eac_postgresql_base0 (~> 0.2, >= 0.2.
|
9
|
+
avm-eac_php_base0 (~> 0.4, >= 0.4.1)
|
10
|
+
avm-eac_postgresql_base0 (~> 0.2, >= 0.2.3)
|
11
11
|
avm-eac_python_base0 (~> 0.2, >= 0.2.1)
|
12
12
|
avm-eac_rails_base0 (~> 0.9)
|
13
13
|
avm-eac_rails_base1 (~> 0.8)
|
@@ -16,8 +16,8 @@ PATH
|
|
16
16
|
avm-eac_ruby_base1 (~> 0.27, >= 0.27.3)
|
17
17
|
avm-eac_webapp_base0 (~> 0.13)
|
18
18
|
avm-eac_wordpress_base0 (~> 0.3)
|
19
|
-
avm-tools (~> 0.142, >= 0.142.
|
20
|
-
eac_ruby_utils (~> 0.109)
|
19
|
+
avm-tools (~> 0.142, >= 0.142.8)
|
20
|
+
eac_ruby_utils (~> 0.109, >= 0.109.1)
|
21
21
|
|
22
22
|
PATH
|
23
23
|
remote: sub/aranha-parsers
|
@@ -68,9 +68,9 @@ PATH
|
|
68
68
|
PATH
|
69
69
|
remote: sub/avm-eac_postgresql_base0
|
70
70
|
specs:
|
71
|
-
avm-eac_postgresql_base0 (0.2.
|
71
|
+
avm-eac_postgresql_base0 (0.2.3)
|
72
72
|
avm (~> 0.57)
|
73
|
-
eac_ruby_utils (~> 0.
|
73
|
+
eac_ruby_utils (~> 0.109)
|
74
74
|
|
75
75
|
PATH
|
76
76
|
remote: sub/avm-eac_python_base0
|
@@ -123,6 +123,14 @@ PATH
|
|
123
123
|
avm-eac_generic_base0 (~> 0.8)
|
124
124
|
eac_ruby_utils (~> 0.109)
|
125
125
|
|
126
|
+
PATH
|
127
|
+
remote: sub/avm-eac_ubuntu_base0
|
128
|
+
specs:
|
129
|
+
avm-eac_ubuntu_base0 (0.4.0)
|
130
|
+
avm (~> 0.57)
|
131
|
+
eac_ruby_utils (~> 0.109)
|
132
|
+
eac_templates (~> 0.3, >= 0.3.2)
|
133
|
+
|
126
134
|
PATH
|
127
135
|
remote: sub/avm-eac_webapp_base0
|
128
136
|
specs:
|
@@ -165,11 +173,11 @@ PATH
|
|
165
173
|
PATH
|
166
174
|
remote: sub/avm-tools
|
167
175
|
specs:
|
168
|
-
avm-tools (0.142.
|
176
|
+
avm-tools (0.142.8)
|
169
177
|
aranha-parsers (~> 0.14, >= 0.14.4)
|
170
178
|
avm (~> 0.57)
|
171
|
-
avm-eac_ruby_base1 (~> 0.27, >= 0.27.
|
172
|
-
avm-eac_ubuntu_base0 (~> 0.
|
179
|
+
avm-eac_ruby_base1 (~> 0.27, >= 0.27.3)
|
180
|
+
avm-eac_ubuntu_base0 (~> 0.4)
|
173
181
|
avm-files (~> 0.6)
|
174
182
|
avm-git (~> 0.10, >= 0.10.1)
|
175
183
|
clipboard (~> 1.3, >= 1.3.6)
|
@@ -177,20 +185,20 @@ PATH
|
|
177
185
|
eac_git (~> 0.14)
|
178
186
|
eac_ruby_base0 (~> 0.17, >= 0.17.1)
|
179
187
|
eac_templates (~> 0.3, >= 0.3.2)
|
180
|
-
git (~> 1.
|
188
|
+
git (~> 1.13)
|
181
189
|
ruby-progressbar (~> 1.11)
|
182
190
|
|
183
191
|
PATH
|
184
192
|
remote: sub/avm
|
185
193
|
specs:
|
186
|
-
avm (0.
|
194
|
+
avm (0.58.0)
|
187
195
|
aranha-parsers (~> 0.14, >= 0.14.4)
|
188
196
|
eac_cli (~> 0.30)
|
189
197
|
eac_config (~> 0.12)
|
190
198
|
eac_docker (~> 0.5)
|
191
|
-
eac_fs (~> 0.
|
199
|
+
eac_fs (~> 0.16)
|
192
200
|
eac_git (~> 0.14)
|
193
|
-
eac_ruby_utils (~> 0.
|
201
|
+
eac_ruby_utils (~> 0.109, >= 0.109.1)
|
194
202
|
eac_templates (~> 0.3, >= 0.3.2)
|
195
203
|
filesize (~> 0.2)
|
196
204
|
htmlbeautifier (~> 1.4, >= 1.4.2)
|
@@ -245,7 +253,7 @@ PATH
|
|
245
253
|
PATH
|
246
254
|
remote: sub/eac_ruby_utils
|
247
255
|
specs:
|
248
|
-
eac_ruby_utils (0.109.
|
256
|
+
eac_ruby_utils (0.109.1)
|
249
257
|
activesupport (>= 4, < 7)
|
250
258
|
addressable (~> 2.8, >= 2.8.1)
|
251
259
|
bundler
|
@@ -265,10 +273,6 @@ GEM
|
|
265
273
|
public_suffix (>= 2.0.2, < 6.0)
|
266
274
|
asciidoctor (2.0.18)
|
267
275
|
ast (2.4.2)
|
268
|
-
avm-eac_ubuntu_base0 (0.3.0)
|
269
|
-
avm (~> 0.7)
|
270
|
-
eac_ruby_utils (~> 0.77, >= 0.77.1)
|
271
|
-
eac_templates (~> 0.3)
|
272
276
|
clipboard (1.3.6)
|
273
277
|
colorize (0.8.1)
|
274
278
|
concurrent-ruby (1.1.10)
|
@@ -316,7 +320,7 @@ GEM
|
|
316
320
|
faraday_middleware (1.2.0)
|
317
321
|
faraday (~> 1.0)
|
318
322
|
filesize (0.2.0)
|
319
|
-
git (1.
|
323
|
+
git (1.13.0)
|
320
324
|
addressable (~> 2.8)
|
321
325
|
rchardet (~> 1.8)
|
322
326
|
hpricot (0.8.6)
|
@@ -339,7 +343,7 @@ GEM
|
|
339
343
|
ast (~> 2.4.1)
|
340
344
|
parslet (2.0.0)
|
341
345
|
public_suffix (5.0.1)
|
342
|
-
racc (1.6.
|
346
|
+
racc (1.6.2)
|
343
347
|
rack (3.0.2)
|
344
348
|
rainbow (3.1.1)
|
345
349
|
rchardet (1.8.0)
|
@@ -351,7 +355,7 @@ GEM
|
|
351
355
|
rspec-mocks (~> 3.12.0)
|
352
356
|
rspec-core (3.12.0)
|
353
357
|
rspec-support (~> 3.12.0)
|
354
|
-
rspec-expectations (3.12.
|
358
|
+
rspec-expectations (3.12.1)
|
355
359
|
diff-lcs (>= 1.2.0, < 2.0)
|
356
360
|
rspec-support (~> 3.12.0)
|
357
361
|
rspec-mocks (3.12.1)
|
@@ -397,6 +401,7 @@ DEPENDENCIES
|
|
397
401
|
avm-eac_redmine_base0!
|
398
402
|
avm-eac_redmine_plugin_base0!
|
399
403
|
avm-eac_ruby_base1!
|
404
|
+
avm-eac_ubuntu_base0!
|
400
405
|
avm-eac_webapp_base0!
|
401
406
|
avm-eac_wordpress_base0!
|
402
407
|
avm-files!
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency 'eac_cli', '~> 0.30'
|
17
17
|
s.add_dependency 'eac_config', '~> 0.12'
|
18
18
|
s.add_dependency 'eac_docker', '~> 0.5'
|
19
|
-
s.add_dependency 'eac_fs', '~> 0.
|
19
|
+
s.add_dependency 'eac_fs', '~> 0.16'
|
20
20
|
s.add_dependency 'eac_git', '~> 0.14'
|
21
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
21
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.109', '>= 0.109.1'
|
22
22
|
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
|
23
23
|
s.add_dependency 'filesize', '~> 0.2'
|
24
24
|
s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
|
@@ -5,6 +5,27 @@ require 'avm/registry/with_path'
|
|
5
5
|
module Avm
|
6
6
|
module Registry
|
7
7
|
class Sources < ::Avm::Registry::WithPath
|
8
|
+
# @return [Avm::ApplicationStereotypes::Base]
|
9
|
+
def application_stereotype_by_name(name)
|
10
|
+
::Avm::Registry.application_stereotypes.detect(name)
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Avm::Sources::Base, nil]
|
14
|
+
def detect_optional(*detect_args)
|
15
|
+
detect_optional_by_configuration(*detect_args) || super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Avm::Sources::Base, nil]
|
19
|
+
def detect_optional_by_configuration(path, *detect_args)
|
20
|
+
source_configured_stereotype_name(path).if_present do |v|
|
21
|
+
application_stereotype_by_name(v).source_class.new(path, *detect_args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
def source_configured_stereotype_name(path)
|
27
|
+
::Avm::Sources::Base.new(path).stereotype_name_by_configuration
|
28
|
+
end
|
8
29
|
end
|
9
30
|
end
|
10
31
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Base
|
8
|
+
module Stereotype
|
9
|
+
STEREOTYPE_NAME_KEY = 'stereotype'
|
10
|
+
|
11
|
+
# @return [String, nil]
|
12
|
+
def stereotype_name_by_configuration
|
13
|
+
configuration.entry(STEREOTYPE_NAME_KEY).value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
15
|
s.add_dependency 'avm', '~> 0.57'
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.109'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
|
19
19
|
end
|
@@ -7,6 +7,7 @@ module Avm
|
|
7
7
|
class Instance
|
8
8
|
class DataUnit < ::Avm::Instances::Data::Unit
|
9
9
|
EXTENSION = '.pgdump.gz'
|
10
|
+
TABLES_SQL = 'select tablename from pg_tables where schemaname = \'public\''
|
10
11
|
|
11
12
|
before_load :clear_database
|
12
13
|
|
@@ -15,24 +16,29 @@ module Avm
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def load_command
|
18
|
-
instance.
|
19
|
+
instance.load_gzip_command
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
24
|
def clear_database
|
24
25
|
info 'Clearing database (Dropping all tables)...'
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"
|
26
|
+
ts = tables
|
27
|
+
if ts.empty?
|
28
|
+
info 'Database has no tables'
|
29
|
+
else
|
30
|
+
info "Removing #{ts.count} table(s)..."
|
31
|
+
run_sql('drop table ' + ts.map { |t| "\"#{t}\"" }.join(', ') + ' cascade')
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def run_sql(sql)
|
34
36
|
instance.psql_command_command(sql).execute!
|
35
37
|
end
|
38
|
+
|
39
|
+
def tables
|
40
|
+
run_sql(TABLES_SQL).each_line.map(&:strip).reject(&:blank?)
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
@@ -29,7 +29,22 @@ module Avm
|
|
29
29
|
|
30
30
|
# @return [EacRubyUtils::Envs::Command]
|
31
31
|
def dump_gzip_command
|
32
|
-
dump_command.pipe(
|
32
|
+
dump_command.pipe(gzip_compress_command)
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [EacRubyUtils::Envs::Command]
|
36
|
+
def gzip_compress_command
|
37
|
+
env.command('gzip', '-9', '-c')
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [EacRubyUtils::Envs::Command]
|
41
|
+
def gzip_decompress_command
|
42
|
+
env.command('gzip', '-d')
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [EacRubyUtils::Envs::Command]
|
46
|
+
def load_gzip_command
|
47
|
+
gzip_decompress_command.pipe(psql_command)
|
33
48
|
end
|
34
49
|
|
35
50
|
# @return [String]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'avm/eac_ubuntu_base0/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'avm-eac_ubuntu_base0'
|
9
|
+
s.version = Avm::EacUbuntuBase0::VERSION
|
10
|
+
s.authors = ['Put here the authors']
|
11
|
+
s.summary = 'Put here de description.'
|
12
|
+
|
13
|
+
s.files = Dir['{lib,template}/**/*']
|
14
|
+
|
15
|
+
s.add_dependency 'avm', '~> 0.57'
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.109'
|
17
|
+
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
|
18
|
+
|
19
|
+
s.add_development_dependency 'avm-eac_ubuntu_base0'
|
20
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
|
21
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacUbuntuBase0
|
7
|
+
class Apache
|
8
|
+
class Resource
|
9
|
+
common_constructor :apache, :type, :directory_prefix, :name
|
10
|
+
|
11
|
+
def available_path
|
12
|
+
::File.join(apache.etc_root, "#{directory_prefix}-available", "#{name}.conf")
|
13
|
+
end
|
14
|
+
|
15
|
+
def available?
|
16
|
+
apache.host_env.file(available_path).exist?
|
17
|
+
end
|
18
|
+
|
19
|
+
def disable
|
20
|
+
apache.host_env.command('sudo', "a2dis#{type}", name).execute!
|
21
|
+
end
|
22
|
+
|
23
|
+
def enable
|
24
|
+
apache.host_env.command('sudo', "a2en#{type}", name).execute!
|
25
|
+
end
|
26
|
+
|
27
|
+
def enabled_path
|
28
|
+
::File.join(apache.etc_root, "#{directory_prefix}-enabled", "#{name}.conf")
|
29
|
+
end
|
30
|
+
|
31
|
+
def enabled?
|
32
|
+
apache.host_env.file(enabled_path).exist?
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove
|
36
|
+
remove_disabled
|
37
|
+
remove_available
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove_available
|
41
|
+
raise 'Remove enabled before' if enabled?
|
42
|
+
|
43
|
+
apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
|
44
|
+
end
|
45
|
+
|
46
|
+
def remove_disabled
|
47
|
+
disable if enabled?
|
48
|
+
apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
|
49
|
+
end
|
50
|
+
|
51
|
+
def write(content)
|
52
|
+
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
53
|
+
apache.host_env.command('sudo', 'tee', available_path)
|
54
|
+
).execute!
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacUbuntuBase0
|
7
|
+
class Apache
|
8
|
+
require_sub __FILE__
|
9
|
+
common_constructor :host_env
|
10
|
+
|
11
|
+
def etc_root
|
12
|
+
'/etc/apache2'
|
13
|
+
end
|
14
|
+
|
15
|
+
def service(command)
|
16
|
+
host_env.command('sudo', 'service', 'apache2', command)
|
17
|
+
end
|
18
|
+
|
19
|
+
{ conf: :conf, site: :sites }.each do |type, directory_prefix|
|
20
|
+
define_method type do |name|
|
21
|
+
::Avm::EacUbuntuBase0::Apache::Resource.new(self, type, directory_prefix, name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/docker/image'
|
4
|
+
require 'eac_templates/from_all_gems'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacUbuntuBase0
|
9
|
+
class DockerImage < ::Avm::Docker::Image
|
10
|
+
USER_NAME = 'myuser'
|
11
|
+
|
12
|
+
def stereotype_tag
|
13
|
+
'eac_ubuntu_base0'
|
14
|
+
end
|
15
|
+
|
16
|
+
def user_home
|
17
|
+
::File.join('/home', user_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def user_name
|
21
|
+
USER_NAME
|
22
|
+
end
|
23
|
+
|
24
|
+
def user_password
|
25
|
+
user_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ubuntu_base0/docker_image'
|
4
|
+
require 'avm/instances/base'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacUbuntuBase0
|
8
|
+
module Instances
|
9
|
+
class Base < ::Avm::Instances::Base
|
10
|
+
def docker_image_class
|
11
|
+
::Avm::EacUbuntuBase0::DockerImage
|
12
|
+
end
|
13
|
+
|
14
|
+
def file_sudo_write(path, content)
|
15
|
+
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
16
|
+
host_env.command('sudo', 'tee', path)
|
17
|
+
).execute!
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_docker/images/templatized'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_templates/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacUbuntuBase0
|
9
|
+
module Rspec
|
10
|
+
class SshDockerServer < ::EacDocker::Images::Templatized
|
11
|
+
# @return [EacRubyUtils::Envs::SshEnv]
|
12
|
+
def env
|
13
|
+
raise '@env is blank' if @env.blank?
|
14
|
+
|
15
|
+
@env
|
16
|
+
end
|
17
|
+
|
18
|
+
def on_run
|
19
|
+
on_container do
|
20
|
+
on_env do
|
21
|
+
yield
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def container
|
29
|
+
raise '@container is blank' if @container.blank?
|
30
|
+
|
31
|
+
@container
|
32
|
+
end
|
33
|
+
|
34
|
+
def env_identity_file
|
35
|
+
template.child('id_rsa').path
|
36
|
+
end
|
37
|
+
|
38
|
+
def env_identity_file_good_permissions
|
39
|
+
r = ::EacRubyUtils::Fs::Temp.file
|
40
|
+
::FileUtils.cp env_identity_file, r
|
41
|
+
r.chmod(0o600)
|
42
|
+
r
|
43
|
+
end
|
44
|
+
|
45
|
+
def close_env
|
46
|
+
@identity_file.remove
|
47
|
+
@env = nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def on_env
|
51
|
+
open_env
|
52
|
+
begin
|
53
|
+
yield
|
54
|
+
ensure
|
55
|
+
close_env
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def on_container
|
60
|
+
provide.container.temporary(true).on_detached do |container|
|
61
|
+
@container = container
|
62
|
+
begin
|
63
|
+
yield
|
64
|
+
ensure
|
65
|
+
@container = nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def open_env
|
71
|
+
raise 'Environment already open' if @env.present?
|
72
|
+
|
73
|
+
@identity_file = env_identity_file_good_permissions
|
74
|
+
@env = ::EacRubyUtils::Envs::SshEnv.new(
|
75
|
+
"ssh://root@#{container.hostname}" \
|
76
|
+
'?StrictHostKeyChecking=no' \
|
77
|
+
'&BatchMode=yes' \
|
78
|
+
"&IdentityFile=#{@identity_file}"
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/docker/runner'
|
4
|
+
require 'avm/runners/base'
|
5
|
+
require 'eac_ruby_utils/struct'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacUbuntuBase0
|
9
|
+
module Runners
|
10
|
+
class Base < ::Avm::Runners::Base
|
11
|
+
class Docker < ::Avm::Docker::Runner
|
12
|
+
def use_default_registry?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/runners/base'
|
4
|
+
require 'avm/eac_ubuntu_base0/instances/base'
|
5
|
+
require 'eac_ruby_utils/patches/module/require_sub'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacUbuntuBase0
|
9
|
+
module Runners
|
10
|
+
class Base < ::Avm::Runners::Base
|
11
|
+
enable_simple_cache
|
12
|
+
require_sub __FILE__
|
13
|
+
|
14
|
+
INSTANCE_ID = 'eac-ubuntu-base0_self'
|
15
|
+
|
16
|
+
runner_with :help, :subcommands do
|
17
|
+
subcommands
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def instance_uncached
|
23
|
+
::Avm::EacUbuntuBase0::Instances::Base.by_id(INSTANCE_ID)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ubuntu_base0/docker_image'
|
4
|
+
require 'eac_docker/images/base'
|
5
|
+
require 'eac_docker/registry'
|
6
|
+
|
7
|
+
::RSpec.describe ::Avm::EacUbuntuBase0::DockerImage do
|
8
|
+
let(:registry) { ::EacDocker::Registry.new('stub') }
|
9
|
+
let(:instance) { described_class.new(registry) }
|
10
|
+
|
11
|
+
describe '#provide' do
|
12
|
+
it do
|
13
|
+
expect(instance.provide).to be_a(::EacDocker::Images::Base)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ubuntu_base0/runners/base'
|
4
|
+
require 'avm/eac_ubuntu_base0/runners/base/docker'
|
5
|
+
|
6
|
+
::RSpec.describe ::Avm::EacUbuntuBase0::Runners::Base::Docker do
|
7
|
+
it do
|
8
|
+
expect { run_command('--registry-name', 'testing', '--image-name') }.not_to raise_error
|
9
|
+
end
|
10
|
+
|
11
|
+
def run_command(*argv)
|
12
|
+
::Avm::EacUbuntuBase0::Runners::Base.run(argv: %w[docker] + argv)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
FROM ubuntu:20.04
|
2
|
+
|
3
|
+
# Base system update
|
4
|
+
RUN apt-get update -y
|
5
|
+
RUN apt-get dist-upgrade -y
|
6
|
+
|
7
|
+
# Timezone
|
8
|
+
RUN apt-get install -y tzdata
|
9
|
+
RUN ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
|
10
|
+
RUN dpkg-reconfigure --frontend noninteractive tzdata
|
11
|
+
|
12
|
+
# Default user
|
13
|
+
RUN /usr/sbin/useradd --shell /bin/bash --home-dir %%user_home%% --create-home %%user_name%%
|
14
|
+
RUN /bin/echo '%%user_name%%:%%user_password%%' | /usr/sbin/chpasswd
|
15
|
+
RUN /bin/chown %%user_name%%:%%user_name%% %%user_home%% -R
|
16
|
+
|
17
|
+
# Sudo
|
18
|
+
RUN apt-get install -y sudo
|
19
|
+
RUN /bin/echo "%%user_name%% ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/%%user_name%%_all_nopasswd && chmod 0440 /etc/sudoers.d/%%user_name%%_all_nopasswd
|
20
|
+
|
21
|
+
# Container
|
22
|
+
USER %%user_name%%
|
23
|
+
WORKDIR %%user_home%%
|
24
|
+
CMD /bin/bash
|
File without changes
|
File without changes
|
File without changes
|
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.4'
|
18
18
|
s.add_dependency 'avm', '~> 0.57'
|
19
|
-
s.add_dependency 'avm-eac_ruby_base1', '~> 0.27', '>= 0.27.
|
20
|
-
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.
|
19
|
+
s.add_dependency 'avm-eac_ruby_base1', '~> 0.27', '>= 0.27.3'
|
20
|
+
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4'
|
21
21
|
s.add_dependency 'avm-files', '~> 0.6'
|
22
22
|
s.add_dependency 'avm-git', '~> 0.10', '>= 0.10.1'
|
23
23
|
s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'eac_git', '~> 0.14'
|
26
26
|
s.add_dependency 'eac_ruby_base0', '~> 0.17', '>= 0.17.1'
|
27
27
|
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
|
28
|
-
s.add_dependency 'git', '~> 1.
|
28
|
+
s.add_dependency 'git', '~> 1.13'
|
29
29
|
s.add_dependency 'ruby-progressbar', '~> 1.11'
|
30
30
|
|
31
31
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/eac_ubuntu_base0/rspec/ssh_docker_server'
|
3
4
|
require 'avm/tools/runner'
|
4
5
|
require 'tmpdir'
|
5
6
|
|
@@ -86,7 +87,8 @@ require 'tmpdir'
|
|
86
87
|
end
|
87
88
|
|
88
89
|
context 'with ssh target', docker: true do
|
89
|
-
let(:
|
90
|
+
let(:ssh_server) { ::Avm::EacUbuntuBase0::Rspec::SshDockerServer.new }
|
91
|
+
let(:env) { ssh_server.env }
|
90
92
|
let(:tmpdir) { env.command('mktemp', '-d').execute! }
|
91
93
|
let(:target_dir) { ::File.join(tmpdir, 'target') }
|
92
94
|
let(:target_url) do
|
@@ -96,7 +98,7 @@ require 'tmpdir'
|
|
96
98
|
end
|
97
99
|
|
98
100
|
around do |example|
|
99
|
-
|
101
|
+
ssh_server.on_run(&example)
|
100
102
|
end
|
101
103
|
|
102
104
|
before do
|
@@ -20,5 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'bundler'
|
21
21
|
s.add_dependency 'filesize', '~> 0.2'
|
22
22
|
s.add_dependency 'net-ssh', '~> 4.2'
|
23
|
+
s.add_development_dependency 'avm-eac_ubuntu_base0', '~> 0.4'
|
23
24
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
24
25
|
end
|
@@ -25,8 +25,20 @@ module EacRubyUtils
|
|
25
25
|
|
26
26
|
# @return [String]
|
27
27
|
def bash_command
|
28
|
-
['set', '-euo', 'pipefail', OPERATOR_BEFORE,
|
29
|
-
|
28
|
+
['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command_line, operator,
|
29
|
+
right_command_line].join(' ')
|
30
|
+
end
|
31
|
+
|
32
|
+
def left_command_line
|
33
|
+
left_command.command_line_without_env
|
34
|
+
end
|
35
|
+
|
36
|
+
def right_command_line
|
37
|
+
if right_command.env == left_command.env
|
38
|
+
right_command.command_line_without_env
|
39
|
+
else
|
40
|
+
right_command.command
|
41
|
+
end
|
30
42
|
end
|
31
43
|
end
|
32
44
|
end
|
@@ -69,8 +69,9 @@ module EacRubyUtils
|
|
69
69
|
.result
|
70
70
|
end
|
71
71
|
|
72
|
+
# @return [Array<Gem::Dependency>]
|
72
73
|
def gem_item_dependencies(item)
|
73
|
-
::Gem::Specification.find_by_name(item.name).dependencies
|
74
|
+
::Gem::Specification.find_by_name(item.name).dependencies.select(&:runtime?)
|
74
75
|
rescue ::Gem::MissingSpecError
|
75
76
|
[]
|
76
77
|
end
|
data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/{command_spec.rb → command/base_example.rb}
RENAMED
@@ -1,11 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/envs/
|
4
|
-
require 'eac_ruby_utils/envs/executable'
|
5
|
-
require 'eac_ruby_utils/envs/local_env'
|
3
|
+
require 'eac_ruby_utils/envs/execution_error'
|
6
4
|
|
7
|
-
RSpec.
|
8
|
-
let(:env) { ::EacRubyUtils::Envs::LocalEnv.new }
|
5
|
+
::RSpec.shared_examples 'with_command_env' do # rubocop:disable Metrics/BlockLength
|
9
6
|
let(:echo) { env.executable('echo', '--version') }
|
10
7
|
let(:cat) { env.executable('cat', '--version') }
|
11
8
|
let(:not_existing_file) { ::Pathname.new('a_file_that_not_exists') }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/envs/command'
|
4
|
+
require 'eac_ruby_utils/envs/local_env'
|
5
|
+
require_relative 'base_example'
|
6
|
+
|
7
|
+
::RSpec.describe ::EacRubyUtils::Envs::Command do
|
8
|
+
let(:env) { ::EacRubyUtils::Envs::LocalEnv.new }
|
9
|
+
|
10
|
+
include_examples 'with_command_env'
|
11
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ubuntu_base0/rspec/ssh_docker_server'
|
4
|
+
require 'eac_ruby_utils/envs/command'
|
5
|
+
require 'eac_ruby_utils/envs/ssh_env'
|
6
|
+
require_relative 'base_example'
|
7
|
+
|
8
|
+
::RSpec.describe ::EacRubyUtils::Envs::Command do
|
9
|
+
let(:ssh_server) { ::Avm::EacUbuntuBase0::Rspec::SshDockerServer.new }
|
10
|
+
let(:env) { ssh_server.env }
|
11
|
+
|
12
|
+
around do |example|
|
13
|
+
ssh_server.on_run(&example)
|
14
|
+
end
|
15
|
+
|
16
|
+
include_examples 'with_command_env'
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.49.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.58'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.58'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: avm-eac_asciidoctor_base0
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,6 +73,9 @@ dependencies:
|
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0.4'
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.4.1
|
76
79
|
type: :runtime
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -80,6 +83,9 @@ dependencies:
|
|
80
83
|
- - "~>"
|
81
84
|
- !ruby/object:Gem::Version
|
82
85
|
version: '0.4'
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.4.1
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: avm-eac_postgresql_base0
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +95,7 @@ dependencies:
|
|
89
95
|
version: '0.2'
|
90
96
|
- - ">="
|
91
97
|
- !ruby/object:Gem::Version
|
92
|
-
version: 0.2.
|
98
|
+
version: 0.2.3
|
93
99
|
type: :runtime
|
94
100
|
prerelease: false
|
95
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -99,7 +105,7 @@ dependencies:
|
|
99
105
|
version: '0.2'
|
100
106
|
- - ">="
|
101
107
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0.2.
|
108
|
+
version: 0.2.3
|
103
109
|
- !ruby/object:Gem::Dependency
|
104
110
|
name: avm-eac_python_base0
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,7 +239,7 @@ dependencies:
|
|
233
239
|
version: '0.142'
|
234
240
|
- - ">="
|
235
241
|
- !ruby/object:Gem::Version
|
236
|
-
version: 0.142.
|
242
|
+
version: 0.142.8
|
237
243
|
type: :runtime
|
238
244
|
prerelease: false
|
239
245
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -243,7 +249,7 @@ dependencies:
|
|
243
249
|
version: '0.142'
|
244
250
|
- - ">="
|
245
251
|
- !ruby/object:Gem::Version
|
246
|
-
version: 0.142.
|
252
|
+
version: 0.142.8
|
247
253
|
- !ruby/object:Gem::Dependency
|
248
254
|
name: eac_ruby_utils
|
249
255
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,6 +257,9 @@ dependencies:
|
|
251
257
|
- - "~>"
|
252
258
|
- !ruby/object:Gem::Version
|
253
259
|
version: '0.109'
|
260
|
+
- - ">="
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: 0.109.1
|
254
263
|
type: :runtime
|
255
264
|
prerelease: false
|
256
265
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -258,6 +267,9 @@ dependencies:
|
|
258
267
|
- - "~>"
|
259
268
|
- !ruby/object:Gem::Version
|
260
269
|
version: '0.109'
|
270
|
+
- - ">="
|
271
|
+
- !ruby/object:Gem::Version
|
272
|
+
version: 0.109.1
|
261
273
|
- !ruby/object:Gem::Dependency
|
262
274
|
name: eac_ruby_gem_support
|
263
275
|
requirement: !ruby/object:Gem::Requirement
|
@@ -733,6 +745,28 @@ files:
|
|
733
745
|
- sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/rubocop_spec.rb
|
734
746
|
- sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/spec_helper.rb
|
735
747
|
- sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/version.template
|
748
|
+
- sub/avm-eac_ubuntu_base0/Gemfile
|
749
|
+
- sub/avm-eac_ubuntu_base0/avm-eac_ubuntu_base0.gemspec
|
750
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0.rb
|
751
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/apache.rb
|
752
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/apache/resource.rb
|
753
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/docker_image.rb
|
754
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances.rb
|
755
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances/base.rb
|
756
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/rspec.rb
|
757
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/rspec/ssh_docker_server.rb
|
758
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/runners/base.rb
|
759
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/runners/base/docker.rb
|
760
|
+
- sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb
|
761
|
+
- sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/docker_image_spec.rb
|
762
|
+
- sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/runners/base/docker_spec.rb
|
763
|
+
- sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/runners/base_spec.rb
|
764
|
+
- sub/avm-eac_ubuntu_base0/spec/rubocop_spec.rb
|
765
|
+
- sub/avm-eac_ubuntu_base0/spec/spec_helper.rb
|
766
|
+
- sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/docker_image/Dockerfile.template
|
767
|
+
- sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/Dockerfile
|
768
|
+
- sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/id_rsa
|
769
|
+
- sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/id_rsa.pub
|
736
770
|
- sub/avm-eac_webapp_base0/Gemfile
|
737
771
|
- sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec
|
738
772
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0.rb
|
@@ -992,11 +1026,6 @@ files:
|
|
992
1026
|
- sub/avm-tools/spec/spec_helper/avm_tools_runner.rb
|
993
1027
|
- sub/avm-tools/spec/spec_helper/eac_launcher.rb
|
994
1028
|
- sub/avm-tools/spec/spec_helper/eac_launcher/settings.yml
|
995
|
-
- sub/avm-tools/spec/spec_helper/stub_templates/stubbed_docker_server/Dockerfile
|
996
|
-
- sub/avm-tools/spec/spec_helper/stub_templates/stubbed_docker_server/id_rsa
|
997
|
-
- sub/avm-tools/spec/spec_helper/stub_templates/stubbed_docker_server/id_rsa.pub
|
998
|
-
- sub/avm-tools/spec/spec_helper/stubbed_docker_server.rb
|
999
|
-
- sub/avm-tools/spec/spec_helper/templates.rb
|
1000
1029
|
- sub/avm-tools/template/avm/self/docker_image/Dockerfile
|
1001
1030
|
- sub/avm-tools/template/avm/self/docker_image/entrypoint.sh
|
1002
1031
|
- sub/avm/Gemfile
|
@@ -1139,6 +1168,7 @@ files:
|
|
1139
1168
|
- sub/avm/lib/avm/sources/base/instance.rb
|
1140
1169
|
- sub/avm/lib/avm/sources/base/locale.rb
|
1141
1170
|
- sub/avm/lib/avm/sources/base/parent.rb
|
1171
|
+
- sub/avm/lib/avm/sources/base/stereotype.rb
|
1142
1172
|
- sub/avm/lib/avm/sources/base/subs.rb
|
1143
1173
|
- sub/avm/lib/avm/sources/base/subs_paths.rb
|
1144
1174
|
- sub/avm/lib/avm/sources/base/testing.rb
|
@@ -1762,7 +1792,9 @@ files:
|
|
1762
1792
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/compare_by_spec.rb
|
1763
1793
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/custom_format_spec.rb
|
1764
1794
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/enum_spec.rb
|
1765
|
-
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/
|
1795
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/base_example.rb
|
1796
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/local_env_spec.rb
|
1797
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/ssh_env_spec.rb
|
1766
1798
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
|
1767
1799
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/ssh_env_spec.rb
|
1768
1800
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/extname_spec.rb
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_docker/images/templatized'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require_relative 'templates'
|
6
|
-
|
7
|
-
class StubbedDockerServer < ::EacDocker::Images::Templatized
|
8
|
-
class << self
|
9
|
-
enable_simple_cache
|
10
|
-
|
11
|
-
def on_run
|
12
|
-
instance.on_run { yield }
|
13
|
-
end
|
14
|
-
|
15
|
-
delegate :env, to: :instance
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def instance_uncached
|
20
|
-
new.tag('avm_stubbed_docker_server')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def env
|
25
|
-
raise '@env is blank' if @env.blank?
|
26
|
-
|
27
|
-
@env
|
28
|
-
end
|
29
|
-
|
30
|
-
def on_run
|
31
|
-
on_container do
|
32
|
-
on_env do
|
33
|
-
yield
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def container
|
41
|
-
raise '@container is blank' if @container.blank?
|
42
|
-
|
43
|
-
@container
|
44
|
-
end
|
45
|
-
|
46
|
-
def env_identity_file
|
47
|
-
template.child('id_rsa').path
|
48
|
-
end
|
49
|
-
|
50
|
-
def env_identity_file_good_permissions
|
51
|
-
r = ::EacRubyUtils::Fs::Temp.file
|
52
|
-
::FileUtils.cp env_identity_file, r
|
53
|
-
r.chmod(0o600)
|
54
|
-
r
|
55
|
-
end
|
56
|
-
|
57
|
-
def close_env
|
58
|
-
@identity_file.remove
|
59
|
-
@env = nil
|
60
|
-
end
|
61
|
-
|
62
|
-
def on_env
|
63
|
-
open_env
|
64
|
-
begin
|
65
|
-
yield
|
66
|
-
ensure
|
67
|
-
close_env
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def on_container
|
72
|
-
provide.container.temporary(true).on_detached do |container|
|
73
|
-
@container = container
|
74
|
-
begin
|
75
|
-
yield
|
76
|
-
ensure
|
77
|
-
@container = nil
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def open_env
|
83
|
-
raise 'Environment already open' if @env.present?
|
84
|
-
|
85
|
-
@identity_file = env_identity_file_good_permissions
|
86
|
-
@env = ::EacRubyUtils::Envs::SshEnv.new(
|
87
|
-
"ssh://root@#{container.hostname}" \
|
88
|
-
'?StrictHostKeyChecking=no' \
|
89
|
-
'&BatchMode=yes' \
|
90
|
-
"&IdentityFile=#{@identity_file}"
|
91
|
-
)
|
92
|
-
end
|
93
|
-
end
|