Class: VagrantNoneCommunicator::Communicator

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-none-communicator/communicator.rb

Overview

This class provides no communication with the VM

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine) ⇒ Communicator

Returns a new instance of Communicator.



11
12
13
14
# File 'lib/vagrant-none-communicator/communicator.rb', line 11

def initialize(machine)
  @machine = machine
  @logger  = Log4r::Logger.new("vagrant::plugin::communication::none")
end

Class Method Details

.match?(machine) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/vagrant-none-communicator/communicator.rb', line 6

def self.match?(machine)
  # All machines are capable of not communicating
  true
end

Instance Method Details

#download(from, to = nil) ⇒ Object



38
39
40
41
# File 'lib/vagrant-none-communicator/communicator.rb', line 38

def download(from, to=nil)
  @logger.debug("trying to download! Not acutally going to do it")
  true
end

#execute(command, opts = nil, &block) ⇒ Object



27
28
29
30
31
32
# File 'lib/vagrant-none-communicator/communicator.rb', line 27

def execute(command, opts=nil, &block)
  @logger.debug("trying to run command #{command}")
  @logger.debug("not actually going to do it!")
  # Good exit status
  return 0
end

#generate_environment_export(env_key, env_value) ⇒ Object



58
59
60
61
# File 'lib/vagrant-none-communicator/communicator.rb', line 58

def generate_environment_export(env_key, env_value)
  template = machine_config_ssh.export_command_template
  template.sub("%ENV_KEY%", env_key).sub("%ENV_VALUE%", env_value) + "\n"
end

#ready?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/vagrant-none-communicator/communicator.rb', line 21

def ready?
  @logger.debug("ready! not actually going to connect")
  # Always ready
  true
end

#reset!Object



53
54
55
56
# File 'lib/vagrant-none-communicator/communicator.rb', line 53

def reset!
  @logger.debug("trying to reset! Not acutally going to do it")
  true
end

#sudo(command, opts = nil, &block) ⇒ Object



34
35
36
# File 'lib/vagrant-none-communicator/communicator.rb', line 34

def sudo(command, opts=nil, &block)
  execute(command, opts, &block)
end

#test(command, opts = nil) ⇒ Object



43
44
45
46
# File 'lib/vagrant-none-communicator/communicator.rb', line 43

def test(command, opts=nil)
  @logger.debug("trying to test! Not acutally going to do it")
  execute(command, opts) == 0
end

#upload(from, to) ⇒ Object



48
49
50
51
# File 'lib/vagrant-none-communicator/communicator.rb', line 48

def upload(from, to)
  @logger.debug("trying to upload! Not acutally going to do it")
  true 
end

#wait_for_ready(timeout) ⇒ Object



16
17
18
19
# File 'lib/vagrant-none-communicator/communicator.rb', line 16

def wait_for_ready(timeout)
  @logger.debug("always ready, never connecting")
  true
end