avm 0.13.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1fa3a6d770a4005a0006754cd253d522b6a9c521c3ca426fe69dc43118b4101
4
- data.tar.gz: 1aea6bae6db31d7bf6bd315eff95247ba5f2cb3886267d2aa6944a83d11b891f
3
+ metadata.gz: 59be9763f9939521d5a34ae5bcf81f0f3254c2af762c636b985be4446625a451
4
+ data.tar.gz: 0da41ea1af0c32847b3d87b2599b111a864416903324db9739f952e3397f812c
5
5
  SHA512:
6
- metadata.gz: b2c06a7e3a1ded1ad9a54152658f6c3a216994c26f2ddbad37b6e89e36381770f99f0dad61c8d543ed35daec3d26ba60c962450432d3e440a678b76f7cb95719
7
- data.tar.gz: fc40a815b2c8eaef9863ab25ef3fdd4fe919d38d73cca6f9d628692fdc0ecf906ffe0a53508192ed592ccbaf676a23545710071ddf2a74e7651021f2a588b5ff
6
+ metadata.gz: 4708d781a6096808e219b7faac09509e45d9256a555844ae02430abf12fc63bed126e4928f0352334fe79c9030aa23e086299d2c17cc1cd4432372ff315af41f
7
+ data.tar.gz: 1774e77a51d87c16e2f7ca0968626ded0302f708e1cae6516ab51f2195e32f858550143f9a23c54265ccb0da8587426bc72e89bc8e1a1b58de46edc365395f90
@@ -1,22 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/instances/entry_keys'
4
+
3
5
  module Avm
4
6
  module Instances
5
7
  class Base
6
8
  module AutoValues
7
9
  module Filesystem
8
- FS_PATH_KEY = :fs_path
9
-
10
10
  def auto_fs_path
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, FS_PATH_KEY) do |v|
12
- v + '/' + id
13
- end
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
12
+ ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
14
13
  end
15
14
 
16
15
  def auto_data_fs_path
17
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, :data_fs_path) do |v|
18
- v + '/' + id
19
- end
16
+ inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
17
+ ::Avm::Instances::EntryKeys::DATA_FS_PATH) { |v| v + '/' + id }
20
18
  end
21
19
 
22
20
  def auto_fs_url
@@ -42,7 +42,7 @@ module Avm
42
42
  end
43
43
 
