Sha256: 3aeeccd85be500aa843de78bd6d08b6b23af87f5e88ca59c664ca0a19f7c0784

Contents?: true

Size: 1.18 KB

Versions: 38

Compression:

Stored size: 1.18 KB

Contents

module VagrantPlugins
  module Rubber
    class Config < Vagrant.plugin("2", :config)
      attr_accessor :roles, :rubber_env, :use_vagrant_ruby, :rvm_ruby_version

      def initialize
        @roles = UNSET_VALUE
        @rubber_env = UNSET_VALUE
        @use_vagrant_ruby = UNSET_VALUE
        @rvm_ruby_version = UNSET_VALUE
      end

      def finalize!
        @rubber_env = 'vagrant' if @rubber_env == UNSET_VALUE
        @use_vagrant_ruby = false if @use_vagrant_ruby == UNSET_VALUE
        @rvm_ruby_version = nil if @rvm_ruby_version == UNSET_VALUE

        ::Rubber::initialize(Dir.pwd, @rubber_env)

        @roles = ::Rubber.config['staging_roles'] if @roles == UNSET_VALUE
      end

      def validate(machine)
        if @rubber_env.nil?
          return { 'rubber' => ['rubber_env must be set to the Rubber environment to use for this cluster'] }
        end

        unless [true, false].include?(@use_vagrant_ruby)
          return { 'rubber' => ['use_vagrant_ruby must be set to a Boolean value'] }
        end

        if @roles.nil?
          return { 'rubber' => ['roles must be set to a list of roles to use for this machine'] }
        end

        {}
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
rubber-3.2.2 lib/rubber/vagrant/config.rb
rubber-3.2.1 lib/rubber/vagrant/config.rb
rubber-3.2.0 lib/rubber/vagrant/config.rb
rubber-3.1.0 lib/rubber/vagrant/config.rb
rubber-3.0.1 lib/rubber/vagrant/config.rb
rubber-3.0.0 lib/rubber/vagrant/config.rb
rubber-2.16.0 lib/rubber/vagrant/config.rb
rubber-2.15.2 lib/rubber/vagrant/config.rb
rubber-2.15.1 lib/rubber/vagrant/config.rb
rubber-2.15.0 lib/rubber/vagrant/config.rb
rubber-2.14.0 lib/rubber/vagrant/config.rb
rubber-2.13.1 lib/rubber/vagrant/config.rb
rubber-2.13.0 lib/rubber/vagrant/config.rb
rubber-2.12.2 lib/rubber/vagrant/config.rb
rubber-2.12.1 lib/rubber/vagrant/config.rb
rubber-2.12.0 lib/rubber/vagrant/config.rb
rubber-2.11.0 lib/rubber/vagrant/config.rb
rubber-2.10.2 lib/rubber/vagrant/config.rb
rubber-2.10.1 lib/rubber/vagrant/config.rb
rubber-2.10.0 lib/rubber/vagrant/config.rb