简体   繁体   中英

CHEF >> rails command , cookbook, recipe

I am having trouble with cookbook and rails... so this is my latest code...I already installed 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!

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.

You can use gem_package to install the rails gem to the default system 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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