Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit

  • Loading branch information...
commit 019bdfb4d4aa252c4b907d6b11f1f9c2aac7fe8d 0 parents
@twilson63 authored
1  .gitignore
@@ -0,0 +1 @@
+node_modules
1  .npmignore
@@ -0,0 +1 @@
+node_modules
7 bin/get
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+
+var path = require('path');
+var fs = require('fs');
+var root = path.join(path.dirname(fs.realpathSync(__filename)), '..');
+
+require(root + '/index').get();
7 bin/post
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+
+var path = require('path');
+var fs = require('fs');
+var root = path.join(path.dirname(fs.realpathSync(__filename)), '..');
+
+require(root + '/index').post();
12 index.coffee
@@ -0,0 +1,12 @@
+request = require 'request'
+module.exports =
+ get: ->
+ request process.argv[2], (err, resp, body) ->
+ console.log body
+ post: ->
+ return console.log 'post [uri] [json] - required!' unless process.argv[2]
+ return console.log 'post [*uri] [json] - required!' unless process.argv[3]
+ json = JSON.stringify(JSON.parse(process.argv[3]))
+ return console.log 'valid json required!' unless json?
+ request.post uri: process.argv[2], json: json, (err, resp, body) ->
+ console.log body
30 index.js
@@ -0,0 +1,30 @@
+(function() {
+ var request;
+ request = require('request');
+ module.exports = {
+ get: function() {
+ return request(process.argv[2], function(err, resp, body) {
+ return console.log(body);
+ });
+ },
+ post: function() {
+ var json;
+ if (!process.argv[2]) {
+ return console.log('post [uri] [json] - required!');
+ }
+ if (!process.argv[3]) {
+ return console.log('post [*uri] [json] - required!');
+ }
+ json = JSON.stringify(JSON.parse(process.argv[3]));
+ if (json == null) {
+ return console.log('valid json required!');
+ }
+ return request.post({
+ uri: process.argv[2],
+ json: json
+ }, function(err, resp, body) {
+ return console.log(body);
+ });
+ }
+ };
+}).call(this);
16 package.json
@@ -0,0 +1,16 @@
+{
+ "name": "shake-n-bake",
+ "description": "Watch Something - When it (Shake)s then (Bake) do something else",
+ "version": "0.0.2",
+ "homepage": "",
+ "author": "Tom Wilson",
+ "private": false,
+ "dependencies": {
+ "request": ">= 0"
+ },
+ "devDependencies": {
+ "coffee-script": ">= 1.x.x",
+ "jasmine-node": ">= 0"
+ },
+ "engines": { "node": ">= 0.4.11" }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.