Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Provide a filename-only placeholder for exec #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Provide a filename-only placeholder for exec #100

wants to merge 2 commits into from

Conversation

cawoodm
Copy link

@cawoodm cawoodm commented Dec 25, 2012

Say we want to run unit-tests when the current file foo.js is saved. Our tests require that the following command is run:
node tests\test-foo.js

In order for this to work we need a ${filename} placeholder which returns only foo.js and not the full path (as ${file} currently does).

"exec": {
  "afterSave": {
    "*.js": "node tests/test-${filename}"
  }
}

Say we want to run unit-tests when the current file `foo.js` is saved. Our tests require that the following command is run:
`node tests\test-foo.js`

In order for this to work we need a `${filename}` placeholder which returns only `foo.js` and not the full path (as `${file}` currently does).

```javascript
  "exec": {
    "afterSave": {
      "*.js": "node tests/test-${filename}.js"
    }
  }
```
@cawoodm
Copy link
Author

cawoodm commented Dec 25, 2012

Trust me - it's awesome:
tests

@aeisenberg
Copy link
Contributor

Thanks for the Christmas present!

@cawoodm
Copy link
Author

cawoodm commented Dec 26, 2012

Ho ho ho!

I have an update/addition. If you run exec in a subfolder (foo/) it seems to remain in the projectDir so you need the subpath foo/db.js.

Should we adapt my code above or add a new ${filenamer} (filename __r__elative):

def("${filenamer}", function() {
    var p = editor.getFilePath();
    return p.substring((window.fsroot || getDir()).length+1);
});

@aeisenberg
Copy link
Contributor

Can you do a rebase and add this change to the current pull request? Or
just close the pull request and open a new one. It is important to have
the correct author tags on all external commits for copyright and egal
purposes. And speaking of legal, we won't be able to do anything with this
until the new year for reasons that we already discussed.

On Wed, Dec 26, 2012 at 8:38 AM, cawoodm [email protected] wrote:

Ho ho ho!

I have an update/addition. If you run exec in a subfolder (foo/) it seems
to remain in the projectDir so you need the subpath foo/db.js.

Should we adapt my code above or add a new ${filenamer} (filename
_r_elative):

def("${filenamer}", function() {
var p = editor.getFilePath();
return p.substring((window.fsroot || getDir()).length+1);});


Reply to this email directly or view it on GitHubhttps://github.com//pull/100#issuecomment-11689416.

Renamed ${filename} to ${fileName}
Added ${fileBase} and ${filePath}
@cawoodm
Copy link
Author

cawoodm commented Dec 30, 2012

OK, I went with:
$fileName -> hello.js
$fileBase -> hello
$filePath -> subdir/hello.js

@cawoodm
Copy link
Author

cawoodm commented Jan 27, 2013

@aclement
Copy link
Contributor

Marc - I'm afraid we are still waiting for a contributor agreement to be setup so that you can sign it and we can take the contribution. I'm really hoping it'll be in the next few days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants