Git Product home page Git Product logo

jake's Introduction

jake's People

Contributors

andrzejsliwa avatar busticated avatar dependabot[bot] avatar der-on avatar elonmitchell avatar felix9 avatar fschwiet avatar isaacs avatar jinze avatar kevinji avatar krausvo1 avatar kwarismian avatar larzconwell avatar letladi avatar mblackshaw avatar mcandre avatar mde avatar miguelmadero avatar nibblebot avatar novemberborn avatar phanect avatar prabirshrestha avatar siranthony avatar timothygu avatar tomhughes avatar veldsla avatar vic avatar vmeurisse avatar welearnednothing avatar xiejw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jake's Issues

FileList require glob

an issue after upgrading jake. I am receiving this. I know this is not directly your issue from the description. How do you want me to handle this?

Error: FileList requires glob (https://github.com/isaacs/node-glob). Try npm install glob.
at /usr/local/lib/node_modules/jake/lib/api.js:66:15
(See full trace by running task with --trace)

"Could not load Jakefile"

➤ ls Jakefile*
Jakefile
➤ jake
Could not load Jakefile.
If no Jakefile specified with -f or --jakefile, jake looks for Jakefile.js in the current directory.
➤ jake -f Jakefile
Could not load Jakefile.
If no Jakefile specified with -f or --jakefile, jake looks for Jakefile.js in the current directory.
➤ mv Jakefile Jakefile.js
➤ jake
Could not load Jakefile.
➤ jake --version
0.1.5
➤ node --version
v0.3.0-pre

NPM package task

Create a new type of task, "NPM pacakge task," for creating/publishing an NPM package.

  1. Bump version if needed
  2. Create tag, push tag
  3. Publish to NPM

Anything else? @mikeal @foobarfighter

Incorrect determination of action running

With this Jakefile

var fs = require('fs');
var log = function() {
    console.log('Building ' + this.name);
}
var action = function() {
    log.call(this);
    fs.writeFileSync(this.name, '')
}

file('foo1', ['force'], action);
file('foo2', ['foo1'], action);
file('foo3', ['foo2'], log);

task('force');
task('default', ['foo3']);

Keep executing [email protected] on it. foo2 sometimes runs, sometimes doesn't. It appears to be random. The problem is Jake use > to compare mtime, but in reality if two files are modified too quickly, it's possible that their mtime diff is less than one sec.

Feature request: --tasks for specific namespace

I have a really huge Jakefile with over 100 tasks separated with different namespaces.

It would be very convenient to be able to show the tasks for specific namespace eg.

jake env --tasks

jake env:ssh:install # Install ssh.
jake env:ssh:uninstall # Uninstall ssh.
jake env:ssh:reinstall # Reinstall ssh.
jake env:git:install # Install git.
jake env:git:uninstall # Uninstall git.
jake env:git:reinstall # Reinstall git.

jake env:git --tasks

jake env:git:install # Install git.
jake env:git:uninstall # Uninstall git.
jake env:git:reinstall # Reinstall git.

What do you think?

/Johnny

--jakefile won't work with absolute path

I tried using absolute path for --jakefile but it seems that it only works with relative path.

Could you make it to work with absolute path too since I'm created a wrapper for Jake and want to no matter where I am in the filesystem be able to use the jakefile in /sys/Jakefile.js.

Regards

Johnny

require.paths usage exception on latest node build (v0.5.3-pre)

Using jake on the latest node build (v0.5.3-pre) causes the following exception:

node.js:195
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
    at Function.<anonymous> (module.js:360:11)
    at Object.<anonymous> (/usr/local/lib/node/.npm/jake/0.1.14/package/bin/cli.js:20:8)
    at Module._compile (module.js:420:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:335:31)
    at Function._load (module.js:294:12)
    at Array.<anonymous> (module.js:479:10)
    at EventEmitter._tickCallback (node.js:187:26)

Pass arguments to invoked tasks

I am calling a task with:

jake.Task['foo:bar'].invoke();

How do I pass arguments to it.

I tried with passing them in invoke() with no luck.

Add timeout for async prereqs

If an asynchronous prereq hangs, there should be some timeout for the continue() call, so the task doesn't wait for it indefinitely. This timeout should be configurable.

Task list cut off

Installed jake via npm and it seems to cut off after about 20 tasks every time I do jake -T. I know there are many more.

What's the rationale of supporting object literal as a task name?

After writing many jakefiles, I find myself rarely using object literal as a task name. Because javascript doesn't support dynamic keys, if a variable need to be the task name, "string+array" version is the only choice.

Since what you can do in the object literal version can also be done in the "string+array" version, it seems that the object literal version is redundant. Could I ask what's the rationale behind it?

Running execute() in a dependant task seems to cancel other dependencies.

First of all thankyou for this amazing tool :)

I've found that if you use the execute() method inside a dependency, the following dependencies will not run. I guess if you run execute then it returns the control to the parent task? Not sure.

To make testing easier here's a case where the behaviour is replicated:

desc('Default task');
task('default', ['task1', 'task2'], function() {
    console.log('Default task is a task that depends on task1 and task2. Since task1 calls execute.. task2 never happens.');
});

desc('task1 calls execute subtask');
task('task1', [], function() {
   jake.Task['subtask'].execute();
   //jake.Task['subtask'].execute.apply(jake.Task['subtask'], arguments); 
});

desc('task2 runs as a part of default deps');
task('task2', [], function() {
    console.log('If this works, then task1 didnt break the dependencies');
});

desc('subtask should break the flow when executed()');
task('subtask', [], function(){
   console.log('Executing subtask'); 
});

Be able to resolve FileList relative to a specific folder

It would be great if we could do something like this.

var list = new FileList;
list.include('foo-*');
list.include('bar-*');
console.log(list.toArray('folder'));

If folder/foo-foo and folder/bar-bar exist, this code would output ['foo-foo', 'bar-bar']

Parameters usage

Hi, I am trying to use jake for a project and doing some preliminary testing. I have a test_jake.js file where I'm trying various ways to get and display the input params , but I can't seem to get it to work : (disclaimer : I'm relatively new to Javascript)

cat test_jake.js
var sys = require('sys'),
util = require('util');

// task with pre-requisites
desc('This task has prerequisites.');
task({'hasPrereqs': ['foo', 'bar', 'baz']}, function (params) {
console.log('Ran foo, bar, baz prereqs.');
console.log('Got these params : ' + params);
console.log('Got these params : ' + util.inspect(arguments));
console.log('Got these params : ' + sys.inspect(arguments));
console.log('Got ' + arguments.length + ' parameters');
});
desc('This is the foo task.');
task('foo', function (params) {
console.log('doing foo.');
});
desc('This is the bar task.');
task('bar', function (params) {
console.log('doing bar.');
});
desc('This is the baz task.');
task('baz', function (params) {
console.log('doing baz.');
});

And run it as :

jake -f test_jake.js hasPrereqs[a,b,c]
doing foo.
doing bar.
doing baz.
Ran foo, bar, baz prereqs.
Got these params : undefined
Got these params : {}
Got these params : {}
Got 0 parameters

What am I doing wrong here ?
Thanks

log error when uncaughtException

Sometimes the uncaughtException is no stack,but we need print the log out either.

In lib/jake.js should change tis listener with more error log

process.addListener('uncaughtException', function (err) {
console.log('jake aborted.');
if (err.stack) {
console.log(err.stack);
}else{
console.log(err);
}
});

license

seems like nothing is mentioned about license.

File task depending on an async file task doesn't run

Create a qux file, then a foo file, run this Jakefile, and it outputs nothing.

file('foo', ['qux'], function() {
    console.log(1);
    complete();
}, true);

file('bar', ['foo'], function() {
    console.log(2);
});

task('default', ['bar']);

Add a way to pass params to node via the jake binary

This is probably ugly. I don't know how npm works or how rake does it, but ideally I would like to pass a --debug-brk param into jake.

Java uses -D to pass JVM system properties but it's probably better to emulate whatever rake does.

Example:

jake -Ddebug-brk foo:task

This should start up jake's node process in debugger mode.

Use exit codes?

It would be nice if the jake command would use exit codes: it always seems to return 0 on exit.

Exit codes would be really useful when automating the jake command from other places - e.g., a build system/ continuous integration system.

The fail function signature could also be altered to be (message, code).

And one other thing: could the fail command not throw an error but call 'die' like other parts of the code? The reason being I don't need a big call stack when I've called fail - I just need to know the message.

Thanks!

Coffeescript example doesn't work

The coffeescript example in the readme doesn't work. I create a Jakefile.coffee file with the following in it:

sys = require('sys')

desc 'This is the default task.'
task 'default', (params) ->
  console.log 'Ths is the default task.'
  console.log(sys.inspect(arguments))
  invoke 'new', []

task 'new', ->
  console.log 'ello from new'
  invoke 'foo:next', ['param']

namespace 'foo', ->
  task 'next', (param) ->
    console.log 'ello from next with param: ' + param

Then I runn jake in the same directory. This results in the following error: "ReferenceError: invoke is not defined"

I can't see how that sample would have ever worked, as there is nowhere in the code where invoke is defined as a global (unless I missed it). Did I miss a with somewhere?

Invoke exists on the Task object and can be used like the Javascript examples show. So the following Jakefile.coffee works:

sys = require('sys')

desc 'This is the default task.'
task 'default', (params) ->
  console.log 'Ths is the default task.'
  console.log(sys.inspect(arguments))
  jake.Task['new'].invoke()

task 'new', ->
  console.log 'ello from new'
  jake.Task['foo:next'].invoke ['param']

namespace 'foo', ->
  task 'next', (param) ->
    console.log 'ello from next with param: ' + param

Am I just missing something, or is the README wrong? If it is correct, what should I do to get it working?

don't show task if there is no description when using -T

All I want is to show "nuget:pack" when executing "jake -T". Rake does it right by not showing the task if there is no description. It would be great if jake would do the same. And working, working/NuGet those are directory tasks which is pretty useless to even devs who want to build it from source.

$ jake -T
jake working              # (No description)
jake working/NuGet        # (No description)
jake working/dist         # (No description)
jake working/dist/NuGet   # (No description)
jake default              # (No description)
jake vcs:hg               # (No description)
jake vcs:git              # (No description)
jake vcs:all              # (No description)
jake nuget:nuspec         # (No description)
jake nuget:pack           # Package nuget file

expected result should be: (a lot cleaner and meaningful)

$ jake -T
jake nuget:pack           # Package nuget file

Nested namespaces

Jake doesn't appear to support nested namespaces. For example I would expect following to have a task test:client:unit, instead Jake only lists client:test. Is this a feature people would be interested in seeing? It's obviously easy enough to work around but could be nice for organization.

namespace('test', function() {
    namespace('client', function() {
        task('unit', [], function() {
            ...
        });
    });
});

Task dependencies are run AFTER the task itself

As we all probably agree on the fact that dependencies are something that we should be able to depend upon while executing a task, they must of course be executed before the task in question; not after.

file doesn't work

I used your example:

file({'foo-minified.js': ['foo-bar.js', 'foo-baz.js']}, function () {

});

# jake --tasks

jake module:[object Object]  # (No description)

I can't run the task since it says module:[object Object]

Also. where is the foo-minified created? And where are the required files location?

Unable to run task with dependencies from console

$ cat Jakefile.js 
desc('elFinder default task')
task('default', function(){
  console.log('Nothing to do');
});

desc('This is the qwer task. It depends on default');
task({'qwer': ['default']}, function () {
  console.log('doing qwer task.');
});

$ jake qwer
jake aborted.
Error: Task "qwer" is not defined in the Jakefile.
    at /usr/local/lib/node_modules/jake/lib/jake.js:285:19
    at [object Object].populateAndProcessTaskList (/usr/local/lib/node_modules/jake/lib/jake.js:361:5)
    at [object Object].runTask (/usr/local/lib/node_modules/jake/lib/jake.js:374:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/jake/lib/jake.js:743:8)
    at Module._compile (module.js:402:26)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)
    at Array.<anonymous> (module.js:421:10)
    at EventEmitter._tickCallback (node.js:126:26)
