avm 0.92.0 → 0.93.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15b1096b5fdec594a25fe5197312d72392f7e46fece8012263421f80f2d827a4
4
- data.tar.gz: 49250daa335c7484229ad130bcb978133a0891bd7b9d41793ae20b8f85668e39
3
+ metadata.gz: 2c1fee20bfe64a0b6d97f7866255914971859fb503ab18825eaf9be01a137aad
4
+ data.tar.gz: 964391eaa0ac606596e4aeb3b87ecd0c4ffcc1c78cadb86e98569e6ab660e06d
5
5
  SHA512:
6
- metadata.gz: fc2292dc7acbfbdef138d2e8a8c97e87f96f2e4947669c11f399f1fd3ab45b73f2808e43d29a9ed5fe24f320b61bf26876b7333cb9d1fd2c6ae50254ac2957d8
7
- data.tar.gz: 937555ba04232ed2364767d3420ccf4046096e5edeacfb378bb728afc7b296601ca97c94e739fd4fc7246dc306482af4980bb1a6cd0227cfa24ef2dc15cd59f6
6
+ metadata.gz: 03a07968e45e58c41fcf6a5aed935b78f116b51e4fc536c9cd408b316404d5f8ac24ae262bd1d77e584fda8ad62641a13062b529a859483895389ac7ca6db732
7
+ data.tar.gz: a1f51632e1d257cfbf50197c60bc9f8bd3acd18a9e136911387b12257b296373f72bf640de5b5cf09c187770ca47b0e3b8cf5a0b18efb264d0757893924c7db8
@@ -22,6 +22,11 @@ module Avm
22
22
  context_entry.found?
23
23
  end
24
24
 
25
+ # @return [Boolean]
26
+ def found?
27
+ context_found?
28
+ end
29
+
25
30
  def full_path
26
31
  (parent.path_prefix + suffix_as_array).join('.')
27
32
  end
@@ -18,6 +18,11 @@ module Avm
18
18
  )
19
19
  end
20
20
  end
21
+
22
+ # @return [Boolean]
23
+ def auto_data_allow_loading
24
+ local? || !production?
25
+ end
21
26
  end
22
27
  end
23
28
  end
@@ -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
- "#{application.id}_dev"
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
@@ -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
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Instances
5
+ module Data
6
+ class LoadingDeniedError < ::RuntimeError
7
+ end
8
+ end
9
+ end
10
+ end
@@ -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/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.92.0'
4
+ VERSION = '0.93.0'
5
5
  end
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.92.0
4
+ version: 0.93.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-05-29 00:00:00.000000000 Z
11
+ date: 2024-07-05 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.41'
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.41'
26
+ version: '0.42'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: eac_config
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -257,10 +257,12 @@ files:
257
257
  - lib/avm/instances/base/entry_keys.rb
258
258
  - lib/avm/instances/base/install.rb
259
259
  - lib/avm/instances/base/processes.rb
260
+ - lib/avm/instances/base/production.rb
260
261
  - lib/avm/instances/base/subcommand_parent.rb
261
262
  - lib/avm/instances/base/web.rb
262
263
  - lib/avm/instances/data.rb
263
264
  - lib/avm/instances/data/files_unit.rb
265
+ - lib/avm/instances/data/loading_denied_error.rb
264
266
  - lib/avm/instances/data/package.rb
265
267
  - lib/avm/instances/data/unit.rb
266
268
  - lib/avm/instances/docker_image.rb