Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypercubed committed Sep 13, 2013
2 parents c1fb934 + 38efdd5 commit 5790be1
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 104 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
17 changes: 2 additions & 15 deletions .gitignore
@@ -1,15 +1,2 @@
node_modules
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
/node_modules/
npm-debug.log
21 changes: 21 additions & 0 deletions .jshintrc
@@ -0,0 +1,21 @@
{
"node": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": true
}
4 changes: 4 additions & 0 deletions .travis.yml
@@ -0,0 +1,4 @@
language: node_js
node_js:
- '0.8'
- '0.10'
73 changes: 38 additions & 35 deletions README.md
@@ -1,35 +1,38 @@
replit
======

sometimes you need a repl (inspired by http://defunkt.io/repl/)

## DESCRIPTION
`replit` wraps a non-interactive shell command in an interactive read-eval-print-loop (repl) prompt.
Each line you type into the prompt is executed as arguments to command.
Anything written to standard output or standard error by the command is displayed.

## Status

WIP

## Installation

```
$ npm install -g Hypercubed/replit
```

## Usage

```
Usage: replit.js [options] <cmd>
Options:
-h, --help output usage information
-V, --version output the version number
```

# License

MIT

replit [![Build Status](https://secure.travis-ci.org/Hypercubed/replit.png?branch=master)](https://travis-ci.org/Hypercubed/replit) [![NPM version](https://badge.fury.io/js/replit.png)](http://badge.fury.io/js/replit)
=============

sometimes you need a repl (inspired by http://defunkt.io/repl/)

# Description
`replit` wraps a non-interactive shell command in an interactive read-eval-print-loop (repl) prompt.
Each line you type into the prompt is executed as arguments to command.
Anything written to standard output or standard error by the command is displayed.

## Status
WIP

# Installation

```
$ npm install -g Hypercubed/replit
```

# Usage

```
Usage: replit.js [options] <cmd>
Options:
-h, --help output usage information
-V, --version output the version number
```

# License

Copyright (c) 2013 Jayson Harshbarger
[MIT License](http://en.wikipedia.org/wiki/MIT_License)

# Acknowledgments

Built using [generator-commader](https://github.com/Hypercubed/generator-commander), inspired by [http://defunkt.io/repl/](http://defunkt.io/repl/).
32 changes: 32 additions & 0 deletions bin/replit
@@ -0,0 +1,32 @@
#!/usr/bin/env node
'use strict';

var program = require('commander');

//
var repl = require('../lib/replit.js').repl;

require('autocmdr/lib/logger')(program);
require('autocmdr/lib/package')(program);

program
.usage('[options] <cmd>')
.option('-p, --pmt <prompt>', 'set readline prompt')
.parse(process.argv);

if (program.args.length < 1 ) {
program.log.error('No command specified. See \''+program._name+' --help\'.');
program.outputHelp();
process.exit(1);
}

var cmd = program.args.join(' ');

var options = {};
options.prompt = program.pmt || cmd+'> ';
options.debug = program.debug || false;
options.name = program.name || 'replit';

repl(cmd, options);


41 changes: 0 additions & 41 deletions bin/replit.js

This file was deleted.

2 changes: 0 additions & 2 deletions lib/replit.js
Expand Up @@ -54,8 +54,6 @@ exports.repl = function(command, options) {
if (_argv[0] == 'exit')
console.log('Warning', 'Use Ctrl-D (i.e. EOF) to exit');



if (WINDOWS && !CYGWIN) {
file = 'cmd.exe';
args = ['/s', '/c', (_cmd+' '+_rest) ];
Expand Down
26 changes: 15 additions & 11 deletions package.json
@@ -1,16 +1,17 @@
{
"name": "replit",
"version": "0.0.1",
"description": "replit",
"version": "0.0.2",
"description": "sometimes you need a repl (inspired by http://defunkt.io/repl/)",
"bin": {
"replit": "./bin/replit.js"
"replit": "./bin/replit"
},
"dependencies": {
"commander": "~1.2.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha -R spec"
},
"author": {
"name": "Jayson Harshbarger",
"email": "",
"url": "https://github.com/Hypercubed"
},
"repository": {
"type": "git",
Expand All @@ -20,9 +21,12 @@
"node",
"repl"
],
"author": "J. Harshbarger",
"license": "MIT",
"bugs": {
"url": "https://github.com/Hypercubed/replit/issues"
"bugs": "https://github.com/Hypercubed/replit/issues",
"dependencies": {
"commander": "~2.0.0",
"autocmdr": "~0.0.4"
},
"devDependencies": {
}
}
36 changes: 36 additions & 0 deletions test/replit.js
@@ -0,0 +1,36 @@
'use strict';

var assert = require("assert");
var exec = require('child_process').exec;
var path = require('path');

describe('replit bin', function(){
var cmd = 'node '+path.join(__dirname, '../bin/replit')+' ';
console.log(cmd);

it('--help should run without errors', function(done) {
exec(cmd+'--help', function (error, stdout, stderr) {
assert(!error);
done();
});
});

it('--version should run without errors', function(done) {
exec(cmd+'--version', function (error, stdout, stderr) {
assert(!error);
done();
});
});

it('should return error on missing command', function(done) {
this.timeout(4000);

exec(cmd, function (error, stdout, stderr) {
assert(error);
assert.equal(error.code,1);
done();
});

});

});

0 comments on commit 5790be1

Please sign in to comment.