Giter VIP home page Giter VIP logo

grunt-run's People

Contributors

cederigo avatar colmose avatar jbudz avatar jpangburn avatar kerimdzhanov avatar mido22 avatar shootaroo avatar spalger avatar spenceralger avatar yneves avatar zeevl 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

Watchers

 avatar  avatar  avatar  avatar

grunt-run's Issues

Still run :stop on fail?

If run:codecept fails it returns exit code 1, which I want so that my CI service knows it didn't pass, the remaining stop:xxx commands don't run it seems though or for some reason the php process is still running so the next time I run grunt test the port is still bound to. Can grunt-run return an error code from the run:codcept command? Is there a better way to do this maybe?

module.exports = function(grunt) {
    var phantomjs  = require('phantomjs');
    var phantombin = phantomjs.path;

    grunt.initConfig({
        run: {
            phantomjs: {
                options: {
                    wait: false,
                    quiet: true,
                    ready: /running on port/
                },
                cmd: phantombin,
                args: [
                    '--webdriver=4444'
                ],
            },
            codecept: {
                wait: true,
                quiet: false,
                cmd: "vendor/bin/codecept",
                args: [
                  'run'
                ],
            },
            artisan: {
              options: {
                wait: false,
                quiet: true,
                ready: /Laravel development server started/,
              },
              cmd: './artisan',
              args: [
                'serve'
              ],
            },
        },
    });

    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-run');

    grunt.registerTask('default', []);

    grunt.registerTask('test', ['run:phantomjs', 'run:artisan', 'run:codecept', 'stop:phantomjs', 'stop:artisan']);
};

Is there a way to capture the output of a script?

Hi,

I want to use your script to call git rev-parse HEAD and get the current commit hash in git, but I can't figure out how to use the return of the script inside of grunt.

is there a way to tell your plugin to record the output of the script into a grunt argument? like grunt.myCommitHash?

thanks

Unable to run .cmd file on MacOS spawn ENOENT Error

Hello,

I am not able to run a command file wich is in the same directory as my Gruntfile.
It shows the following error :
`Running "run:dev" (run) task

Error: spawn upload-livy.cmd ENOENT
Warning: non-zero exit code -2 Use --force to continue.

Aborted due to warnings.`

However, I am able to run directly the command in my Terminal. Do you have any idea of how I can solve this issue ?

Thanks,
Benjamin

grunt-run can't run protractor tests with protractor-flake

When trying to run protractor tests using grunt-run and protractor-flake, I'm facing the following:

Running "run:protractor-flake" (run) task
**you must either specify a configuration file or at least 3 options. See below for the options:

Usage: protractor [configFile] [options]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
See the reference config for a full list of options.

Options:
  --help                                 Print Protractor help menu
  --version                              Print Protractor version
  --browser, --capabilities.browserName  Browsername, e.g. chrome or firefox
  --seleniumAddress                      A running selenium address to use
  --seleniumSessionId                    Attaching an existing session id
...

Please, refer to the following issue for more details. This was first opened against protractor-flake, but they mentioned that it may be an issue with grunt-run: NickTomlin/protractor-flake#40

Broken ES5 compatibility

As of 1fce0ca grunt-run has lost ES5 compatibility.

Ideally we'd add a babel compile (or remove the string templating) to still support people stuck on old versions of node.

Background process hangs when logging a lot

I am facing a strange issue.

I start java process using grunt-run plugin putting it into background ({wait: true}) passing control to another task which talks to the first one over http. The first one starts logging lots of messages after a while, which causes everything to hang.

If I decrease logging level, then everything works fine.

It seems like a bug to me.

Thanks,
Marcin

CLI options and arguments

Cannot find a way of calling a command like so: tsc reinstall -roc

        run: {
          tsdInstall: {
            cwd: './resources/ts',
            cmd: './node_modules/typescript/bin/tsc',
            args: ['reinstall', '-ros']
          }
        },

failOnError doesn't seem to work

Hello!

According to the docs, the process should be killed on failOnError: true, and with wait: true the task should be failed, but I don't see this happening. (Nor do I actually saw any code related to this in run.js.)

