厨师:为模板创build一个目录,如果它尚不存在
如果我有一个模板被创build,我怎样才能确保该目录存在? 例如: template "#{node[:app][:deploy_to]}/#{node[:app][:name]}/shared/config/database.yml" do source 'database.yml.erb' owner node[:user][:username] group node[:user][:username] mode 0644 variables({ :environment => node[:app][:environment], :adapter => node[:database][:adapter], :database => node[:database][:name], :username => node[:database][:username], :password => node[:database][:password], :host => node[:database][:host] }) end 由于/var/www/example/shared/config不存在,因此database.yml将被复制到此目录中。 我在想如何木偶让你“确保”一个目录存在。