Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

~ in privateKey does not work #11

Merged
merged 3 commits into from

2 participants

rektide Thomas Parisot
rektide

From the tail of my strace -f -e trace=file grunt:

stat("~/.ssh/chrome-apps.pem", 0x7fff25cec6d0) = -1 ENOENT (No such file or directory)

yet:

ls ~/.ssh/chrome-apps.pem -l
-rwx------ 1 rektide rektide 1090 2013-03-06 22:20:14 -0500 /home/rektide/.ssh/chrome-apps.pem*

The ~ in the privateKey option needs to be converted into the users home directory. Opening a file with ~ in it does not work.

Thomas Parisot
Owner

Hi, this means that ~ is not resolved by grunt filepath expand library.

I've quickly digged into and I can't find the user dir in any documentation.

Thomas Parisot oncletom merged commit d8547e5 into from
Thomas Parisot oncletom deleted the branch
Thomas Parisot
Owner

Will be available in 0.2.1 in a couple of minutes then :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 22, 2013
  1. Strict mode checking

    authored
  2. Expanding ~

    authored
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 14 deletions.
  1. +15 −13 .jshintrc
  2. +1 −0  .travis.yml
  3. +19 −1 tasks/crx.js
28 .jshintrc
View
@@ -1,16 +1,18 @@
{
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "sub": true,
- "undef": true,
- "boss": true,
- "eqnull": true,
- "node": true,
- "es5": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true,
+ "es5": true,
+ "strict": true,
- "globals": {}
+
+ "globals": {}
}
1  .travis.yml
View
@@ -1,5 +1,6 @@
language: node_js
node_js:
- 0.8
+ - 0.10
before_script:
- npm install -g grunt-cli
20 tasks/crx.js
View
@@ -11,6 +11,7 @@
var ChromeExtension = require('crx');
var path = require('path');
var required_properties = ['manifest_version', 'name', 'version'];
+var homeDir = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
/**
* Expand the current multitask config key name
@@ -24,9 +25,23 @@ function buildConfigProperty(task, key){
}
/**
+ * Resolve the home directory of a supposed-path value
+ *
+ * @param {String} value
+ * @returns {String}
+ */
+function resolveHomeDirectory(value){
+ if (homeDir && typeof value === 'string' && value[0] === '~'){
+ value = value.replace(/^~/, homeDir);
+ }
+
+ return value;
+}
+
+/**
* Configures the task
*
- * @param {!Object} grunt Grunt itself.
+ * @param {!grunt} grunt Grunt itself.
* @param {!Object} config User settings hash.
* @param {Object} defaults Default settings hash.
*/
@@ -41,6 +56,9 @@ function configure(grunt, config, defaults){
// XXX (alexeykuzmin): Is there a better way to get source folder path?
var sourceDir = config.src[0];
+ // Eventually expanding `~` in config paths
+ grunt.util._.assign(config, config, resolveHomeDirectory);
+
// Checking availability
if (!grunt.file.exists(sourceDir)){
grunt.fail.fatal('Unable to locate source directory.');
Something went wrong with that request. Please try again.