// from a Gruntfile.js
        run: {
            t: {
                options: { failOnError: true, wait: true },
                args: ['t.js']
            },

# t.js
console.log("this goes to stdout ");
console.error(" this goes to stderr ");

And there is output on stderr:

pas@strange:~/$ node t.js  1>/dev/null
 this goes to stderr 

Yet

pas@strange:~/$ grunt run:t
Running "run:t" (run) task
this goes to stdout 
 this goes to stderr 

Done, without errors.

Luckily exit-code checking works wonderfully with wait.

Could you look into this?
Thanks.

the 'exec' option does not support paths with special characters

Example configuration which fails on Linux:

options: {
    failOnError: true
  },
  updateAllPackages: {
    exec: '/workspace/Some project name (branch 2.10)/updateAllPackages'
  }

It fails because the 'exec' value is not escaped with quotes here (while the Windows variant is):

    if (this.data.exec) {
      // logic is from node's cp.exec method, adapted to benefit from
      // streaming io
      if (process.platform === 'win32') {
        cmd = 'cmd.exe';
        args = ['/s', '/c', '"' + this.data.exec + '"'];
        spawnOpts.windowsVerbatimArguments = true;
      } else {
        cmd = '/bin/sh';
        args = ['-c', this.data.exec];
      }

Please change args = ['-c', this.data.exec]; to args = ['-c', '"' + this.data.exec + '"']; on row 112.

Second run cannot be stopped

I have got the following configuration and second stop doesn't stop the server, it prints >> server already stopped, which is not true.

After some debugging, I found that clearPid is invoked by proc.on('close' from within trackBackgroundProc

grunt-run: 0.5.1
node: 0.10.40

run: {
server: {
    args: ['server.js'],
    options: {
      cwd: 'site',
      wait: false,
      quiet: true,
      failOnError: true
    }
  }
}
  grunt.registerTask('one', function(){grunt.log.ok('First run')});
  grunt.registerTask('two', function(){grunt.log.ok('Second run')});

  grunt.registerTask('myrun', ['env:csa','run:server',
                               'one',
                               'stop:server',
                               'run:server',
                               'two',
                               'stop:server']);

Support for environment variables

Requesting support for environment variables when defining a target as shown below:

grunt.initConfig({
  run: {
    options: {
      // Task-specific options go here. 
    },
    your_target: {
      cmd: 'executable',
     env:{
       'NODE_ENV': 'production'
     },
      args: [
        'arg1',
        'arg2'
      ]
    }
  }
})

Update to grunt ~1.0.1

At the moment npm throws an error about unmet peer dependencies when using Grunt 1.x. This also means our CI breaks. Please update the grunt peer dependency ASAP so we can use this plugin with Grunt 1.0! Thanks!

How to change permission on executable from run?

From Grunt I want to execute a script as one of the tasks. I'm not interested in the status of the script. When I download the project first time from repository, the script has default permission of read only. On executing grunt task, i want to change the permission and run the file.

My Gruntfile.js looks like this:

run: {
options: {
// Task-specific options go here.
},
start_script: {
cmd: 'chmod +x some_script.sh && ./some_script.sh', <-- results in Error: spawn ENONT
// cmd: './some_script.sh', <-- results in Error: spawn EACCES
args: []
}
}

grunt.loadNpmTasks('grunt-run');

grunt.registerTask('install', ['run']);

Can you let me know if this is even possible? or cmd is used only to execute scripts that have write permissions?

Stopping a task from watch does not seem to work

When you try to stop a task in a watch when which was started before you get the following error:

Running "stop:server" (stop) task
Verifying property stop.server exists in config...ERROR
>> Unable to process task.
Warning: Required config property "stop.server" missing. Use --force to continue.

Aborted due to warnings.

This might be by design because watch starts a new grunt process or something, but i feel like it should work. Example grunt file:

module.exports = function (grunt) {
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    watch: {
      ts: {
        files: ['**/*.ts'],
        tasks: ['stop:server', 'build', 'run:server']
      }
    },

    run: {
      server: {
        options: {
          wait: false,
          ready: /.*Listening on port.*/ig
        },
        args: ['./dist/app/index.js'],
      }
    },

    ts: {
      src: {
        tsconfig: true
      }
    }
  });

  grunt.registerTask('build', ['clean', 'ts']);
  grunt.registerTask('serve', ['build', 'run:server', 'watch']);
}

Long console.log cut off

Trying to console.log a larger JSON object within the script I run, but the end keeps getting chopped off so I can't see the full result.

Is this supposed to happen by default?
Any workarounds to see full logs?

`cwd` is not implemented

line 44 :

var opts = this.options({ wait: true, failOnError: false, quite: false, ready: 1000, cwd: process.cwd(), passArgs: [], itterable: false });

Data may send to process.stderr rather process.stdout

For using regexp detecting process ready, the process data may send out into process.stderr.
For example, java -jar selenium-standalone.jar

need something like

proc.stderr.on('data', function checkForReady(chunk) {...})

cwd option not working

I tried a simple test task:

run: {
  cwd: 'some/sub/dir',
  cmd: 'pwd'
}

But it prints out the project's root directory, not the subdirectory.

Running redis-cli or mongo from Grunt with grunt-run

Hi,

I'm trying to run redis-cli or mongo from Grunt with the grunt-run module and it does not work.

Actually it seems to work but the applications are exiting right away.

I would like to run something like grunt mongo:staging and have access to the mongo prompt of our staging database.

Any idea if this is possible?

Thanks!

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.