avm-eac_webapp_base0 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/avm/eac_webapp_base0/instances/build.rb +80 -0
- data/lib/avm/eac_webapp_base0/instances/deploy/build.rb +14 -35
- data/lib/avm/eac_webapp_base0/instances/deploy/info.rb +0 -5
- data/lib/avm/eac_webapp_base0/instances/deploy/scm.rb +11 -9
- data/lib/avm/eac_webapp_base0/instances/deploy.rb +14 -9
- data/lib/avm/eac_webapp_base0/instances/{deploy → install}/setup_files_unit.rb +3 -3
- data/lib/avm/eac_webapp_base0/instances/install.rb +41 -0
- data/lib/avm/eac_webapp_base0/version.rb +1 -1
- metadata +6 -5
- data/lib/avm/eac_webapp_base0/instances/deploy/write_on_target.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00b8bb978cb68d1114a3e6399f60aabe927e5abaec1e4ff1e3d577f5349051f3
|
|
4
|
+
data.tar.gz: f2e023e2b8f2333fc3671500363d60ef71f793713a08c01f2b8598addac7caa9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc080c991524cab5b1a377ba7fec7cc0a54e5c354855f3ea59b6e384f8767d390af2bf899f3b6d3c63a3dea2084e6b41277516c4ee68716aa9358ffb9d4aa578
|
|
7
|
+
data.tar.gz: c8f73284e3c94792f9e175b94c9b48ebe6942755106ca593472d4261363639f9c2b7b03b6146cc285f22d2d1a51ced861af591f669ce115cd7fe4b12f4d52a37
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Avm
|
|
4
|
+
module EacWebappBase0
|
|
5
|
+
module Instances
|
|
6
|
+
class Build
|
|
7
|
+
acts_as_immutable
|
|
8
|
+
enable_memoized
|
|
9
|
+
enable_speaker
|
|
10
|
+
immutable_accessor :appended_directory, type: :array
|
|
11
|
+
immutable_accessor :commit_reference, :target_directory, :template, :variables_source,
|
|
12
|
+
:version
|
|
13
|
+
common_constructor :instance
|
|
14
|
+
|
|
15
|
+
# @return [Array<Object>]
|
|
16
|
+
def immutable_constructor_args
|
|
17
|
+
[instance]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @return [void]
|
|
21
|
+
def perform
|
|
22
|
+
on_source_dir do
|
|
23
|
+
build_content
|
|
24
|
+
append_instance_content
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
protected
|
|
29
|
+
|
|
30
|
+
attr_accessor :source_dir
|
|
31
|
+
|
|
32
|
+
def append_instance_content
|
|
33
|
+
::Avm::Files::Appender
|
|
34
|
+
.new
|
|
35
|
+
.variables_source_set(variables_source)
|
|
36
|
+
.append_templatized_directory(template)
|
|
37
|
+
.append_templatized_directories(appended_directories)
|
|
38
|
+
.append_file_content(version_target_path, version)
|
|
39
|
+
.write_appended_on(target_directory)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def build_content
|
|
43
|
+
::FileUtils.copy_entry(source_dir.to_path, target_directory.to_path)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def build_dir_env
|
|
47
|
+
::EacRubyUtils::Envs.local
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @return [void]
|
|
51
|
+
def on_source_dir
|
|
52
|
+
self.source_dir = ::EacRubyUtils::Fs::Temp.directory
|
|
53
|
+
write_source
|
|
54
|
+
yield
|
|
55
|
+
ensure
|
|
56
|
+
source_dir&.remove
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @return [Avm::Sources::Base]
|
|
60
|
+
memoize def source
|
|
61
|
+
instance.application.local_source.class.new(source_dir)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @return [String]
|
|
65
|
+
def version_target_path
|
|
66
|
+
::Avm::EacWebappBase0::Instances::Base::DeployInfo::DEPLOY_INFO_SUBPATH
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @return [void]
|
|
70
|
+
def write_source
|
|
71
|
+
infom 'Writing Git source code...'
|
|
72
|
+
instance.application.local_source.scm.commit(commit_reference).deploy_to_env_path(
|
|
73
|
+
build_dir_env,
|
|
74
|
+
source_dir
|
|
75
|
+
).variables_source_set(variables_source).run
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -5,55 +5,34 @@ module Avm
|
|
|
5
5
|
module Instances
|
|
6
6
|
class Deploy
|
|
7
7
|
module Build
|
|
8
|
-
enable_memoized
|
|
9
|
-
|
|
10
8
|
private
|
|
11
9
|
|
|
12
|
-
attr_accessor :build_dir
|
|
10
|
+
attr_accessor :build_dir
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
.
|
|
19
|
-
.
|
|
20
|
-
.
|
|
21
|
-
.
|
|
12
|
+
# @return [void]
|
|
13
|
+
def build
|
|
14
|
+
build_class.new(instance)
|
|
15
|
+
.appended_directories(appended_directories)
|
|
16
|
+
.commit_reference(commit_reference)
|
|
17
|
+
.target_directory(build_dir)
|
|
18
|
+
.template(eac_template)
|
|
19
|
+
.variables_source(variables_source)
|
|
20
|
+
.version(version)
|
|
21
|
+
.perform
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
# @return [Class<Avm::EacWebappBase0::Instances::Build>]
|
|
25
|
+
def build_class
|
|
26
|
+
::Avm::EacWebappBase0::Instances::Build
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def create_build_dir
|
|
29
30
|
self.build_dir = ::EacRubyUtils::Fs::Temp.directory
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
def create_source_dir
|
|
33
|
-
self.source_dir = ::EacRubyUtils::Fs::Temp.directory
|
|
34
|
-
infom 'Writing Git source code...'
|
|
35
|
-
scm.commit(commit_reference).deploy_to_env_path(
|
|
36
|
-
build_dir_env,
|
|
37
|
-
source_dir
|
|
38
|
-
).variables_source_set(variables_source).run
|
|
39
|
-
end
|
|
40
|
-
|
|
41
33
|
def remove_build_dir
|
|
42
34
|
build_dir&.remove
|
|
43
35
|
end
|
|
44
|
-
|
|
45
|
-
def remove_source_dir
|
|
46
|
-
source_dir&.remove
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# @return [Avm::Sources::Base]
|
|
50
|
-
memoize def source
|
|
51
|
-
instance.application.local_source.class.new(source_dir)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def build_content
|
|
55
|
-
::FileUtils.copy_entry(source_dir.to_path, build_dir.to_path)
|
|
56
|
-
end
|
|
57
36
|
end
|
|
58
37
|
end
|
|
59
38
|
end
|
|
@@ -32,11 +32,6 @@ module Avm
|
|
|
32
32
|
def version_number
|
|
33
33
|
instance.application.local_source.version.if_present(&:to_s)
|
|
34
34
|
end
|
|
35
|
-
|
|
36
|
-
# @return [String]
|
|
37
|
-
def version_target_path
|
|
38
|
-
::Avm::EacWebappBase0::Instances::Base::DeployInfo::DEPLOY_INFO_SUBPATH
|
|
39
|
-
end
|
|
40
35
|
end
|
|
41
36
|
end
|
|
42
37
|
end
|
|
@@ -9,7 +9,9 @@ module Avm
|
|
|
9
9
|
DEFAULT_REMOTE_READ = true
|
|
10
10
|
DEFAULT_REMOTE_WRITE = true
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
enable_memoized
|
|
13
|
+
|
|
14
|
+
memoize def commit_reference
|
|
13
15
|
git_fetch
|
|
14
16
|
r = git.rev_parse(git_reference_found)
|
|
15
17
|
return r if r
|
|
@@ -17,7 +19,12 @@ module Avm
|
|
|
17
19
|
raise ::Avm::Result::Error, "No commit SHA1 found for \"#{git_reference_found}\""
|
|
18
20
|
end
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
# @return [EacGit::Local]
|
|
23
|
+
memoize def git
|
|
24
|
+
scm.git_repo
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
memoize def git_fetch
|
|
21
28
|
return unless remote_read?
|
|
22
29
|
|
|
23
30
|
infom "Fetching remote \"#{git_remote_name}\" from \"#{git_repository_path}\"..."
|
|
@@ -28,7 +35,7 @@ module Avm
|
|
|
28
35
|
options[OPTION_REFERENCE] || DEFAULT_REFERENCE
|
|
29
36
|
end
|
|
30
37
|
|
|
31
|
-
def
|
|
38
|
+
memoize def git_reference_found
|
|
32
39
|
%w[git_reference instance_branch master_branch].map { |b| send(b) }.find(&:present?) ||
|
|
33
40
|
raise(
|
|
34
41
|
::Avm::Result::Error,
|
|
@@ -36,7 +43,7 @@ module Avm
|
|
|
36
43
|
)
|
|
37
44
|
end
|
|
38
45
|
|
|
39
|
-
def
|
|
46
|
+
memoize def git_remote_hashs
|
|
40
47
|
return {} unless remote_read?
|
|
41
48
|
|
|
42
49
|
git.remote(git_remote_name).ls.hashes
|
|
@@ -50,11 +57,6 @@ module Avm
|
|
|
50
57
|
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
|
51
58
|
end
|
|
52
59
|
|
|
53
|
-
# @return [EacGit::Local]
|
|
54
|
-
def git_uncached
|
|
55
|
-
scm.git_repo
|
|
56
|
-
end
|
|
57
|
-
|
|
58
60
|
def instance_branch
|
|
59
61
|
remote_branch(instance.id)
|
|
60
62
|
end
|
|
@@ -11,9 +11,8 @@ module Avm
|
|
|
11
11
|
DEFAULT_REFERENCE = 'HEAD'
|
|
12
12
|
|
|
13
13
|
REQUEST_TEST_JOB = 'request_test'
|
|
14
|
-
JOBS = (%w[create_build_dir
|
|
15
|
-
|
|
16
|
-
[REQUEST_TEST_JOB]).freeze
|
|
14
|
+
JOBS = (%w[create_build_dir build install] + [REQUEST_TEST_JOB] +
|
|
15
|
+
%w[assert_instance_branch]).freeze
|
|
17
16
|
|
|
18
17
|
include ::Avm::Entries::Jobs::Base
|
|
19
18
|
|
|
@@ -28,7 +27,6 @@ module Avm
|
|
|
28
27
|
super
|
|
29
28
|
ensure
|
|
30
29
|
remove_build_dir
|
|
31
|
-
remove_source_dir
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
def start_banner
|
|
@@ -40,11 +38,6 @@ module Avm
|
|
|
40
38
|
infov 'Appended directories', appended_directories
|
|
41
39
|
end
|
|
42
40
|
|
|
43
|
-
def setup_files_units
|
|
44
|
-
instance.data_package.units.values.map(&:installation_files_data).select(&:present?) # rubocop:disable Rails/CompactBlank
|
|
45
|
-
.each { |unit_install| setup_files_unit(unit_install.key, unit_install.subpath) }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
41
|
def assert_instance_branch
|
|
49
42
|
return unless remote_write?
|
|
50
43
|
|
|
@@ -61,6 +54,18 @@ module Avm
|
|
|
61
54
|
|
|
62
55
|
protected
|
|
63
56
|
|
|
57
|
+
# @return [void]
|
|
58
|
+
# @raise [Avm::Result::Error]
|
|
59
|
+
def install
|
|
60
|
+
result = install_class.new(instance).package_directory_set(build_dir).perform
|
|
61
|
+
raise ::Avm::Result::Error, result.to_s if result.error?
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @return [Class<Avm::EacWebappBase0::Instances::Install>]
|
|
65
|
+
def install_class
|
|
66
|
+
::Avm::EacWebappBase0::Instances::Install
|
|
67
|
+
end
|
|
68
|
+
|
|
64
69
|
def jobs
|
|
65
70
|
r = super
|
|
66
71
|
r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
module Avm
|
|
4
4
|
module EacWebappBase0
|
|
5
5
|
module Instances
|
|
6
|
-
class
|
|
6
|
+
class Install
|
|
7
7
|
class SetupFilesUnit < ::SimpleDelegator
|
|
8
8
|
enable_method_class
|
|
9
9
|
attr_reader :data_key, :fs_path_subpath
|
|
10
10
|
|
|
11
|
-
def initialize(
|
|
12
|
-
super(
|
|
11
|
+
def initialize(install, data_key, fs_path_subpath)
|
|
12
|
+
super(install)
|
|
13
13
|
@data_key = data_key
|
|
14
14
|
@fs_path_subpath = fs_path_subpath
|
|
15
15
|
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Avm
|
|
4
|
+
module EacWebappBase0
|
|
5
|
+
module Instances
|
|
6
|
+
class Install
|
|
7
|
+
JOBS = %w[write_on_target setup_files_units].freeze
|
|
8
|
+
|
|
9
|
+
include ::Avm::Entries::Jobs::Base
|
|
10
|
+
|
|
11
|
+
attr_reader :package_directory
|
|
12
|
+
|
|
13
|
+
# @param directory [Pathname]
|
|
14
|
+
# @return [self]
|
|
15
|
+
def package_directory_set(directory)
|
|
16
|
+
@package_directory = directory
|
|
17
|
+
self
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @return [Avm::Result]
|
|
21
|
+
def perform
|
|
22
|
+
instance.on_disabled_processes { run }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def setup_files_units
|
|
26
|
+
instance.data_package.units.values.map(&:installation_files_data).select(&:present?) # rubocop:disable Rails/CompactBlank
|
|
27
|
+
.each { |unit_install| setup_files_unit(unit_install.key, unit_install.subpath) }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def write_on_target
|
|
31
|
+
::Avm::Files::Deploy.new(
|
|
32
|
+
instance.host_env,
|
|
33
|
+
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
|
34
|
+
).append_plain_directory(package_directory).run
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
require_sub __FILE__, require_mode: :kernel
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avm-eac_webapp_base0
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.24.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Put here the authors
|
|
@@ -137,14 +137,14 @@ dependencies:
|
|
|
137
137
|
requirements:
|
|
138
138
|
- - "~>"
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: '0.
|
|
140
|
+
version: '0.16'
|
|
141
141
|
type: :development
|
|
142
142
|
prerelease: false
|
|
143
143
|
version_requirements: !ruby/object:Gem::Requirement
|
|
144
144
|
requirements:
|
|
145
145
|
- - "~>"
|
|
146
146
|
- !ruby/object:Gem::Version
|
|
147
|
-
version: '0.
|
|
147
|
+
version: '0.16'
|
|
148
148
|
executables: []
|
|
149
149
|
extensions: []
|
|
150
150
|
extra_rdoc_files: []
|
|
@@ -166,14 +166,15 @@ files:
|
|
|
166
166
|
- lib/avm/eac_webapp_base0/instances/base/deploy.rb
|
|
167
167
|
- lib/avm/eac_webapp_base0/instances/base/deploy_info.rb
|
|
168
168
|
- lib/avm/eac_webapp_base0/instances/base/install.rb
|
|
169
|
+
- lib/avm/eac_webapp_base0/instances/build.rb
|
|
169
170
|
- lib/avm/eac_webapp_base0/instances/deploy.rb
|
|
170
171
|
- lib/avm/eac_webapp_base0/instances/deploy/appended_directories.rb
|
|
171
172
|
- lib/avm/eac_webapp_base0/instances/deploy/build.rb
|
|
172
173
|
- lib/avm/eac_webapp_base0/instances/deploy/info.rb
|
|
173
174
|
- lib/avm/eac_webapp_base0/instances/deploy/scm.rb
|
|
174
|
-
- lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb
|
|
175
|
-
- lib/avm/eac_webapp_base0/instances/deploy/write_on_target.rb
|
|
176
175
|
- lib/avm/eac_webapp_base0/instances/deploy_info.rb
|
|
176
|
+
- lib/avm/eac_webapp_base0/instances/install.rb
|
|
177
|
+
- lib/avm/eac_webapp_base0/instances/install/setup_files_unit.rb
|
|
177
178
|
- lib/avm/eac_webapp_base0/instances/processes/web_server.rb
|
|
178
179
|
- lib/avm/eac_webapp_base0/instances/runners/apache_host.rb
|
|
179
180
|
- lib/avm/eac_webapp_base0/instances/runners/apache_path.rb
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Avm
|
|
4
|
-
module EacWebappBase0
|
|
5
|
-
module Instances
|
|
6
|
-
class Deploy
|
|
7
|
-
module WriteOnTarget
|
|
8
|
-
def write_on_target
|
|
9
|
-
::Avm::Files::Deploy.new(
|
|
10
|
-
instance.host_env,
|
|
11
|
-
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
|
12
|
-
).append_plain_directory(build_dir).run
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|