Sha256: f8ea98bcf96fbeb0c56f10a8ad04c1554e34f607e32480f8c4c66e4296a73554

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

module VagrantPlugins
  module DockerComposeProvisioner
    class Config < Vagrant.plugin("2", :config)
      DEFAULT_COMMAND_OPTIONS = {
        rm: "--force",
        up: "-d"
      }

      attr_accessor :yml, :rebuild, :project_name, :executable_symlink_path, :executable_install_path, :compose_version, :options, :command_options

      def yml=(yml)
        files = yml.is_a?(Array) ? yml : [yml]
        files.each do |file|
          raise DockerComposeError, :yml_must_be_absolute if !Pathname.new(file).absolute?
        end
        @yml = yml
      end

      def initialize
        @project_name = UNSET_VALUE
        @compose_version = UNSET_VALUE
        @executable_symlink_path = UNSET_VALUE
        @executable_install_path = UNSET_VALUE
        @options = UNSET_VALUE
        @command_options = UNSET_VALUE
      end

      def finalize!
        @project_name = nil if @project_name == UNSET_VALUE
        @compose_version = "1.6.2" if @compose_version == UNSET_VALUE
        @executable_symlink_path = "/usr/local/bin/docker-compose" if @executable_symlink_path == UNSET_VALUE
        @executable_install_path = "#{@executable_symlink_path}-#{@compose_version}" if @executable_install_path == UNSET_VALUE
        @options = nil if @options == UNSET_VALUE
        @command_options = {} if @command_options == UNSET_VALUE
        @command_options = DEFAULT_COMMAND_OPTIONS.merge(@command_options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-docker-compose-1.0.0 lib/vagrant-docker-compose/config.rb