Git Product home page Git Product logo

Comments (10)

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

We designed Drakov with an easy to use API, so it could be required directly as a node module.

I wouldn't mind throwing together a gulp plugin or assist someone else who might be interested in doing so.

Quoting our code snippet on using Drakov as a node module directly, you can easily setup it up like so:

var drakov = require('drakov');

var argv = {
    sourceFiles: 'path/to/files/**.md',
    serverPort: 3000,
    staticPaths: [
        '/path/to/static/files',
        '/another/path/to/static/files',
        '/path/to/more/files=/mount/it/here'
    ],
    stealthmode: true
};

drakov.run(argv);

As your gulp task should be running in a single thread, it should kill off Drakov after all your other tasks are finished.

All the available arguments that can be passed in can be found in the argument.js module of Drakov: https://github.com/Aconex/drakov/blob/master/lib/arguments.js

Let me know if you need more info, and I'm certainly happy to help with building a gulp plugin in a separate repository 👍

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

Just a note, you would need to npm install drakov --save-dev to have the above require work without using a relative path to it.

from drakov.

skawaguchi avatar skawaguchi commented on August 29, 2024

Oh, I see! I'll try that out.

The wrinkle with knowing when to kill Drakov is that we'd like to have it running as part of a suite of tools that we use while developing (Aglio, Karma, Protractor, a few Connect preview servers), and we'd like to manage these in as few gulp tasks as possible. It's going OK, but we need to give the whole thing a lot more love.

Anyhow, I'll let you know how it goes, and may take you up on the offer to help with a Gulp plugin if it's necessary.

Cheers!

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

@skawaguchi sounds interesting that things you guys are doing.

I think that perhaps we need to consider a more comprehensive, stop/run API for Drakov for these kind of use cases.

We have a grunt plugin that we made to run with Selenium and Protractor: https://github.com/Aconex/grunt-blueprint-test-runner, it's pretty rough, but does the job of interface testing for Angular UI's for us.

I'll keep you posted with any plugin development we undertake 👍

from drakov.

skawaguchi avatar skawaguchi commented on August 29, 2024

@yakovkhalinsky, I tried a very simple task to start, and it's erroring out with Segmentation fault: 11. Here's my code:

var gulp = require ( 'gulp' );
var drakov = require ( 'drakov' );

gulp.task ( 'drakov-server', function () {

  var argv = {
    sourceFiles: './api/output/my-api-file.md',
    serverPort: 5557
  };

  drakov.run(argv);

});

Here's the console output:

[gulp] Starting 'drakov-server'...

Bootstrapping    

[gulp] Finished 'drakov-server' after 3.2 ms
Segmentation fault: 11

Running this command with my global installation of drakov works fine:

drakov -f ./api/output/my-api-file.md --p 5557 

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

@skawaguchi which operating system are you running? I'll give this a go on my machine.

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

@skawaguchi Just tried it (Mac OS X 10.10.2) without issues.

The only thing I could think that might give a segfault is if protaganist, which compiles snowcrash didn't compile propertly in node_modules where you are running your gulp task.

from drakov.

skawaguchi avatar skawaguchi commented on August 29, 2024

I'm on OS X as well. 10.10.1. Is there a way to check if snowcrash compiled properly?

from drakov.

yakovkhalinsky avatar yakovkhalinsky commented on August 29, 2024

After a bit of discussion with @skawaguchi found the segfault to be caused by another module 👍

For anyone else who is interested in using Drakov with gulp, here's a snippet of code that start's and stops Drakov as an example of interacting with Drakov in gulp:

var gulp = require ( 'gulp' );
var drakov = require ( 'drakov' );

gulp.task ( 'drakov-server', function () {

    var argv = {
        sourceFiles: './api/output/my-api-file.md',
        serverPort: 3003
    };

    drakov.run(argv, function() {
        drakov.stop();
    });

});

from drakov.

skawaguchi avatar skawaguchi commented on August 29, 2024

For posterity, the problem was that I was loading in another API Blueprint tool called Aglio in my gulp tasks using requiredir. Strangely enough, including gulp-aglio outside of my export breaks Drakov:

// buildAPIDocs.js - this breaks Drakov
var aglio = require ( 'gulp-aglio' );
var gulp = require ( 'gulp' );
var include = require ( 'gulp-file-include' );

module.exports.task = function () {
  // gulp tasks declared here
};

Drakov works if I move Aglio into the export:

// buildAPIDocs.js
module.exports.task = function () {

  var aglio = require ( 'gulp-aglio' );
  var gulp = require ( 'gulp' );
  var include = require ( 'gulp-file-include' );

  // gulp tasks declared here

};

from drakov.

Related Issues (20)

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.