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

时间:2013-06-28 13:47:33

标签: javascript linux node.js cakephp coffeescript

我正在尝试首次在Ubuntu 12.04上运行givenwhenthen节点模块,并且我已按照其网站here. <上的“正在运行的故事”标题下列出的设置说明进行操作/ p>

我已将任务test:acceptance添加到/~/node_modules/givenwhenthen/examples/中的cakefile中,如下所示:

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

当我从同一目录运行cake时,我会列出以下路径:

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,我根本看不到“可用任务”部分。这应该列在这里吗?

当我从此目录运行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文件的新手,所以我担心这对我来说是一个新手的错误。我试图从错误的目录编译?我错过了一些明显的东西吗?

1 个答案:

答案 0 :(得分:2)

这些不是你要找的蛋糕

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

这意味着您正在运行CakePHP's cake cli

When I run cake test:acceptance ...

此语法表示您尝试运行coffeescript cake命令(两个命令的语法不同)。您可以通过运行来验证您正在调用哪个命令:

which cake

修复路径

猜测/usr/share/php/cakephp/lib/Cake/Console在您的路径中,这意味着当您键入cake没有路径时,它会找到CakePHP的蛋糕脚本。最好纠正你的$PATH删除CakePHP,从而避免歧义。

运行coffeescript's cake

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

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

或者,一旦您的$PATH正确并且由于coffeescript默认在系统范围内安装它,您可以在没有路径的情况下使用它:

$ cake test:acceptance

运行CakePHP的蛋糕

如果你想运行 CakePHP 的cli(在你没有的问题中) - 在app文件夹中这样做,并使用相对路径:

$ cd /my/app
$ Console/cake

此命令仅在您的app文件夹中有效,并且不依赖于您的$PATH

如果有疑问,请使用可执行文件的绝对路径,但如果您正在使用CakePHP和coffeescript,并且完全不同且不兼容,则会认识到有两个脚本名为cake因此,将可接受的论点从一个传递给另一个将完全无法工作。

相关问题