【发布时间】:2011-10-17 02:52:43
【问题描述】:
所有,
在特定目录中创建一些文件后,我使用以下命令。它给我一条错误消息。
命令
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
错误
create aaaaaaa/views/index.slim
create aaaaaaa/views/layout.slim
run bundle install from "."
Could not locate Gemfile
我看到rails在初始化一个新项目时直接运行这个推荐bundle install,rails是怎么做到的?我如何使这个命令工作。
【问题讨论】:
-
系统命令是否从其他位置运行“cd /path_to_directory”?也许从 / 开始也许你应该尝试 cd 到一个绝对目录并检查它是否有效。
-
我已经编辑了我的问题以进行修复。我确定
cd的目录路径是正确的。