Skip to content

Commit

Permalink
v1.0.0 This updates to v2.0.0 of the library. It removes augments, ad…
Browse files Browse the repository at this point in the history
…ds in mapc, adds in better log formatting and options. There will be still some more stuff added to this but hopefully nothing changed or taken away of the syntax.
  • Loading branch information
jostylr committed Feb 26, 2017
1 parent 4061c6f commit e5122dc
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 34 deletions.
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ Folder.sync("jshint", function (input, args, name) {
var doc = this;
var options, globals;

var log = [], err, i, lines, line,
globhash, file, ind, shortname;
var log = [], err, i, lines, line, logcopy,
globhash, ind, shortname;

var plug = doc.plugins.jshint;

Expand All @@ -61,12 +61,9 @@ Folder.sync("jshint", function (input, args, name) {
globals = plug.globals.concat(args[1] || []);

if (args[2]) {
file = '';
shortname = args[2];
} else {
ind = name.indexOf(":");
file = name.slice(0, ind);
shortname = name.slice(ind +1,
shortname = name.slice(name.lastIndexOf(":")+1,
name.indexOf(doc.colon.v, ind) );
}

Expand Down Expand Up @@ -115,10 +112,12 @@ Folder.sync("jshint", function (input, args, name) {
}

if (log.length > 0 ) {
doc.log ("!! JSHint:" + shortname+"\n"+log.join("\n"));
logcopy = log.slice();
logcopy.unshift(shortname, "jshint Report");
doc.log.apply(doc, logcopy);
} else {
if (args[3] || plug.clean) {
doc.log("JSHint CLEAN: " + shortname);
doc.log(shortname, "jshint clean");
}
}

Expand Down Expand Up @@ -341,6 +340,7 @@ Folder.sync("minify", function (code, args) {
} );

var datefns = require('date-fns');
Folder.requires.datefns = datefns;
Folder.dash.date = [datefns, 0];
Folder.sync('date', function (date, args) {
var fn = args[0];
Expand Down Expand Up @@ -395,12 +395,12 @@ Folder.dash.lodash = [lodash, 1];
Folder.sync("lodash", function (input, args) {
if (args.length) {
var method = args[0];
if (lodash.hasOwnProperty(method)) {
if ( typeit(lodash[method], 'function') ) {
args[0] = input;
return lodash[method].apply(lodash, args);
} else {
// this is an error. need to come up with a warning.
doc.log("lodash error", method);
this.warn("lodash", "unrecognized method", method);
return input;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion lprc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ module.exports = function(Folder, args) {

args.src = ".";

require('litpro-jshint')(Folder, args);
//require('litpro-jshint')(Folder, args);

};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "literate-programming",
"description": "Fat command line for literate-programming",
"version": "0.10.2",
"version": "1.0.0",
"homepage": "https://github.com/jostylr/literate-programming",
"author": {
"name": "James Taylor",
Expand All @@ -20,7 +20,7 @@
"node": ">=4.0"
},
"dependencies":{
"literate-programming-cli" : "^1.1.2",
"literate-programming-cli" : "^2.0.0",
"jshint" : "^2.9.4",
"postcss" : "^5.2.8",
"autoprefixer" : "^6.6.0",
Expand Down
52 changes: 40 additions & 12 deletions project.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,37 @@ This is where the fat comes in.

_"html encodings"

`_"formatters"`


### Formatters

This is some custom formatters for the command line client

var oneArgOnly = _":one arg";
["jshint", "jshint clean"].
forEach(function (el) {
Folder.prototype.formatters[el] = oneArgOnly;
});


[one arg]()

This just lists the files that were saved.

function (list) {
var ret = '';
ret += list.map(
function (args) {
return args.shift();
}).
join("\n");
return ret;
}




# JShint

This checks for JS problems.
Expand Down Expand Up @@ -147,8 +175,8 @@ hints it. The first argument, if present, is a JSON object of options. The
var doc = this;
var options, globals;

var log = [], err, i, lines, line,
globhash, file, ind, shortname;
var log = [], err, i, lines, line, logcopy,
globhash, ind, shortname;

var plug = doc.plugins.jshint;

Expand All @@ -170,12 +198,14 @@ hints it. The first argument, if present, is a JSON object of options. The


[report logs]()

if (log.length > 0 ) {
doc.log ("!! JSHint:" + shortname+"\n"+log.join("\n"));
logcopy = log.slice();
logcopy.unshift(shortname, "jshint Report");
doc.log.apply(doc, logcopy);
} else {
if (args[3] || plug.clean) {
doc.log("JSHint CLEAN: " + shortname);
doc.log(shortname, "jshint clean");
}
}

Expand All @@ -194,12 +224,9 @@ I am not sure where that gets put so ignoring it.
globals = plug.globals.concat(args[1] || []);

if (args[2]) {
file = '';
shortname = args[2];
} else {
ind = name.indexOf(":");
file = name.slice(0, ind);
shortname = name.slice(ind +1,
shortname = name.slice(name.lastIndexOf(":")+1,
name.indexOf(doc.colon.v, ind) );
}

Expand Down Expand Up @@ -683,6 +710,7 @@ arguments, a new Date() is returned. If the first argument is not a known
method, then we assume it was a date to be parsed.

var datefns = require('date-fns');
Folder.requires.datefns = datefns;
Folder.dash.date = [datefns, 0];
Folder.sync('date', _":fun");

Expand Down Expand Up @@ -829,12 +857,12 @@ the incoming thing.
function (input, args) {
if (args.length) {
var method = args[0];
if (lodash.hasOwnProperty(method)) {
if ( typeit(lodash[method], 'function') ) {
args[0] = input;
return lodash[method].apply(lodash, args);
} else {
// this is an error. need to come up with a warning.
doc.log("lodash error", method);
this.warn("lodash", "unrecognized method", method);
return input;
}
} else {
Expand Down Expand Up @@ -1027,7 +1055,7 @@ help for those adapting to the new version.
["csv"],
["lodash"],
["he"]
].slice();
].slice(0);
tests.apply(null, files);

### test gitignore
Expand Down
6 changes: 3 additions & 3 deletions setup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [literate-programming](# "version:0.10.2; Fat command line for literate-programming")
# [literate-programming](# "version:1.0.0; Fat command line for literate-programming")

This is the command line portion of literate-programming. It depends on
literate-programming-lib.
Expand Down Expand Up @@ -40,7 +40,7 @@ current one and the default file to process is this one.

args.src = ".";

require('litpro-jshint')(Folder, args);
//require('litpro-jshint')(Folder, args);

};

Expand Down Expand Up @@ -149,7 +149,7 @@ A travis.yml file for continuous test integration!


by [James Taylor](https://github.com/jostylr "npminfo: jostylr@gmail.com ;
deps: literate-programming-cli 1.1.2, jshint 2.9.4,
deps: literate-programming-cli 2.0.0, jshint 2.9.4,
postcss 5.2.8, autoprefixer 6.6.0, pug 2.0.0-beta6,
markdown-it 8.2.2, cheerio 0.22.0, js-beautify 1.6.7,
html-minifier 3.2.3, clean-css 3.4.23, uglify-js 2.7.5,
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ var files = [["first", "first.md second.md -s ."],
["csv"],
["lodash"],
["he"]
].slice();
].slice(0);
tests.apply(null, files);
11 changes: 8 additions & 3 deletions tests/cheerio/canonical/out.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Problem with cheerio: .great,replace,<p>hi</p>
SAVED: ./build/out.html
DONE: ./build
# DOC: cheers.md
## 0
* Problem with cheerio: .great,replace,<p>hi</p>
# FOLDER LOGS
## SAVED
./build/out.html
## DONE
./build
2 changes: 1 addition & 1 deletion tests/logs/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ We'll do a crescendo of 1, 5, 10, 50, 100, 500, ....
i *= 2;
mat.push(fact(i));
}
ret = doc.augment(mat, "mat");
ret = new doc.Folder.Matrix(mat);


## Testing the factorial
Expand Down
4 changes: 3 additions & 1 deletion tests/primes/canonical/out.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
The first 20 primes are: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,49,53,59,61,67
DONE: ./build

## DONE
./build

0 comments on commit e5122dc

Please sign in to comment.