[Pkg-javascript-commits] [node-grunt-cli] 01/02: Import Upstream version 1.2.0

Tim Potter tpot at hpe.com
Wed Sep 21 03:45:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

tpot-guest pushed a commit to branch master
in repository node-grunt-cli.

commit c505c736e8cd5c93bdc37eb22e88eb5b26c58fcb
Author: Tim Potter <tpot at hpe.com>
Date:   Wed Sep 21 13:44:03 2016 +1000

    Import Upstream version 1.2.0
---
 .gitignore        |  3 +++
 .jshintrc         | 14 ++++++++++++++
 .travis.yml       |  7 +++++++
 AUTHORS           |  4 ++++
 CHANGELOG.md      | 24 ++++++++++++++++++++++++
 Gruntfile.js      | 37 +++++++++++++++++++++++++++++++++++++
 LICENSE-MIT       | 22 ++++++++++++++++++++++
 README.md         | 31 +++++++++++++++++++++++++++++++
 appveyor.yml      | 44 ++++++++++++++++++++++++++++++++++++++++++++
 bin/grunt         | 44 ++++++++++++++++++++++++++++++++++++++++++++
 completion/bash   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 completion/zsh    | 37 +++++++++++++++++++++++++++++++++++++
 lib/cli.js        | 33 +++++++++++++++++++++++++++++++++
 lib/completion.js | 34 ++++++++++++++++++++++++++++++++++
 lib/info.js       | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 package.json      | 33 +++++++++++++++++++++++++++++++++
 16 files changed, 467 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b785247
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+node_modules
+npm-debug.log
+tmp
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..7de190e
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,14 @@
+{
+  "boss": true,
+  "curly": true,
+  "eqeqeq": true,
+  "immed": true,
+  "latedef": true,
+  "newcap": true,
+  "noarg": true,
+  "node": true,
+  "strict": true,
+  "sub": true,
+  "undef": true,
+  "unused": true
+}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a78e23d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+sudo: false
+language: node_js
+node_js:
+  - '5'
+  - '4'
+  - '0.12'
+  - '0.10'
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..a9a3659
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,4 @@
+Tyler Kellen (http://goingslowly.com)
+Ben Alman (http://gruntjs.com)
+Scott González (http://nemikor.com)
+Forbes Lindesay (https://github.com/)
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..6d15119
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,24 @@
+- v1.2.0
+  - date: 2016-04-01
+  - changes:
+    - Use shared grunt-known-options module.
+- v1.1.0
+  - date: 2016-03-22
+  - changes:
+    - Update to "nopt": "~3.0.6".
+    - nopt is upgraded to ~3.0.6 which has fixed many issues, including passing multiple arguments and dealing with numbers as options.
+      Be aware previously --foo bar used to pass the value 'bar' to the option foo. It will now set the option foo to true and run the task bar.
+- v1.0.1
+  - date: 2016-03-22
+  - changes:
+    - Revert to "nopt": "~1.0.10" due to issues with the update.
+- v1.0.0
+  - date: 2016-03-21
+  - changes:
+    - Update dev deps
+    - Update error message when Gruntfile is not found
+- v1.0.0-rc1
+  - date: 2016-02-11
+  - changes:
+    - Update findup-sync and other deps
+    - remove prefer global warning
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..5270fb7
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,37 @@
+/*
+ * grunt-cli
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2016 Tyler Kellen, contributors
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt-init/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+  // Project configuration.
+  grunt.initConfig({
+    jshint: {
+      all: [
+        'bin/*',
+        'lib/**/*.js',
+        'Gruntfile.js'
+      ],
+      options: {
+        jshintrc: '.jshintrc'
+      }
+    },
+  });
+
+  // These plugins provide necessary tasks.
+  grunt.loadNpmTasks('grunt-contrib-jshint');
+
+  // "npm test" runs these tasks
+  grunt.registerTask('test', ['jshint']);
+
+  // Default task.
+  grunt.registerTask('default', ['test']);
+
+};
diff --git a/LICENSE-MIT b/LICENSE-MIT
new file mode 100644
index 0000000..984660f
--- /dev/null
+++ b/LICENSE-MIT
@@ -0,0 +1,22 @@
+Copyright (c) 2016 Tyler Kellen, contributors
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..df9848a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,31 @@
+# grunt-cli [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-cli.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-cli) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/prp6g944b05jsq6d/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-cli/branch/master)
+
+> The Grunt command line interface.
+
+Install this globally and you'll have access to the `grunt` command anywhere on your system.
+
+```shell
+npm install -g grunt-cli
+```
+
+**Note:** The job of the `grunt` command is to load and run the version of Grunt you have installed locally to your project, irrespective of its version.  Starting with Grunt v0.4, you should never install Grunt itself globally.  For more information about why, [please read this](http://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation).
+
+See the [Getting Started](http://gruntjs.com/getting-started) guide for more information.
+
+## Shell tab auto-completion
+To enable tab auto-completion for Grunt, add one of the following lines to your `~/.bashrc` or `~/.zshrc` file.
+
+```bash
+# Bash, ~/.bashrc
+eval "$(grunt --completion=bash)"
+```
+
+```bash
+# Zsh, ~/.zshrc
+eval "$(grunt --completion=zsh)"
+```
+
+## Installing grunt-cli locally
+If you prefer the idiomatic Node.js method to get started with a project (`npm install && npm test`) then install grunt-cli locally with `npm install grunt-cli --save-dev`. Then add a script to your `package.json` to run the associated grunt command: `"scripts": { "test": "grunt test" } `. Now `npm test` will use the locally installed `./node_modules/.bin/grunt` executable to run your Grunt commands.
+
+To read more about npm scripts, please visit the npm docs: <https://docs.npmjs.com/misc/scripts>.
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..3db60a9
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,44 @@
+# http://www.appveyor.com/docs/appveyor-yml
+
+clone_depth: 10
+
+version: "{build}"
+
+# What combinations to test
+environment:
+  matrix:
+    - nodejs_version: "0.10"
+      platform: x86
+    - nodejs_version: "0.12"
+      platform: x86
+    - nodejs_version: "4"
+      platform: x64
+    - nodejs_version: "4"
+      platform: x86
+    - nodejs_version: "5"
+      platform: x86
+
+install:
+  - ps: Install-Product node $env:nodejs_version $env:platform
+  - ps: >-
+      if ($env:nodejs_version -eq "0.10") {
+        npm -g install npm at 3
+        $env:PATH="$env:APPDATA\npm;$env:PATH"
+      }
+  - npm install
+
+test_script:
+  # Output useful info for debugging
+  - node --version && npm --version
+  # We test multiple Windows shells because of prior stdout buffering issues
+  # filed against Grunt. https://github.com/joyent/node/issues/3584
+  - ps: "npm test # PowerShell" # Pass comment to PS for easier debugging
+  - cmd: npm test
+
+build: off
+
+matrix:
+  fast_finish: true
+
+cache:
+  - node_modules -> package.json
diff --git a/bin/grunt b/bin/grunt
new file mode 100755
index 0000000..930271c
--- /dev/null
+++ b/bin/grunt
@@ -0,0 +1,44 @@
+#!/usr/bin/env node
+
+'use strict';
+
+process.title = 'grunt';
+
+// Especially badass external libs.
+var findup = require('findup-sync');
+var resolve = require('resolve').sync;
+
+// Internal libs.
+var options = require('../lib/cli').options;
+var completion = require('../lib/completion');
+var info = require('../lib/info');
+var path = require('path');
+
+var basedir = process.cwd();
+var gruntpath;
+
+// Do stuff based on CLI options.
+if ('completion' in options) {
+  completion.print(options.completion);
+} else if (options.version) {
+  info.version();
+} else if (options.gruntfile) { //Note: if both `gruntfile` and `base` are set, use `gruntfile`
+  basedir = path.resolve(path.dirname(options.gruntfile));
+} else if (options.base) {
+  basedir = path.resolve(options.base);
+}
+
+try {
+  gruntpath = resolve('grunt', {basedir: basedir});
+} catch (ex) {
+  gruntpath = findup('lib/grunt.js');
+  // No grunt install found!
+  if (!gruntpath) {
+    if (options.version) { process.exit(); }
+    if (options.help) { info.help(); }
+    info.fatal('Unable to find local grunt.', 99);
+  }
+}
+
+// Everything looks good. Require local grunt and run it.
+require(gruntpath).cli();
diff --git a/completion/bash b/completion/bash
new file mode 100755
index 0000000..eb03ae8
--- /dev/null
+++ b/completion/bash
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# grunt-cli
+# http://gruntjs.com/
+#
+# Copyright (c) 2016 Tyler Kellen, contributors
+# Licensed under the MIT license.
+# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+
+# Usage:
+#
+# To enable bash <tab> completion for grunt, add the following line (minus the
+# leading #, which is the bash comment character) to your ~/.bashrc file:
+#
+# eval "$(grunt --completion=bash)"
+
+# Search the current directory and all parent directories for a gruntfile.
+function _grunt_gruntfile() {
+  local curpath="$PWD"
+  while [[ "$curpath" ]]; do
+    for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
+      if [[ -e "$gruntfile" ]]; then
+        echo "$gruntfile"
+        return
+      fi
+    done
+    curpath="${curpath%/*}"
+  done
+  return 1
+}
+
+# Enable bash autocompletion.
+function _grunt_completions() {
+  # The currently-being-completed word.
+  local cur="${COMP_WORDS[COMP_CWORD]}"
+  # The current gruntfile, if it exists.
+  local gruntfile="$(_grunt_gruntfile)"
+  # The current grunt version, available tasks, options, etc.
+  local gruntinfo="$(grunt --version --verbose 2>/dev/null)"
+  # Options and tasks.
+  local opts="$(echo "$gruntinfo" | awk '/Available options: / {$1=$2=""; print $0}')"
+  local compls="$(echo "$gruntinfo" | awk '/Available tasks: / {$1=$2=""; print $0}')"
+  # Only add -- or - options if the user has started typing -
+  [[ "$cur" == -* ]] && compls="$compls $opts"
+  # Tell complete what stuff to show.
+  COMPREPLY=($(compgen -W "$compls" -- "$cur"))
+}
+
+complete -o default -F _grunt_completions grunt
diff --git a/completion/zsh b/completion/zsh
new file mode 100755
index 0000000..c2841ff
--- /dev/null
+++ b/completion/zsh
@@ -0,0 +1,37 @@
+#!/bin/zsh
+
+# grunt-cli
+# http://gruntjs.com/
+#
+# Copyright (c) 2016 Tyler Kellen, contributors
+# Licensed under the MIT license.
+# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+
+# Usage:
+#
+# To enable zsh <tab> completion for grunt, add the following line (minus the
+# leading #, which is the zsh comment character) to your ~/.zshrc file:
+#
+# eval "$(grunt --completion=zsh)"
+
+# Enable zsh autocompletion.
+function _grunt_completion() {
+  local completions
+  # The currently-being-completed word.
+  local cur="${words[@]}"
+  # The current grunt version, available tasks, options, etc.
+  local gruntinfo="$(grunt --version --verbose 2>/dev/null)"
+  # Options and tasks.
+  local opts="$(echo "$gruntinfo" | awk '/Available options: / {$1=$2=""; print $0}')"
+  local compls="$(echo "$gruntinfo" | awk '/Available tasks: / {$1=$2=""; print $0}')"
+  # Only add -- or - options if the user has started typing -
+  [[ "$cur" == -* ]] && compls="$compls $opts"
+  # Trim whitespace.
+  compls=$(echo "$compls" | sed -e 's/^ *//g' -e 's/ *$//g')
+  # Turn compls into an array to of completions.
+  completions=(${=compls})
+  # Tell complete what stuff to show.
+  compadd -- $completions
+}
+
+compdef _grunt_completion grunt
diff --git a/lib/cli.js b/lib/cli.js
new file mode 100644
index 0000000..0946006
--- /dev/null
+++ b/lib/cli.js
@@ -0,0 +1,33 @@
+/*
+ * grunt-cli
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2016 Tyler Kellen, contributors
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt-init/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// External lib.
+var nopt = require('nopt');
+var gruntOptions = require('grunt-known-options');
+
+// Parse `gruntOptions` into a form that nopt can handle.
+exports.aliases = {};
+exports.known = {};
+
+Object.keys(gruntOptions).forEach(function(key) {
+  var short = gruntOptions[key].short;
+  if (short) {
+    exports.aliases[short] = '--' + key;
+  }
+  exports.known[key] = gruntOptions[key].type;
+});
+
+// Parse them and return an options object.
+Object.defineProperty(exports, 'options', {
+  get: function() {
+    return nopt(exports.known, exports.aliases, process.argv, 2);
+  }
+});
diff --git a/lib/completion.js b/lib/completion.js
new file mode 100644
index 0000000..ace3cd5
--- /dev/null
+++ b/lib/completion.js
@@ -0,0 +1,34 @@
+/*
+ * grunt-cli
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2016 Tyler Kellen, contributors
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt-init/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// Nodejs libs.
+var fs = require('fs');
+var path = require('path');
+
+exports.print = function(name) {
+  var code = 0;
+  var filepath = path.join(__dirname, '../completion', name);
+  var output;
+  try {
+    // Attempt to read shell completion file.
+    output = String(fs.readFileSync(filepath));
+  } catch (err) {
+    code = 5;
+    output = 'echo "Specified grunt shell auto-completion rules ';
+    if (name && name !== 'true') {
+      output += 'for \'' + name + '\' ';
+    }
+    output += 'not found."';
+  }
+
+  console.log(output);
+  process.exit(code);
+};
diff --git a/lib/info.js b/lib/info.js
new file mode 100644
index 0000000..a184930
--- /dev/null
+++ b/lib/info.js
@@ -0,0 +1,51 @@
+/*
+ * grunt-cli
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2016 Tyler Kellen, contributors
+ * Licensed under the MIT license.
+ * https://github.com/gruntjs/grunt-init/blob/master/LICENSE-MIT
+ */
+
+'use strict';
+
+// Project metadata.
+var pkg = require('../package.json');
+
+// Display grunt-cli version.
+exports.version = function() {
+  console.log('grunt-cli v' + pkg.version);
+};
+
+// Show help, then exit with a message and error code.
+exports.fatal = function(msg, code) {
+  exports.helpHeader();
+  console.log('Fatal error: ' + msg);
+  console.log('');
+  exports.helpFooter();
+  process.exit(code);
+};
+
+// Show help and exit.
+exports.help = function() {
+  exports.helpHeader();
+  exports.helpFooter();
+  process.exit();
+};
+
+// Help header.
+exports.helpHeader = function() {
+  console.log('grunt-cli: ' + pkg.description + ' (v' + pkg.version + ')');
+  console.log('');
+};
+
+// Help footer.
+exports.helpFooter = function() {
+  [
+    'If you\'re seeing this message, grunt hasn\'t been installed locally to',
+    'your project. For more information about installing and configuring grunt,',
+    'please see the Getting Started guide:',
+    '',
+    'http://gruntjs.com/getting-started',
+  ].forEach(function(str) { console.log(str); });
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..844226f
--- /dev/null
+++ b/package.json
@@ -0,0 +1,33 @@
+{
+  "name": "grunt-cli",
+  "description": "The grunt command line interface",
+  "version": "1.2.0",
+  "author": "Grunt Development Team (http://gruntjs.com/development-team)",
+  "repository": "gruntjs/grunt-cli",
+  "license": "MIT",
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "node bin/grunt test"
+  },
+  "bin": {
+    "grunt": "bin/grunt"
+  },
+  "dependencies": {
+    "findup-sync": "~0.3.0",
+    "grunt-known-options": "~1.1.0",
+    "nopt": "~3.0.6",
+    "resolve": "~1.1.0"
+  },
+  "devDependencies": {
+    "grunt": "~0.4.5",
+    "grunt-contrib-jshint": "~1.0.0"
+  },
+  "files": [
+    "bin",
+    "completion",
+    "lib"
+  ],
+  "appveyor_id": "prp6g944b05jsq6d"
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-grunt-cli.git



More information about the Pkg-javascript-commits mailing list