all,
I use the below command after creating some files in a specific directory. It gets me a error message.
The command
desc "new project_name", "new a project with a name"
def new(project_name = 'my_project')
directory 'doc', project_name
path = Dir.pwd + '/' + project_name
system("cd #{path}")
run('bundle install')
#But this command is working that makes me so confusing
#run("cd #{path} && bundle install")
#puts "Initializing complete"
end
The error
create aaaaaaa/views/index.slim
create aaaaaaa/views/layout.slim
run bundle install from "."
Could not locate Gemfile
I see the rails that runs this commend bundle install directly when it initializes a new project, how the rails can do that? how do i make this command working.
systemcreates a subprocess and then exits. The subprocess changed directory and then finished, but your script still thinks it’s in whatever working directory the process thinks it’s in.If you want to change the working directory of the process running the script, use
Dir.chdir().