Sha256: 000ab0759762dbbc377d2aec8ba97f5b93b2aee2093cae3d24f266db20bd475c

Contents?: true

Size: 1.18 KB

Versions: 21

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Avm
  module Stereotypes
    module EacWebappBase0
      class Deploy
        class FileUnit < ::SimpleDelegator
          attr_reader :data_key, :fs_path_subpath

          def initialize(deploy, data_key, fs_path_subpath)
            super(deploy)
            @data_key = data_key
            @fs_path_subpath = fs_path_subpath
          end

          def run
            assert_source_directory
            link_source_target
          end

          def assert_source_directory
            infom "Asserting \"#{data_key}\" source directory..."
            instance.host_env.command('mkdir', '-p', source_path).execute!
          end

          def source_path
            ::File.join(instance.read_entry(:data_fs_path), data_key.to_s)
          end

          def target_path
            ::File.join(instance.read_entry(:fs_path), fs_path_subpath.to_s)
          end

          def link_source_target
            infom "Linking \"#{data_key}\" directory..."
            instance.host_env.command('rm', '-rf', target_path).execute!
            instance.host_env.command('ln', '-s', source_path, target_path).execute!
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
avm-tools-0.68.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.67.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.66.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.65.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.64.2 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.64.1 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.64.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.63.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.62.4 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.62.3 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.62.2 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.62.1 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.62.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.61.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.60.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.59.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.58.1 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.58.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.57.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
avm-tools-0.56.0 lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb