Skip to content

Commit

Permalink
Merge pull request #1 from benderTheCrime/feature/globalize
Browse files Browse the repository at this point in the history
Feature/globalize
  • Loading branch information
benderTheCrime committed Dec 20, 2015
2 parents 8e368f0 + ddd946a commit 3a70e2e
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 26 deletions.
13 changes: 12 additions & 1 deletion .editorconfig
@@ -1,3 +1,14 @@
[*.js]
root = true

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

[*.{js,es6}]
indent_size = 4

[*.json]
indent_size = 2
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -3,6 +3,8 @@ node_js:
- 0.12
- iojs-v2.5.0
- 4.0.0
- 5.0.0
- 5.3.0
deploy:
provider: npm
email: joe.groseclose@gmail.com
Expand Down
22 changes: 17 additions & 5 deletions README.md
Expand Up @@ -8,7 +8,7 @@ An extremely lightweight logging utility for NodeJS built in ES6
![node support](https://img.shields.io/badge/node-0.12.0+-brightgreen.svg "node support")
![npm downloads](https://img.shields.io/npm/dm/angie-log.svg "npm downloads")
![build status](https://travis-ci.org/benderTheCrime/angie-log.svg?branch=master "build status")
![code coverage](https://rawgit.com/angie-framework/angie-log/master/svg/coverage.svg "code coverage")
[![Coverage Status](https://coveralls.io/repos/benderTheCrime/angie-log/badge.svg?branch=master&service=github)](https://coveralls.io/github/benderTheCrime/angie-log?branch=master)
[![documentation](https://doc.esdoc.org/github.com/angie-framework/angie-log/badge.svg)](https://doc.esdoc.org/github.com/angie-framework/angie-log/ "documentation")

[![NPM](https://nodei.co/npm/angie-log.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/angie-log/)
Expand All @@ -23,9 +23,9 @@ Angie Log is designed as an extremely lightweight logging utility for NodeJS whi
```bash
npm i -g angie-log
```

#### If Used Standalone
```javascript
import {default as Log} from 'angie-log';
import { default as Log } from 'angie-log';

// Call a new logger with defaults
let logger = new Log({
Expand Down Expand Up @@ -67,7 +67,19 @@ Log.warn('test');
Log.error('test');
```

For a list of Frequently Asked Questions, please see the [FAQ](https://github.com/benderTheCrime/angie-log/blob/master/FAQ.md "FAQ") and the [CHANGELOG](https://github.com/benderTheCrime/angie-log/blob/master/CHANGELOG.md "CHANGELOG") for an up to date list of changes. Contributors to this Project are outlined in the [CONTRIBUTORS](https://github.com/benderTheCrime/angie-log/blob/master/CONTRIBUTORS.md "CONTRIBUTORS") file.
#### If Used in an Angie Application
Include the module in the same fashion as it is above, or wherever called modules are bound:
```javascript
@Controller
class Test {
constructor($Log) {
$Log.info('The log module was included in a controller');
}
}
```
The functions available on the Angie Log module are equivalent in either context.

For a list of Frequently Asked Questions, please see the [FAQ](https://github.com/benderTheCrime/angie-log/blob/master/md/FAQ.md "FAQ") and the [CHANGELOG](https://github.com/benderTheCrime/angie-log/blob/master/md/CHANGELOG.md "CHANGELOG") for an up to date list of changes. Contributors to this Project are outlined in the [CONTRIBUTORS](https://github.com/benderTheCrime/angie-log/blob/master/md/CONTRIBUTORS.md "CONTRIBUTORS") file.

### Angie
Please see the [site](http://benderthecrime.github.io/angie/) for information about the project, a quickstart guide, and documentation and the [CHANGELOG](https://github.com/benderTheCrime/angie/blob/master/CHANGELOG.md) for an up to date list of changes.
Please see the [site](http://benderthecrime.github.io/angie/) for information about the project, a quickstart guide, and documentation and the [CHANGELOG](https://github.com/benderTheCrime/angie/blob/master/md/CHANGELOG.md) for an up to date list of changes.
2 changes: 1 addition & 1 deletion bin/angie-log
Expand Up @@ -3,7 +3,7 @@
'use strict';

// TODO check to see that the most up to date version is installed
global.ANGIE_LOG_VERSION = '0.9.12';
global.ANGIE_LOG_VERSION = '0.10.0';

require('babel/register')({ ignore: false });
require('../src/services/$LogProvider');
2 changes: 1 addition & 1 deletion bin/angie-log-dist
Expand Up @@ -3,6 +3,6 @@
'use strict';

// TODO check to see that the most up to date version is installed
global.ANGIE_LOG_VERSION = '0.9.12';
global.ANGIE_LOG_VERSION = '0.10.0';

require('../dist/services/$LogProvider');
6 changes: 1 addition & 5 deletions gulpfile.babel.js
Expand Up @@ -7,7 +7,6 @@ import jscs from 'gulp-jscs';
import istanbul from 'gulp-istanbul';
import { Instrumenter } from 'isparta';
import mocha from 'gulp-mocha';
import cobertura from 'istanbul-cobertura-badger';
import babel from 'gulp-babel';
import esdoc from 'gulp-esdoc';
import { bold, red } from 'chalk';
Expand Down Expand Up @@ -48,9 +47,6 @@ gulp.task(
[ 'istanbul:dist' ],
mochaHandler.bind(null, 'dist', undefined)
);
gulp.task('cobertura', [ 'mocha:src' ], function(cb) {
cobertura('coverage/cobertura-coverage.xml', 'svg', cb);
});
gulp.task('babel', function() {
return gulp.src(SRC).pipe(babel({
comments: false
Expand Down Expand Up @@ -109,6 +105,6 @@ function mochaHandler(src, coverage = '/tmp') {
reportOpts: {
dir: coverage
},
reporters: [ 'text', 'text-summary', 'html', 'cobertura' ]
reporters: [ 'text', 'text-summary', 'lcov' ]
}));
}
8 changes: 6 additions & 2 deletions CHANGELOG.md → md/CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### [0.10.0] - 2015-10-07
#### Fixed
- Allow module to properly self-register via Angie

#### [0.9.12] - 2015-09-30
##### Changed
- Modified README
Expand Down Expand Up @@ -63,8 +67,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
##### Fixed
- Fixed imports, removed trivial files so this package can more easily be imported.

## [0.9.0] - 2015-07-07
### Added
### [0.9.0] - 2015-07-07
#### Added
- Modified project to be able to be imported
- Added ability to instantiate a custom logger (see README)
- Added many tests
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "angie-log",
"version": "0.9.12",
"version": "0.10.0",
"author": "Joe Groseclose <@benderTheCrime>",
"description": "An extremely lightweight logging utility for NodeJS built in ES6",
"license": "MIT",
Expand All @@ -12,7 +12,7 @@
"private": false,
"preferGlobal": true,
"scripts": {
"test": "gulp test",
"test": "gulp test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"postinstall": "babel src --out-dir dist --comments false"
},
"engines": {
Expand All @@ -39,6 +39,7 @@
"devDependencies": {
"babel-eslint": "^3.1.17",
"chai": "2.3.0",
"coveralls": "^2.11.6",
"gulp": "3.9.0",
"gulp-babel": "5.2.1",
"gulp-cli": "0.2.0",
Expand All @@ -48,7 +49,6 @@
"gulp-jscs": "1.6.0",
"gulp-mocha": "2.0.1",
"isparta": "3.0.3",
"istanbul-cobertura-badger": "0.0.4",
"simple-mock": "0.3.0",
"yargs": "^3.21.0"
},
Expand All @@ -57,4 +57,4 @@
"babel-core": "5.8.23",
"chalk": "1.0.0"
}
}
}
8 changes: 8 additions & 0 deletions src/services/$LogProvider.js
Expand Up @@ -425,4 +425,12 @@ function removeLeadingSlashes(str) {
return str.replace(/(^(\/))/, '');
}

// Declare the module in the Angie app space
if (
typeof app === 'object' &&
typeof app.factory === 'function'
) {
app.factory('$Log', $LogProvider);
}

export default $LogProvider;
1 change: 0 additions & 1 deletion svg/coverage.svg

This file was deleted.

18 changes: 12 additions & 6 deletions test/src/services/$LogProvider.spec.js
@@ -1,18 +1,24 @@
// Test Modules
import { expect, assert } from 'chai';
import simple, { mock, spy } from 'simple-mock';

// System Modules
import fs from 'fs';
import chalk, { bold } from 'chalk';
import fs from 'fs';
import chalk, { bold } from 'chalk';

// Test Modules
import { expect, assert } from 'chai';
import simple, { mock } from 'simple-mock';
global.app = { factory: spy() };
require.cache = {};

// Angie Log Modules
const Log = require(`../../../${global.TEST_ENV}/services/$LogProvider`),
const Log = require(`../../../${global.TEST_ENV}/services/$LogProvider`),
CWD = process.cwd();

describe('$LogProvider', function() {
const noop = () => false;

it('expect app to self-register', function() {
expect(global.app.factory.calls[0].args).to.deep.eq([ '$Log', Log ]);
});
describe('constructor', function() {
beforeEach(function() {
mock(Object, 'observe', noop);
Expand Down

0 comments on commit 3a70e2e

Please sign in to comment.