$ jake -T
jake default          # elFinder default task
jake [object Object]  # This is the qwer task. It depends on default
$ jake -V
0.1.12
$ node -v
v0.4.9

What am I doing wrong?

prerequisites/params bug

when a task has prerequisites, we cannot pass parameters to it

for example :
task('foo', function (params) {
console.log('This is the foo task.');
});

task({'bar': ['foo']}, function (params) {
console.log('bar params:',params);
});

task({'baz': []}, function (params) {
console.log('baz params:',params);
});

jake 'baz[p]'
baz params: p

jake 'bar[p]'
This is the foo task.
bar params: undefined

File depending on a file which depends on a task will always be run

For this jakefile:

task('default', ['foo-file'], function() {});

file('foo-file', ['bar-file'], function() {
    console.log('building foo-file');
});

file('bar-file', ['force'], function() {
    console.log('building bar-file');
});

task('force', function() {});

If "bar-file" exists, "foo-file" will always be run nonetheless. I'm not sure it's a correct behavior. IMHO, though "bar-file" depends on a task, it shouldn't force other files to run if them depend on it.

My use case is this: "bar-file" is actually downloaded from the Internet, so it should always be run to check if a new version exists. If cached version is still fresh, however, it shouldn't cause the "foo-file" to rebuild itself.

BTW, can we make the callback parameter optional? task like "default" and "force" sometimes don't need a callback.

when calling an async task with Task.invoke, the calling task don't wait the called task to complete

this run is ok:

jake a
 async1
 async1: ok
 async2
 async2: ok
 a Ran some prereqs first.

in this run, async3 don't wait async1 to complete:

jake b
 async1
 async3
 async3: ok
 b Ran some prereqs first.
 async1: ok
task('async1', function () {
  console.log('async1');
  setTimeout(function() {console.log('async1: ok');complete()}, 2000);
}, true);

task({async2:['async1']}, function () {
  console.log('async2');
  setTimeout(function() {console.log('async2: ok');complete()}, 500);
}, true);

