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-2.9.0 lib/rubber/vagrant/config.rb
rubber-2.8.1 lib/rubber/vagrant/config.rb
rubber-2.8.0 lib/rubber/vagrant/config.rb
rubber-2.7.5 lib/rubber/vagrant/config.rb
rubber-2.7.4 lib/rubber/vagrant/config.rb
rubber-2.7.3 lib/rubber/vagrant/config.rb
rubber-2.7.2 lib/rubber/vagrant/config.rb
rubber-2.7.1 lib/rubber/vagrant/config.rb
rubber-2.7.0 lib/rubber/vagrant/config.rb
rubber-2.6.5 lib/rubber/vagrant/config.rb
rubber-2.6.4 lib/rubber/vagrant/config.rb
rubber-2.6.3 lib/rubber/vagrant/config.rb
rubber-2.6.2 lib/rubber/vagrant/config.rb
rubber-2.6.1 lib/rubber/vagrant/config.rb
rubber-2.6.0 lib/rubber/vagrant/config.rb
rubber-2.5.5 lib/rubber/vagrant/config.rb
rubber-2.5.4 lib/rubber/vagrant/config.rb
rubber-2.5.3 lib/rubber/vagrant/config.rb