Sha256: d32d0c2929bc6a00937dac874101bb427a6c8975eaaba61551083782b50071c7

Contents?: true

Size: 1.72 KB

Versions: 16

Compression:

Stored size: 1.72 KB

Contents

require 'dply/helper'
require 'dply/tasks'
require 'dply/setup'
require 'dply/config_downloader'
require 'dply/yum'
require 'dply/release'
require 'dply/release_helper'
require 'forwardable'


module Dply
  module Strategy
    class Base
      
      extend Forwardable
      include Helper

      attr_reader :config, :options
      def_delegators :config, :target, :branch, :revision, :name,
                     :config_map, :dir_map, :config_skip_download,
                     :config_download_url, :build_url
                
      def initialize(config, options)
        @config = config
        @options = options || {}
      end

      def deploy
        raise NotImplementedError
      end

      def reload
        raise NotImplementedError
      end

      def stop
        raise NotImplementedError
      end

      def reopen_logs
      end

      private

      def current_dir
        @current_dir ||= "#{config.dir}/current"
      end

      def download_configs
        files = config_map.values.uniq
        downloader = ConfigDownloader.new(files, config_download_url, dir: "config")
        downloader.skip_download = config_skip_download if config_skip_download
        downloader.download_all
      end

      def link_all
        link "#{config.dir}/shared", dir_map
        tasks.link "#{config.dir}/config", config_map
      end

      def link(source, map)
        return if not map
        logger.bullet "symlinking #{source}"
        dest = Dir.pwd
        linker = Linker.new(source, dest, map: map)
        linker.create_symlinks
      end

      def setup
        @setup ||= Setup.new(@config)
      end

      def tasks
        @tasks ||= Tasks.new
      end
    end

    class NotImplementedError < StandardError
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dply-0.3.15 lib/dply/strategy/base.rb
dply-0.3.14 lib/dply/strategy/base.rb
dply-0.3.13 lib/dply/strategy/base.rb
dply-0.3.12 lib/dply/strategy/base.rb
dply-0.3.11 lib/dply/strategy/base.rb
dply-0.3.10 lib/dply/strategy/base.rb
dply-0.3.9 lib/dply/strategy/base.rb
dply-0.3.8 lib/dply/strategy/base.rb
dply-0.3.7 lib/dply/strategy/base.rb
dply-0.3.6 lib/dply/strategy/base.rb
dply-0.3.5 lib/dply/strategy/base.rb
dply-0.3.4 lib/dply/strategy/base.rb
dply-0.3.3 lib/dply/strategy/base.rb
dply-0.3.2 lib/dply/strategy/base.rb
dply-0.3.1 lib/dply/strategy/base.rb
dply-0.3.0 lib/dply/strategy/base.rb