task('async3', function () {
  var t = jake.Task['async1'];
  t.invoke();
  console.log('async3');
  setTimeout(function() {console.log('async3: ok');complete()}, 500);
}, true);

task({'a': ['async2']}, function (params) {
  console.log('a Ran some prereqs first.');
});

task({'b': ['async3']}, function (params) {
  console.log('b Ran some prereqs first.');
});

add --debug in the cli.js

If we can run jake with node --debug mode,that would be nice!
Especially debug with node-inspector.
I change my cli.js (bin/jake) with hard code now.
#!/usr/bin/env node --debug

So... I post a issue here.

Give an example of file()?

Could you give an example (in the README) of how to use file() and why I would want to use it instead of task()?

Thanks

/Johnny

tasks dependency bug

I don't understand how the prerequesites of test2 are processed; outputs of test1 and test2 should be the same ???

task('c', function(code) {
        console.log(20);
});

task('b', function(template) {
        console.log(10);
        var t = jake.Task['c'];
        t.execute.call(t);
        console.log(11);
});

task('a', function() {
        var t = jake.Task['b'];
        console.log(1);
        t.execute.call(t);
        console.log(2);
        t.execute.call(t);
        console.log(3);
});

task({test1:[]}, function() {
    var t = jake.Task['a'];
    t.execute.call(t);
    console.log(100);
});

task({test2:['a']}, function() {
    console.log(100);
});

jake test1
1
10
20
11
2
10
20
11
3
100

jake test2
1
10
20
100
11
2
10
20
11
3

Handle Jakefile

Maybe it is a good idea to handle Jakefile along with Jakefile.js?

No way to pass parameters from one task to another with .invoke()?

In the CoffeeScript example, foo:next is invoked from new and passed a parameter:

task 'new', [], ->
  console.log 'ello from new'
  invoke 'foo:next', ['param']

namespace 'foo', ->
  task 'next', [], (param) ->
    console.log 'ello from next with param: ' + param

This doesn't seem to work in practice, though. I dug through the source a bit, and it appears the code to make it work as documented isn't in place:

jake.Task.prototype = new (function () {
  this.invoke = function () {
    jake.runTask(this.fullName, true);
  };
  //...
})();

Anyhow, there's a really good chance I'm missing something here, so please let me know if I'm just an idiot.

access file() name and dependencies

I would like to have something similar to that:

file({'foo/concat.txt': ['foo', 'foo/src0.txt', 'foo/src1.txt', 'foo/src2.txt']}, function() {
  console.log('doing ' + masterfile + ' file-task');
  var data = '';
  for (f in subfiles) {
    data += fs.readFileSync(subfiles[f]);
  }
  fs.writeFileSync(masterfile, data);
});

So I don't need to specify my files twice:
masterfile contains 'foo/concat.txt'
subfiles contains ['foo', 'foo/src0.txt', 'foo/src1.txt', 'foo/src2.txt']

`program.die` is not defined when trying to handle unsuccessful require of CoffeeScript

A simple jake -T with a Jakefile.coffee fails with the following output when CoffeeScript is not installed, because program.die is not available in loader.js:

jake aborted.
ReferenceError: program is not defined
at [object Object].load (/Users/rgabo/Code/mde/jake/lib/loader.js:56:9)
(See full trace by running task with --trace)

Moreover, the die function is not exported from the program.js module, so even if program was defined, program.die still wouldn't be.

jake --directory option with file()

How can I use file() construction with --directory? I want to use --directory to change build root, but my ffile() constructions stop working due to it can't find files:

desc('concat')
file({'test.txt': ['test-part1.txt', 'test-part2.txt']}, function(){
  console.log('concat ' + this.name);
});
$ jake test.txt
concat test.txt
$ jake --directory build test.txt
jake aborted.
Error: ENOENT, No such file or directory 'test-part1.txt'
    at Object.statSync (fs.js:400:18)
(See full trace by running task with --trace)

Is it okay to use dynamic paths in prereqs like path.join(__dirname, 'test-part1.txt')?

Task being depended on by a file doesn't run

In this Jakefile:

task('default', ['file-foo'], function() {});

file('file-foo', ['task-foo'], function() {
    console.log('building file-foo');
});

task('task-foo', [], function() {
    console.log('executing task-foo');
});

The second task doesn't run when using jake 0.1.11. Did I do something wrong or is it a bug?

Jake in Windows

Here is a workaround to get jake working in windows.
I'm using similar concept that rake.bat does with ruby in windows.

you need to create "jake.bat" in the same location as node.exe with the following contents.

@ECHO OFF
@"%~dp0node.exe" "%~dp0/node_modules/jake/bin/cli.js" %*

you can then call jake from command line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.