eac_tools 0.25.0 → 0.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -25
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +1 -1
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +2 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb +37 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/runners/base.rb +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/{deploy → instances/deploy}/config/install.sh.template +0 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/{deploy → instances/deploy}/config/secrets.yml +0 -0
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/update_dependencies_requirements.rb +7 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +2 -2
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/deploy.rb +2 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
- data/sub/eac_config/eac_config.gemspec +1 -1
- data/sub/eac_config/lib/eac_config/entry.rb +4 -0
- data/sub/eac_config/lib/eac_config/envvars_node.rb +4 -0
- data/sub/eac_config/lib/eac_config/node_entry.rb +5 -0
- data/sub/eac_config/lib/eac_config/version.rb +1 -1
- data/sub/eac_config/lib/eac_config/yaml_file_node.rb +4 -0
- data/sub/eac_config/spec/lib/eac_config/envvars_node_spec.rb +11 -0
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +2 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb +53 -20
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_replace_objects/replace_instance_method.rb +36 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_replace_objects.rb +52 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{ruby_spec.rb → ruby/on_clean_environment_spec.rb} +11 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby/on_replace_objects_spec.rb +67 -0
- metadata +23 -26
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/deploy.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dd36587fe5621b65a2fd826e04b44f9c941b848a9e5d3bb82f0e40375ec679b
|
4
|
+
data.tar.gz: '0880b563b0f3b7f367ddc299a385a76c626260937d779f4cd92f1884ad0ecc3d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edc33b2af676aaa9ba92138791e4e13fea951c028acd1efc6988a2d4922efd03bad2bb39ff15391110f070c63872ae17bb6a2831421095b62768f8a64c63864
|
7
|
+
data.tar.gz: 68360fc6669359864fbebeab00cf8a858bd341ffc849ed6855a4f5783efa5ee319c4c5a861a5752b0c55894be786b9a7230c0af5c5624cf99ef14bc354ccb064
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.25.
|
5
|
-
avm (~> 0.39)
|
4
|
+
eac_tools (0.25.1)
|
5
|
+
avm (~> 0.39, >= 0.39.1)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.5)
|
7
7
|
avm-eac_generic_base0 (~> 0.5)
|
8
8
|
avm-eac_latex_base0 (~> 0.1, >= 0.1.2)
|
9
9
|
avm-eac_rails_base0 (~> 0.7)
|
10
10
|
avm-eac_rails_base1 (~> 0.5)
|
11
|
-
avm-eac_redmine_base0 (~> 0.
|
11
|
+
avm-eac_redmine_base0 (~> 0.13)
|
12
12
|
avm-eac_redmine_plugin_base0 (~> 0.3)
|
13
|
-
avm-eac_ruby_base1 (~> 0.
|
14
|
-
avm-eac_webapp_base0 (~> 0.
|
13
|
+
avm-eac_ruby_base1 (~> 0.20)
|
14
|
+
avm-eac_webapp_base0 (~> 0.5)
|
15
15
|
avm-eac_wordpress_base0 (~> 0.1, >= 0.1.2)
|
16
16
|
avm-tools (~> 0.133)
|
17
|
-
eac_ruby_utils (~> 0.
|
17
|
+
eac_ruby_utils (~> 0.102)
|
18
18
|
|
19
19
|
PATH
|
20
20
|
remote: sub/avm-eac_asciidoctor_base0
|
@@ -60,15 +60,15 @@ PATH
|
|
60
60
|
PATH
|
61
61
|
remote: sub/avm-eac_redmine_base0
|
62
62
|
specs:
|
63
|
-
avm-eac_redmine_base0 (0.
|
64
|
-
avm (~> 0.
|
63
|
+
avm-eac_redmine_base0 (0.13.0)
|
64
|
+
avm (~> 0.39, >= 0.39.1)
|
65
65
|
avm-eac_generic_base0 (~> 0.5)
|
66
66
|
avm-eac_rails_base1 (~> 0.5)
|
67
67
|
avm-eac_ubuntu_base0 (~> 0.3)
|
68
68
|
curb (~> 0.9, >= 0.9.11)
|
69
69
|
eac_fs (~> 0.12, >= 0.12.3)
|
70
70
|
eac_rest (~> 0.6, >= 0.6.1)
|
71
|
-
eac_ruby_utils (~> 0.
|
71
|
+
eac_ruby_utils (~> 0.102)
|
72
72
|
|
73
73
|
PATH
|
74
74
|
remote: sub/avm-eac_redmine_plugin_base0
|
@@ -80,20 +80,20 @@ PATH
|
|
80
80
|
PATH
|
81
81
|
remote: sub/avm-eac_ruby_base1
|
82
82
|
specs:
|
83
|
-
avm-eac_ruby_base1 (0.
|
84
|
-
avm (~> 0.
|
83
|
+
avm-eac_ruby_base1 (0.20.0)
|
84
|
+
avm (~> 0.39, >= 0.39.1)
|
85
85
|
avm-eac_generic_base0 (~> 0.5)
|
86
|
-
eac_ruby_utils (~> 0.
|
86
|
+
eac_ruby_utils (~> 0.102)
|
87
87
|
|
88
88
|
PATH
|
89
89
|
remote: sub/avm-eac_webapp_base0
|
90
90
|
specs:
|
91
|
-
avm-eac_webapp_base0 (0.
|
92
|
-
avm (~> 0.39)
|
91
|
+
avm-eac_webapp_base0 (0.5.0)
|
92
|
+
avm (~> 0.39, >= 0.39.1)
|
93
93
|
avm-eac_generic_base0 (~> 0.5)
|
94
94
|
avm-eac_postgresql_base0 (~> 0.2)
|
95
95
|
avm-eac_ubuntu_base0 (~> 0.3)
|
96
|
-
eac_ruby_utils (~> 0.
|
96
|
+
eac_ruby_utils (~> 0.102)
|
97
97
|
|
98
98
|
PATH
|
99
99
|
remote: sub/avm-eac_wordpress_base0
|
@@ -124,12 +124,12 @@ PATH
|
|
124
124
|
PATH
|
125
125
|
remote: sub/avm
|
126
126
|
specs:
|
127
|
-
avm (0.39.
|
127
|
+
avm (0.39.1)
|
128
128
|
eac_cli (~> 0.27, >= 0.27.8)
|
129
|
-
eac_config (~> 0.11)
|
129
|
+
eac_config (~> 0.11, >= 0.11.1)
|
130
130
|
eac_docker (~> 0.4, >= 0.4.2)
|
131
131
|
eac_git (~> 0.12, >= 0.12.2)
|
132
|
-
eac_ruby_utils (~> 0.
|
132
|
+
eac_ruby_utils (~> 0.102)
|
133
133
|
eac_templates (~> 0.3, >= 0.3.1)
|
134
134
|
filesize (~> 0.2)
|
135
135
|
htmlbeautifier (~> 1.4, >= 1.4.2)
|
@@ -146,9 +146,9 @@ PATH
|
|
146
146
|
PATH
|
147
147
|
remote: sub/eac_config
|
148
148
|
specs:
|
149
|
-
eac_config (0.11.
|
149
|
+
eac_config (0.11.1)
|
150
150
|
addressable (~> 2.8)
|
151
|
-
eac_ruby_utils (~> 0.
|
151
|
+
eac_ruby_utils (~> 0.102)
|
152
152
|
|
153
153
|
PATH
|
154
154
|
remote: sub/eac_docker
|
@@ -177,11 +177,11 @@ PATH
|
|
177
177
|
PATH
|
178
178
|
remote: sub/eac_ruby_utils
|
179
179
|
specs:
|
180
|
-
eac_ruby_utils (0.
|
180
|
+
eac_ruby_utils (0.102.0)
|
181
181
|
activesupport (>= 4, < 7)
|
182
|
-
addressable (~> 2.
|
182
|
+
addressable (~> 2.8)
|
183
183
|
bundler
|
184
|
-
filesize
|
184
|
+
filesize (~> 0.2)
|
185
185
|
net-ssh (~> 4.2)
|
186
186
|
|
187
187
|
GEM
|
@@ -280,7 +280,7 @@ GEM
|
|
280
280
|
concurrent-ruby (~> 1.0)
|
281
281
|
jaro_winkler (1.5.4)
|
282
282
|
minitar (0.9)
|
283
|
-
minitest (5.16.
|
283
|
+
minitest (5.16.3)
|
284
284
|
multipart-post (2.2.3)
|
285
285
|
net-ssh (4.2.0)
|
286
286
|
nokogiri (1.13.8-x86_64-linux)
|
@@ -361,4 +361,4 @@ DEPENDENCIES
|
|
361
361
|
eac_tools!
|
362
362
|
|
363
363
|
BUNDLED WITH
|
364
|
-
2.3.
|
364
|
+
2.3.20
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
15
|
s.add_dependency 'eac_cli', '~> 0.27', '>= 0.27.8'
|
16
|
-
s.add_dependency 'eac_config', '~> 0.11'
|
16
|
+
s.add_dependency 'eac_config', '~> 0.11', '>= 0.11.1'
|
17
17
|
s.add_dependency 'eac_docker', '~> 0.4', '>= 0.4.2'
|
18
18
|
s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.2'
|
19
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
19
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.102'
|
20
20
|
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.1'
|
21
21
|
s.add_dependency 'filesize', '~> 0.2'
|
22
22
|
s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -12,14 +12,14 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.39', '>= 0.39.1'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
|
17
17
|
s.add_dependency 'avm-eac_rails_base1', '~> 0.5'
|
18
18
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
19
19
|
s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
|
20
20
|
s.add_dependency 'eac_fs', '~> 0.12', '>= 0.12.3'
|
21
21
|
s.add_dependency 'eac_rest', '~> 0.6', '>= 0.6.1'
|
22
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
22
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.102'
|
23
23
|
|
24
24
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
25
25
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_webapp_base0/deploy'
|
4
|
+
require 'eac_ruby_utils/ruby'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRedmineBase0
|
8
|
+
module Instances
|
9
|
+
class Deploy < ::Avm::EacWebappBase0::Deploy
|
10
|
+
set_callback :assert_instance_branch, :after, :run_installer
|
11
|
+
|
12
|
+
def run_installer
|
13
|
+
infom 'Running installer'
|
14
|
+
::EacRubyUtils::Ruby.on_clean_environment do
|
15
|
+
installer_command.system!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def installer_command
|
20
|
+
instance.host_env.command(installer_path, install_task)
|
21
|
+
end
|
22
|
+
|
23
|
+
def installer_path
|
24
|
+
::File.join(instance.fs_path, 'plugins', 'redmine_installer', 'installer', 'run.sh')
|
25
|
+
end
|
26
|
+
|
27
|
+
def install_task
|
28
|
+
if instance.web_path_optional.present?
|
29
|
+
'redmine_as_apache_path'
|
30
|
+
else
|
31
|
+
'redmine_as_apache_base'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_redmine_base0/instances/base'
|
4
|
-
require 'avm/eac_redmine_base0/deploy'
|
4
|
+
require 'avm/eac_redmine_base0/instances/deploy'
|
5
5
|
require 'avm/eac_redmine_base0/apache_host'
|
6
6
|
require 'avm/eac_rails_base1/runner'
|
7
7
|
require 'eac_ruby_utils/core_ext'
|
File without changes
|
File without changes
|
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.39', '>= 0.39.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.102'
|
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'
|
@@ -11,6 +11,7 @@ module Avm
|
|
11
11
|
class UpdateDependenciesRequirements
|
12
12
|
runner_with :help do
|
13
13
|
bool_opt '-a', '--all'
|
14
|
+
arg_opt '-e', '--exclude', repeat: true
|
14
15
|
pos_arg :gem_name, repeat: true, optional: true
|
15
16
|
end
|
16
17
|
|
@@ -32,8 +33,13 @@ module Avm
|
|
32
33
|
|
33
34
|
private
|
34
35
|
|
36
|
+
def exclude?(gem_name)
|
37
|
+
parsed.exclude.include?(gem_name)
|
38
|
+
end
|
39
|
+
|
35
40
|
def gem_names_uncached
|
36
|
-
::Set.new(parsed.gem_name + gem_names_from_all).
|
41
|
+
::Set.new(parsed.gem_name + gem_names_from_all).reject { |gem_name| exclude?(gem_name) }
|
42
|
+
.sort
|
37
43
|
end
|
38
44
|
|
39
45
|
def gem_names_from_all
|
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.39'
|
15
|
+
s.add_dependency 'avm', '~> 0.39', '>= 0.39.1'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
|
17
17
|
s.add_dependency 'avm-eac_postgresql_base0', '~> 0.2'
|
18
18
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
19
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
19
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.102'
|
20
20
|
|
21
21
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
22
22
|
end
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
15
|
s.add_dependency 'addressable', '~> 2.8'
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.102'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_config/envvars_node'
|
4
|
+
require 'eac_ruby_utils/ruby'
|
4
5
|
|
5
6
|
RSpec.describe ::EacConfig::EnvvarsNode do
|
6
7
|
let(:instance) { described_class.new }
|
@@ -18,6 +19,16 @@ RSpec.describe ::EacConfig::EnvvarsNode do
|
|
18
19
|
it { expect(entry.value).to eq('AAA') }
|
19
20
|
it { expect(entry.found_node).to eq(instance) }
|
20
21
|
it { expect(entry).to be_found }
|
22
|
+
|
23
|
+
context 'with a clean ruby environment' do
|
24
|
+
let(:entry_value) do
|
25
|
+
::EacRubyUtils::Ruby.on_clean_environment do
|
26
|
+
entry.value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it { expect(entry_value).to eq('AAA') }
|
31
|
+
end
|
21
32
|
end
|
22
33
|
|
23
34
|
context 'with blank entry' do
|
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = Dir['{lib}/**/*', 'MIT-LICENSE', 'README.rdoc']
|
17
17
|
|
18
18
|
s.add_dependency 'activesupport', '>= 4', '< 7'
|
19
|
-
s.add_dependency 'addressable', '~> 2.
|
19
|
+
s.add_dependency 'addressable', '~> 2.8'
|
20
20
|
s.add_dependency 'bundler'
|
21
|
-
s.add_dependency 'filesize'
|
21
|
+
s.add_dependency 'filesize', '~> 0.2'
|
22
22
|
s.add_dependency 'net-ssh', '~> 4.2'
|
23
23
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
24
24
|
end
|
@@ -1,37 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'bundler'
|
4
|
+
require 'eac_ruby_utils/ruby/on_replace_objects'
|
4
5
|
|
5
6
|
module EacRubyUtils
|
6
7
|
module Ruby
|
7
8
|
class << self
|
8
9
|
# Executes a block in an environment when the variables BUNDLE* and RUBY* are removed.
|
9
|
-
def on_clean_environment
|
10
|
-
|
11
|
-
on_clean_envvars('BUNDLE', 'RUBY') { yield }
|
12
|
-
end
|
10
|
+
def on_clean_environment(&block)
|
11
|
+
OnCleanEnvironment.new(&block).perform
|
13
12
|
end
|
14
13
|
|
15
|
-
|
14
|
+
class OnCleanEnvironment
|
15
|
+
ENVVARS_PREFIXES_TO_CLEAN = %w[BUNDLE RUBY].freeze
|
16
|
+
|
17
|
+
attr_reader :block, :original_env
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
::
|
20
|
-
else
|
21
|
-
::Bundler.with_clean_env(&block)
|
19
|
+
def initialize(&block)
|
20
|
+
@block = block
|
21
|
+
@original_env = ::ENV.to_h
|
22
22
|
end
|
23
|
-
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
ensure
|
30
|
-
old_values&.each { |k, v| ENV[k] = v }
|
31
|
-
end
|
24
|
+
# @return [Array<String>]
|
25
|
+
def envvars_prefixes_to_clean
|
26
|
+
ENVVARS_PREFIXES_TO_CLEAN
|
27
|
+
end
|
32
28
|
|
33
|
-
|
34
|
-
|
29
|
+
def perform
|
30
|
+
bundler_with_unbundled_env do
|
31
|
+
on_clean_envvars
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def bundler_with_unbundled_env(&block)
|
38
|
+
with_bundler_modified do
|
39
|
+
::Bundler.send(bundler_with_env_method_name, &block)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def bundler_with_env_method_name
|
44
|
+
if ::Bundler.respond_to?(:with_unbundled_env)
|
45
|
+
:with_unbundled_env
|
46
|
+
else
|
47
|
+
:with_clean_env
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def clean_env
|
52
|
+
r = original_env.dup
|
53
|
+
r.delete_if { |k, _| envvars_prefixes_to_clean.any? { |prefix| k.start_with?(prefix) } }
|
54
|
+
r
|
55
|
+
end
|
56
|
+
|
57
|
+
def on_clean_envvars
|
58
|
+
::Bundler.send('with_env', clean_env) { block.call }
|
59
|
+
end
|
60
|
+
|
61
|
+
def with_bundler_modified(&block)
|
62
|
+
cloned_env = original_env.dup
|
63
|
+
::EacRubyUtils::Ruby.on_replace_objects do |replacer|
|
64
|
+
replacer.replace_self_method(::Bundler, :original_env) { cloned_env }
|
65
|
+
block.call
|
66
|
+
end
|
67
|
+
end
|
35
68
|
end
|
36
69
|
end
|
37
70
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/inflector'
|
4
|
+
require 'eac_ruby_utils/ruby/on_replace_objects/replace_instance_method'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Ruby
|
8
|
+
class OnReplaceObjects
|
9
|
+
class ReplaceInstanceMethod
|
10
|
+
attr_reader :a_module, :method_new_block, :original_method
|
11
|
+
|
12
|
+
def initialize(a_module, method_name, &method_new_block)
|
13
|
+
@a_module = a_module
|
14
|
+
@original_method = a_module.instance_method(method_name)
|
15
|
+
@method_new_block = method_new_block
|
16
|
+
end
|
17
|
+
|
18
|
+
def apply
|
19
|
+
a_module.define_method(method_name, &method_new_block)
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_name
|
25
|
+
original_method.name
|
26
|
+
end
|
27
|
+
|
28
|
+
def restore
|
29
|
+
a_module.define_method(method_name, original_method)
|
30
|
+
|
31
|
+
self
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/inflector'
|
4
|
+
require 'eac_ruby_utils/ruby/on_replace_objects/replace_instance_method'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Ruby
|
8
|
+
class << self
|
9
|
+
def on_replace_objects
|
10
|
+
replacer = OnReplaceObjects.new
|
11
|
+
replacer.on_replacement do
|
12
|
+
yield(replacer)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class OnReplaceObjects
|
18
|
+
def on_replacement(&block)
|
19
|
+
clear_replacements
|
20
|
+
block.call(self)
|
21
|
+
ensure
|
22
|
+
restore_replacements
|
23
|
+
end
|
24
|
+
|
25
|
+
def replace_instance_method(a_module, method_name, &block)
|
26
|
+
add_replacement(__method__, a_module, method_name, &block)
|
27
|
+
end
|
28
|
+
|
29
|
+
def replace_self_method(object, method_name, &block)
|
30
|
+
add_replacement(:replace_instance_method, object.singleton_class, method_name, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def add_replacement(method_name, *args, &block)
|
36
|
+
@replacements << replacement_class(method_name).new(*args, &block).apply
|
37
|
+
end
|
38
|
+
|
39
|
+
def replacement_class(method_name)
|
40
|
+
self.class.const_get(::ActiveSupport::Inflector.camelize(method_name))
|
41
|
+
end
|
42
|
+
|
43
|
+
def clear_replacements
|
44
|
+
@replacements = []
|
45
|
+
end
|
46
|
+
|
47
|
+
def restore_replacements
|
48
|
+
@replacements.reverse.each(&:restore)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{ruby_spec.rb → ruby/on_clean_environment_spec.rb}
RENAMED
@@ -6,9 +6,12 @@ RSpec.describe ::EacRubyUtils::Ruby do
|
|
6
6
|
describe '#on_clean_environment' do
|
7
7
|
let(:envvar_name) { 'BUNDLE_NOT_EXISTENT_ENV_VAR' }
|
8
8
|
let(:envvar_value) { 'any value' }
|
9
|
+
let(:noruby_envvar_name) { 'ANY_ENVIRONMENT_VARIABLE' }
|
10
|
+
let(:noruby_envvar_value) { 'another any value' }
|
9
11
|
|
10
12
|
before do
|
11
13
|
ENV[envvar_name] = envvar_value
|
14
|
+
ENV[noruby_envvar_name] = noruby_envvar_value
|
12
15
|
end
|
13
16
|
|
14
17
|
it do # rubocop:disable RSpec/MultipleExpectations
|
@@ -18,5 +21,13 @@ RSpec.describe ::EacRubyUtils::Ruby do
|
|
18
21
|
end
|
19
22
|
expect(ENV[envvar_name]).to eq(envvar_value)
|
20
23
|
end
|
24
|
+
|
25
|
+
it do # rubocop:disable RSpec/MultipleExpectations
|
26
|
+
expect(ENV[noruby_envvar_name]).to eq(noruby_envvar_value)
|
27
|
+
described_class.on_clean_environment do
|
28
|
+
expect(ENV[noruby_envvar_name]).to eq(noruby_envvar_value)
|
29
|
+
end
|
30
|
+
expect(ENV[noruby_envvar_name]).to eq(noruby_envvar_value)
|
31
|
+
end
|
21
32
|
end
|
22
33
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/ruby'
|
4
|
+
|
5
|
+
RSpec.describe ::EacRubyUtils::Ruby do
|
6
|
+
describe '#on_replace_objects' do
|
7
|
+
let(:stub_class) do
|
8
|
+
::Class.new do
|
9
|
+
def self.my_class_method
|
10
|
+
'Original'
|
11
|
+
end
|
12
|
+
|
13
|
+
def my_instance_method
|
14
|
+
'Original'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:stub_instance) { stub_class.new }
|
20
|
+
|
21
|
+
let(:replace_block) do
|
22
|
+
::Proc.new { 'Replaced' }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#my_instance_method' do
|
26
|
+
let(:before) { stub_instance.my_instance_method }
|
27
|
+
let(:inside) do
|
28
|
+
described_class.on_replace_objects do |replacer|
|
29
|
+
replacer.replace_instance_method(stub_class, :my_instance_method, &replace_block)
|
30
|
+
stub_instance.my_instance_method
|
31
|
+
end
|
32
|
+
end
|
33
|
+
let(:after) { stub_instance.my_instance_method }
|
34
|
+
|
35
|
+
before do
|
36
|
+
before
|
37
|
+
inside
|
38
|
+
after
|
39
|
+
end
|
40
|
+
|
41
|
+
it { expect(before).to eq('Original') }
|
42
|
+
it { expect(inside).to eq('Replaced') }
|
43
|
+
it { expect(after).to eq('Original') }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#replace_self_method' do
|
47
|
+
let(:before) { stub_class.my_class_method }
|
48
|
+
let(:inside) do
|
49
|
+
described_class.on_replace_objects do |replacer|
|
50
|
+
replacer.replace_self_method(stub_class, :my_class_method, &replace_block)
|
51
|
+
stub_class.my_class_method
|
52
|
+
end
|
53
|
+
end
|
54
|
+
let(:after) { stub_class.my_class_method }
|
55
|
+
|
56
|
+
before do
|
57
|
+
before
|
58
|
+
inside
|
59
|
+
after
|
60
|
+
end
|
61
|
+
|
62
|
+
it { expect(before).to eq('Original') }
|
63
|
+
it { expect(inside).to eq('Replaced') }
|
64
|
+
it { expect(after).to eq('Original') }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
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.25.
|
4
|
+
version: 0.25.1
|
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-08-
|
11
|
+
date: 2022-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.39'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.39.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0.39'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.39.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: avm-eac_asciidoctor_base0
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +112,14 @@ dependencies:
|
|
106
112
|
requirements:
|
107
113
|
- - "~>"
|
108
114
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0.
|
115
|
+
version: '0.13'
|
110
116
|
type: :runtime
|
111
117
|
prerelease: false
|
112
118
|
version_requirements: !ruby/object:Gem::Requirement
|
113
119
|
requirements:
|
114
120
|
- - "~>"
|
115
121
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0.
|
122
|
+
version: '0.13'
|
117
123
|
- !ruby/object:Gem::Dependency
|
118
124
|
name: avm-eac_redmine_plugin_base0
|
119
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,40 +140,28 @@ dependencies:
|
|
134
140
|
requirements:
|
135
141
|
- - "~>"
|
136
142
|
- !ruby/object:Gem::Version
|
137
|
-
version: '0.
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: 0.19.1
|
143
|
+
version: '0.20'
|
141
144
|
type: :runtime
|
142
145
|
prerelease: false
|
143
146
|
version_requirements: !ruby/object:Gem::Requirement
|
144
147
|
requirements:
|
145
148
|
- - "~>"
|
146
149
|
- !ruby/object:Gem::Version
|
147
|
-
version: '0.
|
148
|
-
- - ">="
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: 0.19.1
|
150
|
+
version: '0.20'
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: avm-eac_webapp_base0
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: '0.
|
158
|
-
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: 0.4.1
|
157
|
+
version: '0.5'
|
161
158
|
type: :runtime
|
162
159
|
prerelease: false
|
163
160
|
version_requirements: !ruby/object:Gem::Requirement
|
164
161
|
requirements:
|
165
162
|
- - "~>"
|
166
163
|
- !ruby/object:Gem::Version
|
167
|
-
version: '0.
|
168
|
-
- - ">="
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
version: 0.4.1
|
164
|
+
version: '0.5'
|
171
165
|
- !ruby/object:Gem::Dependency
|
172
166
|
name: avm-eac_wordpress_base0
|
173
167
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,14 +202,14 @@ dependencies:
|
|
208
202
|
requirements:
|
209
203
|
- - "~>"
|
210
204
|
- !ruby/object:Gem::Version
|
211
|
-
version: '0.
|
205
|
+
version: '0.102'
|
212
206
|
type: :runtime
|
213
207
|
prerelease: false
|
214
208
|
version_requirements: !ruby/object:Gem::Requirement
|
215
209
|
requirements:
|
216
210
|
- - "~>"
|
217
211
|
- !ruby/object:Gem::Version
|
218
|
-
version: '0.
|
212
|
+
version: '0.102'
|
219
213
|
- !ruby/object:Gem::Dependency
|
220
214
|
name: eac_ruby_gem_support
|
221
215
|
requirement: !ruby/object:Gem::Requirement
|
@@ -392,9 +386,9 @@ files:
|
|
392
386
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/apache_host.rb
|
393
387
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb
|
394
388
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/data_unit.rb
|
395
|
-
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/deploy.rb
|
396
389
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances.rb
|
397
390
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb
|
391
|
+
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb
|
398
392
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb
|
399
393
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners.rb
|
400
394
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/docker.rb
|
@@ -412,8 +406,8 @@ files:
|
|
412
406
|
- sub/avm-eac_redmine_base0/locale/pt-BR.yml
|
413
407
|
- sub/avm-eac_redmine_base0/spec/rubocop_spec.rb
|
414
408
|
- sub/avm-eac_redmine_base0/spec/spec_helper.rb
|
415
|
-
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/deploy/config/install.sh.template
|
416
|
-
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/deploy/config/secrets.yml
|
409
|
+
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/install.sh.template
|
410
|
+
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/secrets.yml
|
417
411
|
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template
|
418
412
|
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile_apache_setup
|
419
413
|
- sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_http_virtualhost.conf.template
|
@@ -1195,6 +1189,8 @@ files:
|
|
1195
1189
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/ruby.rb
|
1196
1190
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb
|
1197
1191
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb
|
1192
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_replace_objects.rb
|
1193
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_replace_objects/replace_instance_method.rb
|
1198
1194
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb
|
1199
1195
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb
|
1200
1196
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb
|
@@ -1252,7 +1248,8 @@ files:
|
|
1252
1248
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec.rb
|
1253
1249
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec/stubbed_module_a.rb
|
1254
1250
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec/stubbed_not_module.rb
|
1255
|
-
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/
|
1251
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby/on_clean_environment_spec.rb
|
1252
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby/on_replace_objects_spec.rb
|
1256
1253
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb
|
1257
1254
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb
|
1258
1255
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/eac_webapp_base0/deploy'
|
4
|
-
require 'eac_ruby_utils/ruby'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module EacRedmineBase0
|
8
|
-
class Deploy < ::Avm::EacWebappBase0::Deploy
|
9
|
-
set_callback :assert_instance_branch, :after, :run_installer
|
10
|
-
|
11
|
-
def run_installer
|
12
|
-
infom 'Running installer'
|
13
|
-
::EacRubyUtils::Ruby.on_clean_environment do
|
14
|
-
installer_command.system!
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def installer_command
|
19
|
-
instance.host_env.command(installer_path, install_task)
|
20
|
-
end
|
21
|
-
|
22
|
-
def installer_path
|
23
|
-
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), 'plugins',
|
24
|
-
'redmine_installer', 'installer', 'run.sh')
|
25
|
-
end
|
26
|
-
|
27
|
-
def install_task
|
28
|
-
if instance.read_entry_optional('web.path').present?
|
29
|
-
'redmine_as_apache_path'
|
30
|
-
else
|
31
|
-
'redmine_as_apache_base'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|