当我想运行Coffeescript cake命令时,为什么最终运行CakePHP的cake命令?

我正在尝试在Ubuntu 12.04上首次运行给givenwhenthen节点模块,并按照其运行故事标题下列出的设置说明进行操作。

我已经在/~/node_modules/givenwhenthen/examples/添加了任务test:acceptance我的cakefile,如下所示:

 task 'test:acceptance', 'Runs the acceptance tests', (options = {}) -> givenwhenthen.runner.runStories(options) 

当我从同一个目录运行cake时,我得到如下path:

 CakePHP v2.2.2 Console App: examples Path: /home/kyoob/node_modules/givenwhenthen/examples/ Root: /home/kyoob/node_modules/givnwhenthen Core: /usr/share/php/cakephp/lib 

我没有看到test:acceptance “可用壳”下的test:acceptance ,我根本没有看到“可用任务”部分。 应该在这里列出吗?

当我运行cake test:acceptance从这个目录cake test:acceptance这里是我得到的消息:

 Shell class Test:acceptanceShell could not be found. #0 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(191): ShellDispatcher->_getShell('test:acceptance') #1 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch() #2 /usr/share/php/cakephp/lib/Cake/Console/cake.php(43): ShellDispatcher::run(Array) #3 {main} 

我已经尝试了和没有sudo相同的效果。 我是编译CoffeeScript文件的新手,所以我担心这是我的一个菜鸟错误。 我想从错误的目录编译? 我错过了什么明显的东西?

这些不是你要找的蛋糕

 When I run cake from that same directory I get the following paths listed: CakePHP v2.2.2 Console 

这意味着你正在运行CakePHP的cake cli 。

 When I run cake test:acceptance ... 

这个语法意味着你正在尝试运行coffeescript cake命令(这两个命令的语法是不一样的)。 您可以通过运行来validation您正在调用哪个命令:

 which cake 

修复你的path

在猜测/usr/share/php/cakephp/lib/Cake/Console在你的path中,这意味着当你input没有path的cake ,它会findCakePHP的Cake脚本。 最好纠正你的$PATH移除CakePHP,因此避免含糊不清。

运行coffeescript的蛋糕

当你想运行coffeescript cake命令时 – 使用coffeescript cake命令:

 $ /usr/local/bin/cake test:acceptance 

或者,一旦你的$PATH是正确的,因为默认情况下,coffeescript在系统范围内安装,你可以使用它没有path:

 $ cake test:acceptance 

运行CakePHP的蛋糕

如果你想运行CakePHP的cli(在你不这样做的问题中) – 在app文件夹中,使用相对path:

 $ cd /my/app $ Console/cake 

这个命令只有在你的应用程序文件夹中才有效,它不依赖于你的$PATH

如果有疑问,使用可执行文件的绝对path,但是如果您使用CakePHP和coffeescript,并且它们完全不同且不兼容 ,则会发现有两个名为cake的脚本,因此将可接受的参数从一个传递给另一个将不起作用。