简体   繁体   English

首席>> rails命令,食谱,食谱

[英]CHEF >> rails command , cookbook, recipe

I am having trouble with cookbook and rails... so this is my latest code...I already installed ruby... 我在食谱和滑轨方面遇到麻烦...所以这是我的最新代码...我已经安装了ruby ...

on my cookbook, 在我的菜谱上

bash "rails" do
 user "root"
 code <<-EOH gem install rails --no-ri --no-rdoc" EOH
end

bash "create myapp dir" do
 code <<-EOH
 rails new myapp
 EOH
end

help rails new myapp isnt working! 帮助rails新的myapp无法正常工作!

Try and look for a Chef resource or custom cookbook for doing things wherever possible. 尝试寻找厨师资源或自定义食谱以尽可能地做事。 It will make life easier than trying to write bash scripts or your own cookbooks to do everything. 比起尝试编写bash脚本或自己的食谱来完成所有任务,这将使生活更加轻松。

You can use gem_package to install the rails gem to the default system ruby: 您可以使用gem_packagerails gem安装到默认系统ruby:

gem_package "rails" do
  options   "--no-ri --no-rdoc"
  action    :install
end

When you do need to use the bash resource you usually need to tell it what directory to work in with cwd 当确实需要使用bash资源时 ,通常需要告诉它使用cwd目录

myapp = "thisapp"
bash "create #{myapp} dir" do
  cwd   "/your/app/path/#{myapp}"
  code  "rails new #{myapp}"
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM