Module: Freighthop
- Defined in:
- lib/freighthop.rb,
lib/freighthop/version.rb
Defined Under Namespace
Classes: CLI, Config, VagrantEnv
Constant Summary
collapse
- VERSION =
"0.6.1"
Class Method Summary
collapse
Class Method Details
.app_name ⇒ Object
27
28
29
|
# File 'lib/freighthop.rb', line 27
def app_name
@app_name ||= host_root.basename.to_s.gsub(/[_ ]/, '-')
end
|
.box_url ⇒ Object
45
46
47
48
49
50
51
|
# 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 ⇒ Object
66
67
68
|
# File 'lib/freighthop.rb', line 66
def cpus
Freighthop::Config.fetch('freighthop::cpus', 2)
end
|
.freighthop_root ⇒ Object
23
24
25
|
# File 'lib/freighthop.rb', line 23
def freighthop_root
Pathname(File.dirname(__FILE__)).join('..').expand_path
end
|
.guest_root ⇒ Object
19
20
21
|
# File 'lib/freighthop.rb', line 19
def guest_root
Pathname("/srv/#{app_name}")
end
|
.host_root ⇒ Object
15
16
17
|
# File 'lib/freighthop.rb', line 15
def host_root
Pathname.pwd
end
|
.hostname ⇒ Object
31
32
33
|
# File 'lib/freighthop.rb', line 31
def hostname
"#{app_name}.vagrant.dev"
end
|
.mounts ⇒ Object
53
54
55
56
57
58
59
60
|
# 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? ⇒ Boolean
37
38
39
40
41
42
43
|
# 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 ⇒ Object
62
63
64
|
# File 'lib/freighthop.rb', line 62
def provision_scripts
Freighthop::Config.fetch('freighthop::provision_scripts', [])
end
|
.ram ⇒ Object
70
71
72
|
# File 'lib/freighthop.rb', line 70
def ram
Freighthop::Config.fetch('freighthop::ram', 1024)
end
|
.vmware? ⇒ Boolean
11
12
13
|
# File 'lib/freighthop.rb', line 11
def vmware?
!!(defined? HashiCorp)
end
|