module Freighthop

Constants

VERSION

Public Class Methods

app_name() click to toggle source
# File lib/freighthop.rb, line 27
def app_name
  @app_name ||= host_root.basename.to_s.gsub(/[_ ]/, '-')
end
box_url() click to toggle source
# File lib/freighthop.rb, line 45
def box_url
  if vmware?
    'http://files.vagrantup.com/precise64_vmware.box'
  else
    'http://files.vagrantup.com/precise64.box'
  end
end
cpus() click to toggle source
# File lib/freighthop.rb, line 66
def cpus
  Freighthop::Config.fetch('freighthop::cpus', 2)
end
freighthop_root() click to toggle source
# File lib/freighthop.rb, line 23
def freighthop_root
  Pathname(File.dirname(__FILE__)).join('..').expand_path
end
guest_root() click to toggle source
# File lib/freighthop.rb, line 19
def guest_root
  Pathname("/srv/#{app_name}")
end
host_root() click to toggle source
# File lib/freighthop.rb, line 15
def host_root
  Pathname.pwd
end
hostname() click to toggle source
# File lib/freighthop.rb, line 31
def hostname
  "#{app_name}.vagrant.dev"
end
mounts() click to toggle source
# File lib/freighthop.rb, line 53
def mounts
  Freighthop::Config.fetch('freighthop::mounts', []).map do |host, guest|
    [
      File.expand_path(host_root.join(host)),
      File.expand_path(guest_root.join(guest)),
    ]
  end
end
nfs?() click to toggle source

For now only use NFS on vmware to work around this issue: github.com/phinze/landrush/issues/17

# File lib/freighthop.rb, line 37
def nfs?
  if ENV.key? 'FREIGHTHOP_NFS'
    ['1','true','on'].include?(ENV['FREIGHTHOP_NFS'])
  else
    vmware?
  end
end
provision_scripts() click to toggle source
# File lib/freighthop.rb, line 62
def provision_scripts
  Freighthop::Config.fetch('freighthop::provision_scripts', [])
end
ram() click to toggle source
# File lib/freighthop.rb, line 70
def ram
  Freighthop::Config.fetch('freighthop::ram', 1024)
end
vmware?() click to toggle source
# File lib/freighthop.rb, line 11
def vmware?
  !!(defined? HashiCorp)
end