kokarn / atom-grunt-runner

Run Grunt tasks from Atom.
MIT License
31 stars 23 forks source link

Add support to list all tasks in a multi task. #61

Closed DSpeckhals closed 8 years ago

DSpeckhals commented 9 years ago

Currently for multi tasks, all sub tasks are run. This request gives the option to select a subtask in addition to the whole multi task. See #1. This is my first shot at Coffeescript, so feel free to correct where necessary.

An example task that has the ability to define multiple sub tasks is grunt-contrib-requirejs. An example Gruntfile could could be:

module.exports = function(grunt) {
    "use strict";

    // Build configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        requirejs: {
            compile: {
                options: {
                    baseUrl: "js",
                    name: "main",
                    mainConfigFile: "js/app/js/main.js",
                    optimizeAllPluginResources: true,
                    paths: {
                        main: "app/js/main"
                    },
                    out: "js/dist/base.min.js"
                }
            },
            compileRetail: {
                options: {
                    baseUrl: "js",
                    name: "main",
                    mainConfigFile: "js/app/js/main-retail.js",
                    optimizeAllPluginResources: true,
                    paths: {
                        main: "app/js/main-retail"
                    },
                    out: "js/dist/retail.min.js"
                }
            }
        },
        jshint: {
            options: {
                jshintrc: true
            },
            all: ["js/app/js/**/*.js"]
        },
        jsdoc: {
            dist: {
                src: ["js/app/js/**/*.js", "README.md"],
                dest: "js/docs"
            }
        }
    });

    // Run the requirejs optimizer/build
    grunt.loadNpmTasks("grunt-contrib-requirejs");

    // Run jshint
    grunt.loadNpmTasks("grunt-contrib-jshint");

    // Build the documentation
    grunt.loadNpmTasks("grunt-jsdoc");

    // Register the default build task
    grunt.registerTask("default", ["jshint", "requirejs", "jsdoc"]);
};
kokarn commented 8 years ago

Can you test this against the latest master? Just to make sure it's still working.

DSpeckhals commented 8 years ago

I can do that within the next few days...I'll just have to dust it off a bit.

kokarn commented 8 years ago

Yeah no problem, anytime's fine

DSpeckhals commented 8 years ago

I rebased to your master, and it still works as expected. These are the parsed tasks that were returned in the above example:

I'm happy with the results.

ealves-pt commented 8 years ago

@DSpeckhals, @kokarn

I will merge this into the master and use it during the day. If everything is OK we can then release it. I will leave an update here by tomorrow morning.

Thanks for the PR :+1:

kokarn commented 8 years ago

Sounds good to me. Just ping me when you are satisfied it's working as intended

ealves-pt commented 8 years ago

Good for publish :+1:

kokarn commented 8 years ago

Live and published in 0.14.0 :+1: Thanks! <3