1

I'm trying to run the givenwhenthen node module on Ubuntu 12.04 for the first time and I've followed the instructions for setup listed under the "Running Stories" header on their site here.

I've added the task test:acceptance to my cakefile in /~/node_modules/givenwhenthen/examples/, like so:

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

When I run cake from that same directory I get the following paths listed:

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

I do not see test:acceptance under "Available Shells" and I don't see an "Available Tasks" section at all. Should that be listed here?

When I run cake test:acceptance from this directory here is the message I get:

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}

I've tried with and without sudo to the same effect. I am new to the world of compiling CoffeeScript files, so I fear this is a rookie mistake on my part. Am I trying to compile from the wrong directory? Have I missed something obvious?

4

1 回答 1

2

These are not the cakes you're looking for

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

This means that you're running CakePHP's cake cli.

When I run cake test:acceptance ...

This syntax means you're trying to run the coffeescript cake command (the syntax for both commands is not the same). You can verify which command you're calling by running:

which cake

Fix your paths

At a guess /usr/share/php/cakephp/lib/Cake/Console is in your path, and that means that when you type cake with no path it will find CakePHP's cake script. It's best to correct your $PATH removing CakePHP and therefore avoid ambiguity.

To run coffeescript's cake

When you want to run the coffeescript cake command - use the coffeescript cake command:

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

Or, once your $PATH is correct and since coffeescript installs it system-wide by default, you can just use it without a path:

$ cake test:acceptance

To run CakePHP's cake

If you want to run CakePHP's cli (in the question you do not) - do so in the app folder, with a relative path:

$ cd /my/app
$ Console/cake

This command will only work if you're in your app folder, it is not dependent on your $PATH.

If in doubt use absolute paths to the executables but recognise that there are two scripts named cake if you're using CakePHP and coffeescript and they are completely different and incompatible, so passing acceptable arguments from one to the other will quite simply never work.

于 2013-06-28T13:53:45.113 回答