mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
1
node_modules/iferr/.npmignore
generated
vendored
Normal file
1
node_modules/iferr/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
21
node_modules/iferr/LICENSE
generated
vendored
Normal file
21
node_modules/iferr/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Nadav Ivgi
|
||||
|
||||
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.
|
40
node_modules/iferr/README.md
generated
vendored
Normal file
40
node_modules/iferr/README.md
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
# iferr
|
||||
|
||||
Higher-order functions for easier error handling.
|
||||
|
||||
`if (err) return cb(err);` be gone!
|
||||
|
||||
## Install
|
||||
```bash
|
||||
npm install iferr
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
### JavaScript example
|
||||
```js
|
||||
var iferr = require('iferr');
|
||||
|
||||
function get_friends_count(id, cb) {
|
||||
User.load_user(id, iferr(cb, function(user) {
|
||||
user.load_friends(iferr(cb, function(friends) {
|
||||
cb(null, friends.length);
|
||||
}));
|
||||
}));
|
||||
}
|
||||
```
|
||||
|
||||
### CoffeeScript example
|
||||
```coffee
|
||||
iferr = require 'iferr'
|
||||
|
||||
get_friends_count = (id, cb) ->
|
||||
User.load_user id, iferr cb, (user) ->
|
||||
user.load_friends iferr cb, (friends) ->
|
||||
cb null, friends.length
|
||||
```
|
||||
|
||||
(TODO: document tiferr, throwerr and printerr)
|
||||
|
||||
## License
|
||||
MIT
|
24
node_modules/iferr/index.coffee
generated
vendored
Normal file
24
node_modules/iferr/index.coffee
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Delegates to `succ` on sucecss or to `fail` on error
|
||||
# ex: Thing.load 123, iferr cb, (thing) -> ...
|
||||
iferr = (fail, succ) -> (err, a...) ->
|
||||
if err? then fail err
|
||||
else succ? a...
|
||||
|
||||
# Like iferr, but also catches errors thrown from `succ` and passes to `fail`
|
||||
tiferr = (fail, succ) -> iferr fail, (a...) ->
|
||||
try succ a...
|
||||
catch err then fail err
|
||||
|
||||
# Delegate to the success function on success, or throw the error otherwise
|
||||
# ex: Thing.load 123, throwerr (thing) -> ...
|
||||
throwerr = iferr.bind null, (err) -> throw err
|
||||
|
||||
# Prints errors when one is passed, or does nothing otherwise
|
||||
# ex: thing.save printerr
|
||||
printerr = iferr (err) -> console.error err.stack or err
|
||||
|
||||
module.exports = exports = iferr
|
||||
exports.iferr = iferr
|
||||
exports.tiferr = tiferr
|
||||
exports.throwerr = throwerr
|
||||
exports.printerr = printerr
|
49
node_modules/iferr/index.js
generated
vendored
Normal file
49
node_modules/iferr/index.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Generated by CoffeeScript 1.7.1
|
||||
(function() {
|
||||
var exports, iferr, printerr, throwerr, tiferr,
|
||||
__slice = [].slice;
|
||||
|
||||
iferr = function(fail, succ) {
|
||||
return function() {
|
||||
var a, err;
|
||||
err = arguments[0], a = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
||||
if (err != null) {
|
||||
return fail(err);
|
||||
} else {
|
||||
return typeof succ === "function" ? succ.apply(null, a) : void 0;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
tiferr = function(fail, succ) {
|
||||
return iferr(fail, function() {
|
||||
var a, err;
|
||||
a = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
try {
|
||||
return succ.apply(null, a);
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
return fail(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
throwerr = iferr.bind(null, function(err) {
|
||||
throw err;
|
||||
});
|
||||
|
||||
printerr = iferr(function(err) {
|
||||
return console.error(err.stack || err);
|
||||
});
|
||||
|
||||
module.exports = exports = iferr;
|
||||
|
||||
exports.iferr = iferr;
|
||||
|
||||
exports.tiferr = tiferr;
|
||||
|
||||
exports.throwerr = throwerr;
|
||||
|
||||
exports.printerr = printerr;
|
||||
|
||||
}).call(this);
|
56
node_modules/iferr/package.json
generated
vendored
Normal file
56
node_modules/iferr/package.json
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"_from": "iferr@^0.1.5",
|
||||
"_id": "iferr@0.1.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=",
|
||||
"_location": "/iferr",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "iferr@^0.1.5",
|
||||
"name": "iferr",
|
||||
"escapedName": "iferr",
|
||||
"rawSpec": "^0.1.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.1.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/copy-concurrently",
|
||||
"/fs-write-stream-atomic"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz",
|
||||
"_shasum": "c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501",
|
||||
"_spec": "iferr@^0.1.5",
|
||||
"_where": "/home/shimataro/projects/actions/ssh-key-action/node_modules/copy-concurrently",
|
||||
"author": {
|
||||
"name": "Nadav Ivgi"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shesek/iferr/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Higher-order functions for easier error handling",
|
||||
"devDependencies": {
|
||||
"coffee-script": "^1.7.1",
|
||||
"mocha": "^1.18.2"
|
||||
},
|
||||
"homepage": "https://github.com/shesek/iferr",
|
||||
"keywords": [
|
||||
"error",
|
||||
"errors"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "iferr",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/shesek/iferr.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "coffee -c index.coffee",
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.1.5"
|
||||
}
|
42
node_modules/iferr/test/index.coffee
generated
vendored
Normal file
42
node_modules/iferr/test/index.coffee
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ iferr, tiferr, throwerr } = require '../index.coffee'
|
||||
{ equal: eq, throws } = require 'assert'
|
||||
|
||||
invoke_fail = (cb) -> cb new Error 'callback error'
|
||||
invoke_succ = (cb) -> cb null
|
||||
throw_error = -> throw new Error 'thrown'
|
||||
|
||||
describe 'iferr', ->
|
||||
it 'calls the error callback on errors', (done) ->
|
||||
invoke_fail iferr(
|
||||
(err) ->
|
||||
eq err.message, 'callback error'
|
||||
do done
|
||||
->
|
||||
done new Error 'shouldn\'t call the success callback'
|
||||
)
|
||||
|
||||
it 'calls the success callback on success', (done) ->
|
||||
invoke_succ iferr(
|
||||
-> done new Error 'shouldn\'t call the error callback'
|
||||
done
|
||||
)
|
||||
|
||||
describe 'tiferr', ->
|
||||
it 'catches errors in the success callback', (done) ->
|
||||
invoke_succ tiferr(
|
||||
(err) ->
|
||||
eq err.message, 'thrown'
|
||||
do done
|
||||
throw_error
|
||||
)
|
||||
|
||||
describe 'throwerr', ->
|
||||
it 'throws errors passed to the callback', (done)->
|
||||
try invoke_fail throwerr ->
|
||||
done 'shouldn\'t call the success callback'
|
||||
catch err
|
||||
eq err.message, 'callback error'
|
||||
do done
|
||||
|
||||
it 'delegates to the success callback otherwise', (done) ->
|
||||
invoke_succ throwerr done
|
2
node_modules/iferr/test/mocha.opts
generated
vendored
Normal file
2
node_modules/iferr/test/mocha.opts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
--compilers coffee:coffee-script/register
|
||||
--reporter spec
|
Loading…
Add table
Add a link
Reference in a new issue