Class: Xanthus::VirtualMachine
- Inherits:
-
Object
- Object
- Xanthus::VirtualMachine
- Defined in:
- lib/xanthus/virtual_machine.rb
Instance Attribute Summary collapse
-
#box ⇒ Object
Returns the value of attribute box.
-
#cpu_cap ⇒ Object
Returns the value of attribute cpu_cap.
-
#cpus ⇒ Object
Returns the value of attribute cpus.
-
#gui ⇒ Object
Returns the value of attribute gui.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#memory ⇒ Object
Returns the value of attribute memory.
-
#name ⇒ Object
Returns the value of attribute name.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize ⇒ VirtualMachine
constructor
A new instance of VirtualMachine.
- #to_vagrant ⇒ Object
Constructor Details
#initialize ⇒ VirtualMachine
Returns a new instance of VirtualMachine.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/xanthus/virtual_machine.rb', line 12 def initialize @name = :default @box = 'jhcook/fedora27' @version = '4.13.12.300' @ip = '192.168.33.8' @memory = 4096 @cpus = 2 @cpu_cap = 70 @gui = false end |
Instance Attribute Details
#box ⇒ Object
Returns the value of attribute box.
4 5 6 |
# File 'lib/xanthus/virtual_machine.rb', line 4 def box @box end |
#cpu_cap ⇒ Object
Returns the value of attribute cpu_cap.
7 8 9 |
# File 'lib/xanthus/virtual_machine.rb', line 7 def cpu_cap @cpu_cap end |
#cpus ⇒ Object
Returns the value of attribute cpus.
6 7 8 |
# File 'lib/xanthus/virtual_machine.rb', line 6 def cpus @cpus end |
#gui ⇒ Object
Returns the value of attribute gui.
10 11 12 |
# File 'lib/xanthus/virtual_machine.rb', line 10 def gui @gui end |
#ip ⇒ Object
Returns the value of attribute ip.
9 10 11 |
# File 'lib/xanthus/virtual_machine.rb', line 9 def ip @ip end |
#memory ⇒ Object
Returns the value of attribute memory.
8 9 10 |
# File 'lib/xanthus/virtual_machine.rb', line 8 def memory @memory end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/xanthus/virtual_machine.rb', line 3 def name @name end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/xanthus/virtual_machine.rb', line 5 def version @version end |
Instance Method Details
#to_vagrant ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/xanthus/virtual_machine.rb', line 23 def to_vagrant %Q{ Vagrant.configure(2) do |config| config.vm.box = "#{@box}" config.vm.box_version = "#{@version}" config.vm.network "private_network", ip: "#{@ip}" config.vm.provider "virtualbox" do |vb| vb.gui = #{@gui} vb.memory = #{@memory} vb.customize ["modifyvm", :id, "--cpuexecutioncap", "#{@cpu_cap}"] vb.cpus = #{@cpus} vb.name = "#{@name}" end config.vm.provision "shell", path: "provision.sh" end } end |