Merge branch 'master' of https://github.com/eaapa/vagrant-cachier into next
This commit is contained in:
commit
bae14ff303
3 changed files with 7 additions and 1 deletions
|
@ -27,6 +27,8 @@ Vagrant.configure("2") do |config|
|
||||||
config.cache.auto_detect = true
|
config.cache.auto_detect = true
|
||||||
# If you are using VirtualBox, you might want to enable NFS for shared folders
|
# If you are using VirtualBox, you might want to enable NFS for shared folders
|
||||||
# config.cache.enable_nfs = true
|
# config.cache.enable_nfs = true
|
||||||
|
# You can pass extra mount options, for example:
|
||||||
|
# config.cache.sync_opts = {:create = true}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Cachier
|
module Cachier
|
||||||
class Config < Vagrant.plugin(2, :config)
|
class Config < Vagrant.plugin(2, :config)
|
||||||
attr_accessor :scope, :auto_detect, :enable_nfs
|
attr_accessor :scope, :auto_detect, :enable_nfs, :sync_opts
|
||||||
attr_reader :buckets
|
attr_reader :buckets
|
||||||
|
|
||||||
ALLOWED_SCOPES = %w( box machine )
|
ALLOWED_SCOPES = %w( box machine )
|
||||||
|
@ -10,6 +10,7 @@ module VagrantPlugins
|
||||||
@scope = UNSET_VALUE
|
@scope = UNSET_VALUE
|
||||||
@auto_detect = UNSET_VALUE
|
@auto_detect = UNSET_VALUE
|
||||||
@enable_nfs = UNSET_VALUE
|
@enable_nfs = UNSET_VALUE
|
||||||
|
@sync_opts = UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable(bucket, opts = {})
|
def enable(bucket, opts = {})
|
||||||
|
@ -34,6 +35,7 @@ module VagrantPlugins
|
||||||
@scope = :box if @scope == UNSET_VALUE
|
@scope = :box if @scope == UNSET_VALUE
|
||||||
@auto_detect = false if @auto_detect == UNSET_VALUE
|
@auto_detect = false if @auto_detect == UNSET_VALUE
|
||||||
@enable_nfs = false if @enable_nfs == UNSET_VALUE
|
@enable_nfs = false if @enable_nfs == UNSET_VALUE
|
||||||
|
@sync_opts = {} if @sync_opts == UNSET_VALUE
|
||||||
@buckets = @buckets ? @buckets.dup : {}
|
@buckets = @buckets ? @buckets.dup : {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ module VagrantPlugins
|
||||||
FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist?
|
FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist?
|
||||||
|
|
||||||
synced_folder_opts = {id: "vagrant-cache"}
|
synced_folder_opts = {id: "vagrant-cache"}
|
||||||
|
synced_folder_opts.merge!(env[:machine].config.cache.sync_opts)
|
||||||
|
|
||||||
if env[:machine].config.cache.enable_nfs
|
if env[:machine].config.cache.enable_nfs
|
||||||
# REFACTOR: Drop the `nfs: true` argument once we drop support for Vagrant < 1.4
|
# REFACTOR: Drop the `nfs: true` argument once we drop support for Vagrant < 1.4
|
||||||
synced_folder_opts.merge!({ nfs: true, type: 'nfs' })
|
synced_folder_opts.merge!({ nfs: true, type: 'nfs' })
|
||||||
|
|
Loading…
Reference in a new issue