44
44
  {
45
- '' => %w[fs_path host_id name source_instance_id],
45
+ '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
46
  database: %w[id hostname limit name password port system timeout username extra],
47
47
  docker: %w[registry],
48
48
  mailer: {
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Launcher
5
+ module Errors
6
+ class Base < ::StandardError
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/launcher/errors/base'
4
+
5
+ module Avm
6
+ module Launcher
7
+ module Errors
8
+ class NonProject < ::Avm::Launcher::Errors::Base
9
+ def initialize(path)
10
+ super("#{path} is not a project")
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Launcher
5
+ module Paths
6
+ class Real < String
7
+ def initialize(path)
8
+ raise "Argument path is not a string: \"#{path}\"|#{path.class}" unless path.is_a?(String)
9
+
10
+ super(path)
11
+ end
12
+
13
+ def subpath(relative_path)
14
+ ::Avm::Launcher::Paths::Real.new(::File.expand_path(relative_path, self))
15
+ end
16
+
17
+ def basename
18
+ ::File.basename(self)
19
+ end
20
+
21
+ def dirname
22
+ return nil if self == '/'
23
+
24
+ self.class.new(::File.dirname(self))
25
+ end
26
+
27
+ def find_file_with_extension(extension)
28
+ r = find_files_with_extension(extension)
29
+ return r.first if r.any?
30
+
31
+ raise "Extension \"#{extension}\" not found in directory \"#{self}\""
32
+ end
33
+
34
+ def find_files_with_extension(extension)
35
+ r = []
36
+ ::Dir.entries(self).each do |i|
37
+ r << ::File.expand_path(i, self) if i =~ /#{::Regexp.quote(extension)}\z/
38
+ end
39
+ r
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/concern' # Missing on "eac/listable"
4
+ require 'active_support/hash_with_indifferent_access'
5
+ require 'eac_ruby_utils/listable'
6
+
7
+ module Avm
8
+ module Launcher
9
+ module Publish
10
+ class CheckResult
11
+ include ::EacRubyUtils::Listable
12
+
13
+ lists.add_string :status, :updated, :pending, :blocked, :outdated
14
+
15
+ lists.status.values.each do |status| # rubocop:disable Style/HashEachMethods
16
+ class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
17
+ def self.#{status}(message)
18
+ new('#{status}', message)
19
+ end
20
+ RUBY_EVAL
21
+ end
22
+
23
+ class << self
24
+ def pending_status?(status)
25
+ [STATUS_PENDING].include?(status)
26
+ end
27
+
28
+ def updated_color
29
+ 'green'
30
+ end
31
+
32
+ def pending_color
33
+ 'yellow'
34
+ end
35
+
36
+ def blocked_color
37
+ 'red'
38
+ end
39
+
40
+ def outdated_color
41
+ 'light_blue'
42
+ end
43
+ end
44
+
45
+ attr_reader :status, :message
46
+
47
+ def initialize(status, message)
48
+ raise "Status \"#{status}\" not in #{self.class.lists.status.values}" unless
49
+ self.class.lists.status.values.include?(status)
50
+
51
+ @status = status
52
+ @message = message
53
+ end
54
+
55
+ def to_s
56
+ message.light_white.send("on_#{background_color}")
57
+ end
58
+
59
+ private
60
+
61
+ def background_color
62
+ self.class.send("#{status}_color")
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -3,7 +3,6 @@
3
3
  require 'avm/instances/base'
4
4
  require 'avm/self/docker_image'
5
5
  require 'avm/self/instance/entry_keys'
6
- require 'avm/eac_ubuntu_base0/docker_image'
7
6
 
8
7
  module Avm
9
8
  module Self
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/application'
4
+ require 'avm/instances/base'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ module Instance
10
+ DEFAULT_INSTANCE_SUFFIX = 'dev'
11
+
12
+ def instance_suffix
13
+ DEFAULT_INSTANCE_SUFFIX
14
+ end
15
+
16
+ private
17
+
18
+ def application_uncached
19
+ ::Avm::Instances::Application.new(path.basename)
20
+ end
21
+
22
+ def instance_uncached
23
+ ::Avm::Instances::Base.new(application, DEFAULT_INSTANCE_SUFFIX)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
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.13.0'
4
+ VERSION = '0.16.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.13.0
4
+ version: 0.16.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: 2021-12-14 00:00:00.000000000 Z
11
+ date: 2022-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -219,6 +219,10 @@ files:
219
219
  - lib/avm/jobs.rb
220
220
  - lib/avm/jobs/base.rb
221
221
  - lib/avm/jobs/variables_source.rb
222
+ - lib/avm/launcher/errors/base.rb
223
+ - lib/avm/launcher/errors/non_project.rb
224
+ - lib/avm/launcher/paths/real.rb
225
+ - lib/avm/launcher/publish/check_result.rb
222
226
  - lib/avm/path_string.rb
223
227
  - lib/avm/registry.rb
224
228
  - lib/avm/registry/base.rb
@@ -237,6 +241,7 @@ files:
237
241
  - lib/avm/sources.rb
238
242
  - lib/avm/sources/base.rb
239
243
  - lib/avm/sources/base/configuration.rb
244
+ - lib/avm/sources/base/instance.rb
240
245
  - lib/avm/sources/base/testing.rb
241
246
  - lib/avm/sources/configuration.rb
242
247
  - lib/avm/sources/configuration/_locale.rb