[Pkg-javascript-commits] [node-external-editor] 05/10: New upstream version 2.0.1+dfsg
Paolo Greppi
paolog-guest at moszumanska.debian.org
Mon Dec 19 11:44:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
paolog-guest pushed a commit to branch master
in repository node-external-editor.
commit c911c2613bc1c8880c01ea83ca4d140ddfe876f9
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date: Mon Dec 19 11:20:33 2016 +0000
New upstream version 2.0.1+dfsg
---
main/errors/CreateFileError.js | 29 ------
main/errors/LaunchEditorError.js | 29 ------
main/errors/ReadFileError.js | 29 ------
main/errors/RemoveFileError.js | 29 ------
main/index.js | 208 ---------------------------------------
5 files changed, 324 deletions(-)
diff --git a/main/errors/CreateFileError.js b/main/errors/CreateFileError.js
deleted file mode 100644
index e13bec5..0000000
--- a/main/errors/CreateFileError.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Generated by CoffeeScript 1.12.0
-
-/*
- ExternalEditor
- Kevin Gravier <kevin at mrkmg.com>
- MIT
- */
-
-(function() {
- var CreateFileError,
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- hasProp = {}.hasOwnProperty;
-
- CreateFileError = (function(superClass) {
- extend(CreateFileError, superClass);
-
- CreateFileError.prototype.message = 'Failed to create temporary file for editor';
-
- function CreateFileError(original_error) {
- this.original_error = original_error;
- }
-
- return CreateFileError;
-
- })(Error);
-
- module.exports = CreateFileError;
-
-}).call(this);
diff --git a/main/errors/LaunchEditorError.js b/main/errors/LaunchEditorError.js
deleted file mode 100644
index 731e4a4..0000000
--- a/main/errors/LaunchEditorError.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Generated by CoffeeScript 1.12.0
-
-/*
- ExternalEditor
- Kevin Gravier <kevin at mrkmg.com>
- MIT
- */
-
-(function() {
- var LaunchEditorError,
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- hasProp = {}.hasOwnProperty;
-
- LaunchEditorError = (function(superClass) {
- extend(LaunchEditorError, superClass);
-
- LaunchEditorError.prototype.message = 'Failed launch editor';
-
- function LaunchEditorError(original_error) {
- this.original_error = original_error;
- }
-
- return LaunchEditorError;
-
- })(Error);
-
- module.exports = LaunchEditorError;
-
-}).call(this);
diff --git a/main/errors/ReadFileError.js b/main/errors/ReadFileError.js
deleted file mode 100644
index af27934..0000000
--- a/main/errors/ReadFileError.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Generated by CoffeeScript 1.12.0
-
-/*
- ExternalEditor
- Kevin Gravier <kevin at mrkmg.com>
- MIT
- */
-
-(function() {
- var ReadFileError,
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- hasProp = {}.hasOwnProperty;
-
- ReadFileError = (function(superClass) {
- extend(ReadFileError, superClass);
-
- ReadFileError.prototype.message = 'Failed to read temporary file';
-
- function ReadFileError(original_error) {
- this.original_error = original_error;
- }
-
- return ReadFileError;
-
- })(Error);
-
- module.exports = ReadFileError;
-
-}).call(this);
diff --git a/main/errors/RemoveFileError.js b/main/errors/RemoveFileError.js
deleted file mode 100644
index 80023ec..0000000
--- a/main/errors/RemoveFileError.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Generated by CoffeeScript 1.12.0
-
-/*
- ExternalEditor
- Kevin Gravier <kevin at mrkmg.com>
- MIT
- */
-
-(function() {
- var RemoveFileError,
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- hasProp = {}.hasOwnProperty;
-
- RemoveFileError = (function(superClass) {
- extend(RemoveFileError, superClass);
-
- RemoveFileError.prototype.message = 'Failed to cleanup temporary file';
-
- function RemoveFileError(original_error) {
- this.original_error = original_error;
- }
-
- return RemoveFileError;
-
- })(Error);
-
- module.exports = RemoveFileError;
-
-}).call(this);
diff --git a/main/index.js b/main/index.js
deleted file mode 100644
index d2c4c8d..0000000
--- a/main/index.js
+++ /dev/null
@@ -1,208 +0,0 @@
-// Generated by CoffeeScript 1.12.0
-
-/*
- ExternalEditor
- Kevin Gravier <kevin at mrkmg.com>
- MIT
- */
-
-(function() {
- var CreateFileError, ExternalEditor, FS, LaunchEditorError, ReadFileError, RemoveFileError, Spawn, SpawnSync, Temp,
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
-
- FS = require('fs');
-
- Temp = require('tmp');
-
- SpawnSync = require('child_process').spawnSync;
-
- Spawn = require('child_process').spawn;
-
- CreateFileError = require('./errors/CreateFileError');
-
- ReadFileError = require('./errors/ReadFileError');
-
- RemoveFileError = require('./errors/RemoveFileError');
-
- LaunchEditorError = require('./errors/LaunchEditorError');
-
- ExternalEditor = (function() {
- ExternalEditor.edit = function(text) {
- var editor;
- if (text == null) {
- text = '';
- }
- editor = new ExternalEditor(text);
- editor.run();
- editor.cleanup();
- return editor.text;
- };
-
- ExternalEditor.editAsync = function(text, callback) {
- var editor;
- if (text == null) {
- text = '';
- }
- editor = new ExternalEditor(text);
- return editor.runAsync(function(error_run, response) {
- var error_cleanup;
- if (!error_run) {
- try {
- editor.cleanup();
- } catch (error) {
- error_cleanup = error;
- if (typeof callback === 'function') {
- callback(error_cleanup);
- }
- }
- return callback(null, response);
- } else {
- return callback(error_run) in typeof callback === 'function';
- }
- });
- };
-
- ExternalEditor.CreateFileError = CreateFileError;
-
- ExternalEditor.ReadFileError = ReadFileError;
-
- ExternalEditor.RemoveFileError = RemoveFileError;
-
- ExternalEditor.LaunchEditorError = LaunchEditorError;
-
- ExternalEditor.prototype.text = '';
-
- ExternalEditor.prototype.temp_file = void 0;
-
- ExternalEditor.prototype.editor = {
- bin: void 0,
- args: []
- };
-
- function ExternalEditor(text1) {
- this.text = text1 != null ? text1 : '';
- this.launchEditorAsync = bind(this.launchEditorAsync, this);
- this.launchEditor = bind(this.launchEditor, this);
- this.removeTemporaryFile = bind(this.removeTemporaryFile, this);
- this.readTemporaryFile = bind(this.readTemporaryFile, this);
- this.createTemporaryFile = bind(this.createTemporaryFile, this);
- this.determineEditor = bind(this.determineEditor, this);
- this.cleanup = bind(this.cleanup, this);
- this.runAsync = bind(this.runAsync, this);
- this.run = bind(this.run, this);
- this.determineEditor();
- this.createTemporaryFile();
- }
-
- ExternalEditor.prototype.run = function() {
- this.launchEditor();
- return this.readTemporaryFile();
- };
-
- ExternalEditor.prototype.runAsync = function(callback) {
- var error_launch;
- try {
- return this.launchEditorAsync((function(_this) {
- return function() {
- var error_read;
- try {
- _this.readTemporaryFile();
- if (typeof callback === 'function') {
- return callback(null, _this.text);
- }
- } catch (error) {
- error_read = error;
- if (typeof callback === 'function') {
- return callback(error_read);
- }
- }
- };
- })(this));
- } catch (error) {
- error_launch = error;
- if (typeof callback === 'function') {
- return callback(error_launch);
- }
- }
- };
-
- ExternalEditor.prototype.cleanup = function() {
- return this.removeTemporaryFile();
- };
-
- ExternalEditor.prototype.determineEditor = function() {
- var args, ed, editor;
- ed = /^win/.test(process.platform) ? 'notepad' : 'vim';
- editor = process.env.VISUAL || process.env.EDITOR || ed;
- args = editor.split(/\s+/);
- this.bin = args.shift();
- return this.args = args;
- };
-
- ExternalEditor.prototype.createTemporaryFile = function() {
- var e;
- try {
- this.temp_file = Temp.tmpNameSync({});
- return FS.writeFileSync(this.temp_file, this.text);
- } catch (error) {
- e = error;
- throw new CreateFileError(e);
- }
- };
-
- ExternalEditor.prototype.readTemporaryFile = function() {
- var e;
- try {
- return this.text = FS.readFileSync(this.temp_file).toString();
- } catch (error) {
- e = error;
- throw new ReadFileError(e);
- }
- };
-
- ExternalEditor.prototype.removeTemporaryFile = function() {
- var e;
- try {
- return FS.unlinkSync(this.temp_file);
- } catch (error) {
- e = error;
- throw new RemoveFileError(e);
- }
- };
-
- ExternalEditor.prototype.launchEditor = function() {
- var e;
- try {
- return SpawnSync(this.bin, this.args.concat([this.temp_file]), {
- stdio: 'inherit'
- });
- } catch (error) {
- e = error;
- throw new LaunchEditorError(e);
- }
- };
-
- ExternalEditor.prototype.launchEditorAsync = function(callback) {
- var child_process, e;
- try {
- child_process = Spawn(this.bin, this.args.concat([this.temp_file]), {
- stdio: 'inherit'
- });
- return child_process.on('exit', function() {
- if (typeof callback === 'function') {
- return callback();
- }
- });
- } catch (error) {
- e = error;
- throw new LaunchEditorError(e);
- }
- };
-
- return ExternalEditor;
-
- })();
-
- module.exports = ExternalEditor;
-
-}).call(this);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-external-editor.git
More information about the Pkg-javascript-commits
mailing list