avm 0.92.0 → 0.94.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/entries/entry.rb +5 -0
- data/lib/avm/instances/base/auto_values/data.rb +5 -0
- data/lib/avm/instances/base/auto_values/source.rb +4 -1
- data/lib/avm/instances/base/production.rb +34 -0
- data/lib/avm/instances/base.rb +6 -0
- data/lib/avm/instances/data/loading_denied_error.rb +10 -0
- data/lib/avm/instances/data/unit.rb +10 -0
- data/lib/avm/instances/entry_keys.rb +1 -1
- data/lib/avm/launcher/context.rb +0 -5
- data/lib/avm/rspec/launcher_controller.rb +96 -0
- data/lib/avm/rspec/setup.rb +1 -1
- data/lib/avm/rspec/shared_examples/with_launcher.rb +16 -0
- data/lib/avm/scms/base.rb +1 -1
- data/lib/avm/sources/base/sub.rb +1 -1
- data/lib/avm/version.rb +1 -1
- data/template/avm/rspec/launcher_controller/dummy/avm-tools_stub/avm-tools.gemspec +29 -0
- data/template/avm/rspec/launcher_controller/dummy/avm-tools_stub/lib/avm/tools/version.rb +7 -0
- data/template/avm/rspec/launcher_controller/dummy/avm-tools_stub/lib/avm/tools.rb +6 -0
- data/template/avm/rspec/launcher_controller/dummy/ruby_gem_stub/lib/ruby_gem_stub/version.rb +5 -0
- data/template/avm/rspec/launcher_controller/dummy/ruby_gem_stub/lib/ruby_gem_stub.rb +3 -0
- data/template/avm/rspec/launcher_controller/dummy/ruby_gem_stub/ruby_gem_stub.gemspec +16 -0
- data/template/avm/rspec/launcher_controller/settings.yml +1 -0
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685447f38f30ac35c44b9863040c1159f9f6482d4b4f7da5371755bdeb07b60f
|
4
|
+
data.tar.gz: 4fa2fb246971340fddbab51a8d23256dc972442fb71e9d75bb141db6b10b3ab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5815972de0a71ee75afa4957c9467a2b7aa6ee2de7ed4f4f12f800bbb13d92c4ce2db3d255a135806ae72099fadad20ec42a9258ee2a9c69b1b853dfdab4c0a
|
7
|
+
data.tar.gz: 6a9d84303d007faa4d359d156f65a38c955f6fa3946d233a2bde65bf99ec846ac61c8f4bf307787e47020936b97ae61547826d611a4ece0939b569ec361e1133
|
data/lib/avm/entries/entry.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/applications/base/local_instance'
|
4
|
+
|
3
5
|
module Avm
|
4
6
|
module Instances
|
5
7
|
class Base
|
6
8
|
module AutoValues
|
7
9
|
module Source
|
8
10
|
def auto_source_instance_id
|
9
|
-
|
11
|
+
[application.id, ::Avm::Applications::Base::LocalInstance::LOCAL_INSTANCE_SUFFIX]
|
12
|
+
.join('_')
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'addressable'
|
4
|
+
require 'avm/instances/entry_keys'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Instances
|
8
|
+
class Base
|
9
|
+
module Production
|
10
|
+
DEFAULT_PRODUCTION = true
|
11
|
+
PRODUCTION_KEY = 'production'
|
12
|
+
|
13
|
+
# @return [Boolean]
|
14
|
+
def default_production?
|
15
|
+
DEFAULT_PRODUCTION
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Boolean]
|
19
|
+
def production?
|
20
|
+
if production_entry.found?
|
21
|
+
production_entry.value.to_bool
|
22
|
+
else
|
23
|
+
default_production?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Avm::Entries::Entry]
|
28
|
+
def production_entry
|
29
|
+
entry(PRODUCTION_KEY)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/avm/instances/base.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/instances/ids'
|
4
|
+
require 'avm/applications/base/local_instance'
|
4
5
|
require 'avm/with/application_stereotype'
|
5
6
|
require 'avm/with/extra_subcommands'
|
6
7
|
require 'eac_ruby_utils/require_sub'
|
@@ -61,6 +62,11 @@ module Avm
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
65
|
+
# @return [Boolean]
|
66
|
+
def local?
|
67
|
+
suffix == ::Avm::Applications::Base::LocalInstance::LOCAL_INSTANCE_SUFFIX
|
68
|
+
end
|
69
|
+
|
64
70
|
private
|
65
71
|
|
66
72
|
def source_instance_uncached
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/data/unit_with_commands'
|
4
|
+
require 'avm/instances/data/loading_denied_error'
|
4
5
|
require 'eac_ruby_utils/core_ext'
|
5
6
|
|
6
7
|
module Avm
|
@@ -9,6 +10,14 @@ module Avm
|
|
9
10
|
class Unit < ::Avm::Data::UnitWithCommands
|
10
11
|
common_constructor :instance
|
11
12
|
|
13
|
+
# @return [void]
|
14
|
+
# @raise Avm::Instances::Data::Unit
|
15
|
+
def check_load_permission!
|
16
|
+
return if instance.data_allow_loading
|
17
|
+
|
18
|
+
raise ::Avm::Instances::Data::LoadingDeniedError, "Instance: #{instance}"
|
19
|
+
end
|
20
|
+
|
12
21
|
# @return [Pathname]
|
13
22
|
def data_default_dump_path
|
14
23
|
instance.data_default_dump_path.to_pathname.basename_sub('.*') do |b|
|
@@ -22,6 +31,7 @@ module Avm
|
|
22
31
|
end
|
23
32
|
|
24
33
|
def load(...)
|
34
|
+
check_load_permission!
|
25
35
|
instance.on_disabled_processes { super }
|
26
36
|
end
|
27
37
|
end
|
@@ -28,7 +28,7 @@ module Avm
|
|
28
28
|
{
|
29
29
|
'' => %w[name source_instance_id],
|
30
30
|
admin: URI_FIELDS + %w[api_key],
|
31
|
-
data: %w[default_dump_path],
|
31
|
+
data: %w[allow_loading default_dump_path],
|
32
32
|
database: URI_FIELDS + %w[id limit name system timeout extra],
|
33
33
|
docker: %w[registry],
|
34
34
|
install: URI_FIELDS + %w[id data_path email groupname],
|
data/lib/avm/launcher/context.rb
CHANGED
@@ -78,11 +78,6 @@ module Avm
|
|
78
78
|
send("default_#{key}".underscore)
|
79
79
|
end
|
80
80
|
|
81
|
-
# @return [String]
|
82
|
-
def default_projects_root
|
83
|
-
'.'.to_pathname.expand_path.to_path
|
84
|
-
end
|
85
|
-
|
86
81
|
def default_settings_file
|
87
82
|
::File.join(::EacFs::Contexts.config.current.path, 'launcher.yaml')
|
88
83
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/launcher/context'
|
4
|
+
require 'eac_config/node'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'ruby-progressbar'
|
8
|
+
require 'tmpdir'
|
9
|
+
|
10
|
+
module Avm
|
11
|
+
module Rspec
|
12
|
+
class LauncherController
|
13
|
+
attr_accessor :remotes_dir
|
14
|
+
|
15
|
+
# @param application_id [String]
|
16
|
+
# @param path [Pathname]
|
17
|
+
# @return void
|
18
|
+
def application_source_path(application_id, path)
|
19
|
+
EacConfig::Node.context.current.entry("#{application_id}_dev.install.path").value =
|
20
|
+
path.to_pathname.to_path
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param settings_path [Pathname]
|
24
|
+
# @param projects_root [Pathname]
|
25
|
+
def context_set(settings_path, projects_root)
|
26
|
+
Avm::Launcher::Context.current = Avm::Launcher::Context.new(
|
27
|
+
settings_file: settings_path.to_pathname.to_path,
|
28
|
+
cache_root: Dir.mktmpdir
|
29
|
+
)
|
30
|
+
self.projects_root = projects_root
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Pathname]
|
34
|
+
def default_settings_path
|
35
|
+
templates_directory.join('settings.yml')
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Pathname]
|
39
|
+
def dummy_directory
|
40
|
+
templates_directory.join('dummy')
|
41
|
+
end
|
42
|
+
|
43
|
+
# @param settings_path [Pathname]
|
44
|
+
def temp_context(settings_path)
|
45
|
+
context_set(settings_path, Dir.mktmpdir)
|
46
|
+
end
|
47
|
+
|
48
|
+
def init_remote(name)
|
49
|
+
require 'avm/git/launcher/base'
|
50
|
+
r = Avm::Git::Launcher::Base.new(File.join(remotes_dir, name))
|
51
|
+
r.init_bare
|
52
|
+
r
|
53
|
+
end
|
54
|
+
|
55
|
+
def init_git(subdir)
|
56
|
+
require 'avm/git/launcher/base'
|
57
|
+
r = Avm::Git::Launcher::Base.new(File.join(projects_root, subdir))
|
58
|
+
r.git
|
59
|
+
r.execute!('config', 'user.email', 'theuser@example.net')
|
60
|
+
r.execute!('config', 'user.name', 'The User')
|
61
|
+
r
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Avm::Launcher::Context]
|
65
|
+
def new_context
|
66
|
+
Avm::Launcher::Context.new(
|
67
|
+
settings_file: default_settings_path,
|
68
|
+
cache_root: Dir.mktmpdir
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
# @param path [String]
|
73
|
+
def projects_root
|
74
|
+
@projects_root ||= Dir.mktmpdir
|
75
|
+
end
|
76
|
+
|
77
|
+
# @param path [Pathname]
|
78
|
+
def projects_root=(path)
|
79
|
+
@projects_root = path.to_pathname.to_path
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [Pathname]
|
83
|
+
def templates_directory
|
84
|
+
'../../../template/avm/rspec/launcher_controller'.to_pathname.expand_path(__dir__)
|
85
|
+
end
|
86
|
+
|
87
|
+
def touch_commit(repos, subpath)
|
88
|
+
require 'fileutils'
|
89
|
+
FileUtils.mkdir_p(File.dirname(repos.subpath(subpath)))
|
90
|
+
FileUtils.touch(repos.subpath(subpath))
|
91
|
+
repos.execute!('add', repos.subpath(subpath))
|
92
|
+
repos.execute!('commit', '-m', subpath)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/avm/rspec/setup.rb
CHANGED
@@ -9,7 +9,7 @@ module Avm
|
|
9
9
|
require_sub __FILE__
|
10
10
|
EXAMPLES = %w[avm_file_formats_with_fixtures avm_file_format_file_resource_name
|
11
11
|
avm_source_generated entries_values in_avm_registry not_in_avm_registry
|
12
|
-
with_config].freeze
|
12
|
+
with_config with_launcher].freeze
|
13
13
|
|
14
14
|
def self.extended(obj)
|
15
15
|
obj.setup_examples
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/rspec/launcher_controller'
|
4
|
+
|
5
|
+
RSpec.shared_context 'with_launcher' do
|
6
|
+
let(:launcher_controller) { Avm::Rspec::LauncherController.new }
|
7
|
+
|
8
|
+
before do
|
9
|
+
Avm::Launcher::Context.current = launcher_controller.new_context
|
10
|
+
launcher_controller.remotes_dir = Dir.mktmpdir
|
11
|
+
allow(ProgressBar).to receive(:create).and_return(double.as_null_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
delegate :application_source_path, :context_set, :init_git, :init_remote, :temp_context,
|
15
|
+
:projects_root, :projects_root=, :touch_commit, to: :launcher_controller
|
16
|
+
end
|
data/lib/avm/scms/base.rb
CHANGED
data/lib/avm/sources/base/sub.rb
CHANGED
data/lib/avm/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
# Maintain your gem's version:
|
6
|
+
require 'avm/tools/version'
|
7
|
+
|
8
|
+
# Describe your gem and declare its dependencies:
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.name = 'avm/tools'
|
11
|
+
s.version = Avm::Tools::VERSION
|
12
|
+
s.authors = ['Esquilo Azul Company']
|
13
|
+
s.summary = 'Utilities to deploy applications and libraries.'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = Dir['{exe,lib}/**/*', 'Gemfile', 'MIT-LICENSE', 'README.rdoc']
|
17
|
+
s.required_ruby_version = '>= 2.7.0'
|
18
|
+
s.bindir = 'exe'
|
19
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
|
21
|
+
s.add_dependency 'activesupport', '~> 4.2', '>= 4.2.10'
|
22
|
+
s.add_dependency 'colorize', '~> 0.8.1'
|
23
|
+
s.add_dependency 'curb', '~> 0.9.4'
|
24
|
+
s.add_dependency 'eac_rails_utils', '~> 0.1', '>= 0.1.14'
|
25
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.1'
|
26
|
+
s.add_dependency 'git', '~> 1.3.0'
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.7'
|
28
|
+
s.add_development_dependency 'rubocop', '~> 0.48.1'
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
# Maintain your gem's version:
|
6
|
+
require 'ruby_gem_stub/version'
|
7
|
+
|
8
|
+
# Describe your gem and declare its dependencies:
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.name = 'ruby_gem_stub'
|
11
|
+
s.version = RubyGemStub::VERSION
|
12
|
+
s.authors = ['Esquilo Azul Company']
|
13
|
+
s.summary = 'Ruby gem stub for tests.'
|
14
|
+
s.files = Dir['{lib}/**/*']
|
15
|
+
s.required_ruby_version = '>= 2.7.0'
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
--- {}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.94.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.42'
|
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.42'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: eac_config
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.18'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
74
|
+
version: '0.18'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: eac_ruby_utils
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +93,9 @@ dependencies:
|
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0.7'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 0.7.1
|
96
99
|
type: :runtime
|
97
100
|
prerelease: false
|
98
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -100,6 +103,9 @@ dependencies:
|
|
100
103
|
- - "~>"
|
101
104
|
- !ruby/object:Gem::Version
|
102
105
|
version: '0.7'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 0.7.1
|
103
109
|
- !ruby/object:Gem::Dependency
|
104
110
|
name: minitar
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,10 +263,12 @@ files:
|
|
257
263
|
- lib/avm/instances/base/entry_keys.rb
|
258
264
|
- lib/avm/instances/base/install.rb
|
259
265
|
- lib/avm/instances/base/processes.rb
|
266
|
+
- lib/avm/instances/base/production.rb
|
260
267
|
- lib/avm/instances/base/subcommand_parent.rb
|
261
268
|
- lib/avm/instances/base/web.rb
|
262
269
|
- lib/avm/instances/data.rb
|
263
270
|
- lib/avm/instances/data/files_unit.rb
|
271
|
+
- lib/avm/instances/data/loading_denied_error.rb
|
264
272
|
- lib/avm/instances/data/package.rb
|
265
273
|
- lib/avm/instances/data/unit.rb
|
266
274
|
- lib/avm/instances/docker_image.rb
|
@@ -317,6 +325,7 @@ files:
|
|
317
325
|
- lib/avm/registry/with_path/cache.rb
|
318
326
|
- lib/avm/result.rb
|
319
327
|
- lib/avm/rspec.rb
|
328
|
+
- lib/avm/rspec/launcher_controller.rb
|
320
329
|
- lib/avm/rspec/setup.rb
|
321
330
|
- lib/avm/rspec/setup/launcher.rb
|
322
331
|
- lib/avm/rspec/setup/source_generator.rb
|
@@ -327,6 +336,7 @@ files:
|
|
327
336
|
- lib/avm/rspec/shared_examples/in_avm_registry.rb
|
328
337
|
- lib/avm/rspec/shared_examples/not_in_avm_registry.rb
|
329
338
|
- lib/avm/rspec/shared_examples/with_config.rb
|
339
|
+
- lib/avm/rspec/shared_examples/with_launcher.rb
|
330
340
|
- lib/avm/runners/base.rb
|
331
341
|
- lib/avm/scms.rb
|
332
342
|
- lib/avm/scms/auto_commit.rb
|
@@ -399,6 +409,13 @@ files:
|
|
399
409
|
- lib/avm/with/extra_subcommands.rb
|
400
410
|
- locale/en.yml
|
401
411
|
- locale/pt-BR.yml
|
412
|
+
- template/avm/rspec/launcher_controller/dummy/avm-tools_stub/avm-tools.gemspec
|
413
|
+
- template/avm/rspec/launcher_controller/dummy/avm-tools_stub/lib/avm/tools.rb
|
414
|
+
- template/avm/rspec/launcher_controller/dummy/avm-tools_stub/lib/avm/tools/version.rb
|
415
|
+
- template/avm/rspec/launcher_controller/dummy/ruby_gem_stub/lib/ruby_gem_stub.rb
|
416
|
+
- template/avm/rspec/launcher_controller/dummy/ruby_gem_stub/lib/ruby_gem_stub/version.rb
|
417
|
+
- template/avm/rspec/launcher_controller/dummy/ruby_gem_stub/ruby_gem_stub.gemspec
|
418
|
+
- template/avm/rspec/launcher_controller/settings.yml
|
402
419
|
- template/avm/self/docker_image/Dockerfile
|
403
420
|
- template/avm/self/docker_image/entrypoint.sh
|
404
421
|
homepage:
|