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.6.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/lib/vagrant-spec/unit/dummy_provider.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/lib/vagrant-spec/unit/dummy_provider.rb