Sha256: 89460bdb787c780acea4f2320c4a01b93a4ebdc684980b2f577a2a31386e9993

Contents?: true

Size: 1.13 KB

Versions: 96

Compression:

Stored size: 1.13 KB

Contents

require "vagrant"

module Vagrant
  module Spec
    class DummyProviderPlugin < Vagrant.plugin("2")
      name "Dummy Provider"
      description <<-EOF
      This creates a provider named "dummy" which does nothing, so that
      the unit tests aren't reliant on VirtualBox (or any other real
      provider for that matter).
      EOF

      provider(:dummy) { DummyProvider }
    end

    class DummyProvider < Vagrant.plugin("2", :provider)
      def initialize(machine)
        @machine = machine
      end

      def action(name)
        lambda do |env|
          # Do nothing
        end
      end

      def state=(id)
        state_file.open("w+") do |f|
          f.write(id.to_s)
        end
      end

      def state
        if !state_file.file?
          new_state = @machine.id
          new_state = Vagrant::MachineState::NOT_CREATED_ID if !new_state
          self.state = new_state
        end

        state_id = state_file.read.to_sym
        Vagrant::MachineState.new(state_id, state_id.to_s, state_id.to_s)
      end

      protected

      def state_file
        @machine.data_dir.join("dummy_state")
      end
    end
  end
end

Version data entries

96 entries across 29 versions & 2 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/unit/dummy_provider.rb