eac_tools 0.25.0 → 0.27.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 +57 -56
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/applications/base.rb +1 -1
- data/sub/avm/lib/avm/data/instance/files_unit.rb +2 -1
- data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +1 -1
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value/default_value.rb +27 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value/inherited_value.rb +38 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value/url_entry_value.rb +31 -0
- data/sub/avm/lib/avm/entries/base/uri_component_entry_value.rb +3 -30
- data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +0 -25
- data/sub/avm/lib/avm/instances/base/auto_values/install.rb +13 -17
- data/sub/avm/lib/avm/instances/entry_keys.rb +1 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +2 -2
- data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +1 -1
- data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/apache_host.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/deploy.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +3 -3
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +1 -1
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +1 -1
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +2 -2
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb +1 -1
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec.rb +1 -1
- data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_path_spec.rb +1 -1
- data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/apache_path/extra_content.conf +1 -1
- data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +4 -4
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/apache_host.rb +1 -1
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/base.rb +3 -2
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/log.rb +1 -1
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
- data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +3 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +1 -1
- 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/instances/docker_image.rb +1 -1
- 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/apache_path.rb +1 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/file_unit.rb +1 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/git_info.rb +1 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +1 -1
- 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/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +3 -3
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +1 -1
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
- data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb +1 -1
- data/sub/avm-tools/avm-tools.gemspec +3 -3
- data/sub/avm-tools/lib/avm/tools/runner/git/deploy.rb +2 -2
- data/sub/avm-tools/lib/avm/tools/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 +34 -52
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/deploy.rb +0 -36
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm-eac_rails_base1', '~> 0.
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm-eac_rails_base1', '~> 0.6'
|
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
|
@@ -44,7 +44,7 @@ module Avm
|
|
44
44
|
def touch_restart_file
|
45
45
|
infom 'Touching restart file...'
|
46
46
|
instance.host_env.command(
|
47
|
-
'touch', ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::
|
47
|
+
'touch', ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH),
|
48
48
|
'tmp', 'restart.txt')
|
49
49
|
).system!
|
50
50
|
end
|
@@ -11,7 +11,7 @@ RSpec.describe ::Avm::EacRailsBase0::ApacheHost do
|
|
11
11
|
let(:expected_content) { fixtures_dir.join('apache_host_spec_no_ssl_content.conf').read }
|
12
12
|
|
13
13
|
before do
|
14
|
-
instance.entry('
|
14
|
+
instance.entry('install.path').write('/path/to/stub-app_0')
|
15
15
|
instance.entry('web.url').write('http://stubapp.net')
|
16
16
|
end
|
17
17
|
|
@@ -12,7 +12,7 @@ RSpec.describe ::Avm::EacRailsBase0::ApachePath do
|
|
12
12
|
let(:expected_content) { expect_file.read }
|
13
13
|
|
14
14
|
before do
|
15
|
-
instance.entry(::Avm::Instances::EntryKeys::
|
15
|
+
instance.entry(::Avm::Instances::EntryKeys::INSTALL_PATH).write('/path/to/stub-app_0')
|
16
16
|
instance.entry('web.url').write('http://stubapp.net/stub-app_0')
|
17
17
|
end
|
18
18
|
|
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
16
|
-
s.add_dependency 'avm-eac_ruby_base1', '~> 0.
|
17
|
-
s.add_dependency 'avm-eac_webapp_base0', '~> 0.
|
18
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.41'
|
16
|
+
s.add_dependency 'avm-eac_ruby_base1', '~> 0.20'
|
17
|
+
s.add_dependency 'avm-eac_webapp_base0', '~> 0.6'
|
18
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.102'
|
19
19
|
|
20
20
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
21
21
|
end
|
@@ -6,7 +6,7 @@ module Avm
|
|
6
6
|
module EacRailsBase1
|
7
7
|
class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
|
8
8
|
def document_root
|
9
|
-
"#{instance.read_entry(::Avm::Instances::EntryKeys::
|
9
|
+
"#{instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)}/public"
|
10
10
|
end
|
11
11
|
|
12
12
|
def extra_content
|
@@ -18,8 +18,9 @@ module Avm
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def the_gem
|
21
|
-
@the_gem ||= ::Avm::EacRubyBase1::Sources::Base.new(
|
22
|
-
|
21
|
+
@the_gem ||= ::Avm::EacRubyBase1::Sources::Base.new(
|
22
|
+
::File.join(read_entry('install.path'))
|
23
|
+
).env_set(host_env)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -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.41'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
|
17
|
-
s.add_dependency 'avm-eac_rails_base1', '~> 0.
|
17
|
+
s.add_dependency 'avm-eac_rails_base1', '~> 0.6'
|
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
|
@@ -21,7 +21,7 @@ module Avm
|
|
21
21
|
def docker_run_arguments
|
22
22
|
[
|
23
23
|
'--volume',
|
24
|
-
"#{
|
24
|
+
"#{install_path}:/home/myuser/eac_redmine_base0",
|
25
25
|
'--publish', "#{read_entry(:ssh_port)}:22",
|
26
26
|
'--publish', "#{read_entry(:http_port)}:80",
|
27
27
|
'--publish', "#{read_entry(:https_port)}:443"
|
@@ -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.install_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.
|
15
|
+
s.add_dependency 'avm', '~> 0.41'
|
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
|
@@ -9,7 +9,7 @@ module Avm
|
|
9
9
|
def write_on_target
|
10
10
|
::Avm::Files::Deploy.new(
|
11
11
|
instance.host_env,
|
12
|
-
instance.read_entry(::Avm::Instances::EntryKeys::
|
12
|
+
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
13
13
|
).append_plain_directory(build_dir).run
|
14
14
|
end
|
15
15
|
end
|
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
16
|
-
s.add_dependency 'avm-eac_webapp_base0', '~> 0.
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.41'
|
16
|
+
s.add_dependency 'avm-eac_webapp_base0', '~> 0.6'
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.102'
|
18
18
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
|
20
20
|
end
|
data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb
CHANGED
@@ -13,7 +13,7 @@ RSpec.describe ::Avm::EacWordpressBase0::Instances::ApacheHost do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
before do
|
16
|
-
instance.entry(::Avm::Instances::EntryKeys::
|
16
|
+
instance.entry(::Avm::Instances::EntryKeys::INSTALL_PATH).write('/path/to/stub-app_0')
|
17
17
|
instance.entry(::Avm::Instances::EntryKeys::WEB_URL).write('http://stubapp.net')
|
18
18
|
instance.entry(::Avm::Instances::EntryKeys::INSTALL_USERNAME).write('myuser')
|
19
19
|
end
|
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
16
|
|
17
17
|
s.add_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.1'
|
18
|
-
s.add_dependency 'avm', '~> 0.
|
19
|
-
s.add_dependency 'avm-eac_ruby_base1', '~> 0.
|
18
|
+
s.add_dependency 'avm', '~> 0.41'
|
19
|
+
s.add_dependency 'avm-eac_ruby_base1', '~> 0.20'
|
20
20
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
21
21
|
s.add_dependency 'avm-files', '~> 0.3', '>= 0.3.2'
|
22
22
|
s.add_dependency 'avm-git', '~> 0.4'
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.2'
|
26
26
|
s.add_dependency 'eac_ruby_base0', '~> 0.16', '>= 0.16.6'
|
27
27
|
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.1'
|
28
|
-
s.add_dependency 'git', '~> 1.
|
28
|
+
s.add_dependency 'git', '~> 1.12'
|
29
29
|
s.add_dependency 'ruby-progressbar', '~> 1.11'
|
30
30
|
|
31
31
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
@@ -71,7 +71,7 @@ module Avm
|
|
71
71
|
def dev_instance_fs_path
|
72
72
|
instance.if_present do |v|
|
73
73
|
v.application.instance('dev').read_entry_optional(
|
74
|
-
::Avm::Instances::EntryKeys::
|
74
|
+
::Avm::Instances::EntryKeys::INSTALL_PATH
|
75
75
|
)
|
76
76
|
end
|
77
77
|
end
|
@@ -86,7 +86,7 @@ module Avm
|
|
86
86
|
|
87
87
|
def target_url
|
88
88
|
parsed.target_url.if_present { |v| return v }
|
89
|
-
instance.if_present { |v| return v.
|
89
|
+
instance.if_present { |v| return v.install_url }
|
90
90
|
nil
|
91
91
|
end
|
92
92
|
|
@@ -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
|