I'm new to Ruby, so pardon my ignorance, but is there a way to load
rubygems and require additional libraries? For example, let's say I wanted
to assign %25 of the CPU cores to Vagrant. I need something that's
platform independent, I was thinking something like this:
require 'rubygems'
require 'facter'
Facter.loadfacts
config.vm.provider "virtualbox" do |v|
# Give VM 25% of system cpu cores
v.customize ["modifyvm", :id, "--cpus", [((Facter.processorcount) / 4
).to_i, 1].max ]
end
Any thoughts on how I can achieve this?
Thanks,
blong
On Thursday, March 20, 2014 6:28:39 PM UTC-4, Alvaro Miranda Aguilera wrote:
>
> in one Vagrantfile I found on github,. they use this.
>
> if RUBY_PLATFORM.include? 'linux'
> b.vm.network :bridged, :bridge => "eth0"
> elseif RUBY_PLATFORM.include? 'darwin'
> b.vm.network :bridged, :bridge => "en1: Wi-Fi (AirPort)"
> end
>
>
> I assume, you can check if there is a in/windows or something.
>
> Alvaro.
>
>
> On Fri, Mar 21, 2014 at 9:50 AM, Luis Mayorga <[email protected]
> <javascript:>> wrote:
>
>> This worked!!!
>>
>> if Gem.win_platform?
>>
>>
>> Thanks
>>
>>
>> On Thu, Mar 20, 2014 at 4:32 PM, Jeremy Voorhis <[email protected]
>> <javascript:>> wrote:
>>
>>> The Vagrantfile is just a Ruby file that gets evaluated within a special
>>> context that implements the Vagrant DSL. You can definitely execute
>>> arbitrary Ruby code to specialize your VM.
>>>
>>>
>>> On Thu, Mar 20, 2014 at 1:25 PM, Luis Mayorga <[email protected]
>>> <javascript:>> wrote:
>>>
>>>> I need to detect which platform is running vagrant. (We have vagrant
>>>> windows/mac users) and need to setup some initial variable values for some
>>>> of the configuration parameters.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Vagrant" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected] <javascript:>.
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Jeremy Voorhis
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Vagrant" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/vagrant-up/lhd9_WfySXo/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected] <javascript:>.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Vagrant" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.