Skip to content

Instantly share code, notes, and snippets.

@jamiejackson
Last active August 29, 2015 14:07
Show Gist options
  • Save jamiejackson/39787215b5fc6ed22e7e to your computer and use it in GitHub Desktop.
Save jamiejackson/39787215b5fc6ed22e7e to your computer and use it in GitHub Desktop.
Bitness in Vagrant/Ruby
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def OS.unix?
!OS.windows?
end
def OS.linux?
OS.unix? and not OS.mac?
end
def OS.bitness
if unix?
( 1.size == 8 ) ? 64 : 32
else windows?
ENV.has_key?('ProgramFiles(x86)') ? 64 : 32
end
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# require 'rbconfig'
require './os'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
host_os_bitness = OS.bitness
if host_os_bitness == 64
railo_installer_download_url = "http://www.getrailo.org/railo/remote/download42/4.2.1.000/tomcat/linux/railo-4.2.1.000-pl2-linux-x64-installer.run"
else
railo_installer_download_url = "http://www.getrailo.org/railo/remote/download42/4.2.1.000/tomcat/linux/railo-4.2.1.000-pl2-linux-installer.run"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment