Skip to content

Commit

Permalink
Version 0.12.0 released.
Browse files Browse the repository at this point in the history
  • Loading branch information
outaTiME committed Apr 19, 2016
1 parent 96ae037 commit 6721a5e
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"node": true,
"sub": true,
"undef": true,
"unused": true
"unused": true,
"mocha": true
}
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
sudo: false

language: node_js

node_js:
- 'iojs'
- '0.12'
- '0.10'
- "0.10"
- "0.12"
- "4"
- "5"
- "iojs"

before_install:
- npm install -g broccoli-cli

matrix:
fast_finish: true

cache:
directories:
- node_modules
6 changes: 3 additions & 3 deletions Brocfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* broccoli-replace
*
* Copyright (c) 2015 outaTiME
* Copyright (c) 2016 outaTiME
* Licensed under the MIT license.
* https://github.com/outaTiME/broccoli-replace/blob/master/LICENSE-MIT
*/
Expand All @@ -13,9 +13,9 @@ var replace = require('./index');

module.exports = replace('test/fixtures', {
files: [
'simple.txt'
'simple.txt'
],
variables: {
key: 'value'
key: 'value'
}
});
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 outaTiME
Copyright (c) 2016 outaTiME

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ Default: `false`

If set to `true`, we preserve the patterns definition order, otherwise these will be sorted (in ascending order) to prevent replacement issues like `head` / `header` (typo regexps will be resolved at last).

#### detail
Type: `Boolean`
Default: `false`

If set to `true`, return an object response with the `content` and `detail` of replace operation.


### Usage Examples

Expand Down Expand Up @@ -500,6 +494,7 @@ module.exports = mergeTrees([replacer_op1, replacer_op2, replacer_op3]);

## Release History

* 2016-04-19   v0.12.0   Use broccoli-persistent-filter instead of broccoli-filter (thanks [@alexBaizeau](https://github.com/alexBaizeau))
* 2015-09-09   v0.11.0   Improvements in handling patterns. Fix plain object representation issue. More test cases.
* 2015-08-19   v0.10.0   Last [applause](https://github.com/outaTiME/applause) integration and package.json update.
* 2015-08-06   v0.3.3   Fix issue with special characters attributes ($$, $&, $`, $', $n or $nn) on JSON, YAML and CSON.
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ module.exports = mergeTrees([replacer_op1, replacer_op2, replacer_op3]);

## Release History

* 2016-04-19   v0.12.0   Use broccoli-persistent-filter instead of broccoli-filter (thanks [@alexBaizeau](https://github.com/alexBaizeau))
* 2015-09-09   v0.11.0   Improvements in handling patterns. Fix plain object representation issue. More test cases.
* 2015-08-19   v0.10.0   Last [applause](https://github.com/outaTiME/applause) integration and package.json update.
* 2015-08-06   v0.3.3   Fix issue with special characters attributes ($$, $&, $`, $', $n or $nn) on JSON, YAML and CSON.
Expand Down
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* broccoli-replace
*
* Copyright (c) 2015 outaTiME
* Copyright (c) 2016 outaTiME
* Licensed under the MIT license.
* https://github.com/outaTiME/broccoli-replace/blob/master/LICENSE-MIT
*/
Expand All @@ -12,10 +12,10 @@
// dependencies

var Filter = require('broccoli-persistent-filter');
var minimatch = require("minimatch");
var minimatch = require('minimatch');
var Applause = require('applause');

function ReplaceFilter (inputTree, options) {
function ReplaceFilter(inputTree, options) {
if (!(this instanceof ReplaceFilter)) {
return new ReplaceFilter(inputTree, options);
}
Expand All @@ -29,7 +29,7 @@ function ReplaceFilter (inputTree, options) {
ReplaceFilter.prototype = Object.create(Filter.prototype);
ReplaceFilter.prototype.constructor = ReplaceFilter;

ReplaceFilter.prototype.getDestFilePath = function (relativePath) {
ReplaceFilter.prototype.getDestFilePath = function(relativePath) {
var files = this.options.files || [];
for (var i = 0; i < files.length; i++) {
var pattern = files[i];
Expand All @@ -41,9 +41,11 @@ ReplaceFilter.prototype.getDestFilePath = function (relativePath) {
return null;
};

ReplaceFilter.prototype.processString = function (string) {
var result = this.applause.replace(string);
if (result === false) {
ReplaceFilter.prototype.processString = function(string) {
var res = this.applause.replace(string);
var result = res.content;
var count = res.count;
if (count === 0) {
// no replacements
return string;
}
Expand Down
31 changes: 25 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "broccoli-replace",
"description": "Replace text patterns with applause.",
"version": "0.11.0",
"version": "0.12.0",
"author": {
"name": "outaTiME",
"url": "http://outa.im/"
Expand All @@ -17,12 +17,12 @@
},
"dependencies": {
"broccoli-persistent-filter": "^1.2.0",
"minimatch": "^2.0.0",
"applause": "1.1.0"
"minimatch": "^3.0.0",
"applause": "1.2.2"
},
"devDependencies": {
"mocha": "^2.2.0",
"rimraf": "^2.4.0",
"mocha": "^2.4.0",
"rimraf": "^2.5.0",
"broccoli": "^0.16.0"
},
"keywords": [
Expand All @@ -44,5 +44,24 @@
"main": "index.js",
"files": [
"index.js"
]
],
"eslintConfig": {
"extends": [
"eslint:recommended"
],
"env": {
"node": true,
"mocha": true
},
"rules": {
"quotes": [
2,
"single"
],
"indent": [
2,
2
]
}
}
}
7 changes: 3 additions & 4 deletions scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* broccoli-replace
*
* Copyright (c) 2015 outaTiME
* Copyright (c) 2016 outaTiME
* Licensed under the MIT license.
* https://github.com/outaTiME/broccoli-replace/blob/master/LICENSE-MIT
*/
Expand Down Expand Up @@ -38,6 +38,5 @@ var options = {
}]
};
var applause = Applause.create(options);
var contents = fs.readFileSync('docs/README.md', 'utf8');
var result = applause.replace(contents);
fs.writeFileSync('README.md', result, 'utf8');
var result = applause.replace(fs.readFileSync('docs/README.md', 'utf8'));
fs.writeFileSync('README.md', result.content, 'utf8');
10 changes: 4 additions & 6 deletions test/replace_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* broccoli-replace
*
* Copyright (c) 2015 outaTiME
* Copyright (c) 2016 outaTiME
* Licensed under the MIT license.
* https://github.com/outaTiME/broccoli-replace/blob/master/LICENSE-MIT
*/
Expand All @@ -17,22 +17,20 @@ var rimraf = require('rimraf');

// test

afterEach(function () {
afterEach(function() {
rimraf.sync('temp');
});

describe('broccoli-replace', function () {
describe('broccoli-replace', function() {

var expect;
var result;

it('should replace simple key with value', function (done) {

it('should replace simple key with value', function(done) {
expect = 'value\n';
result = fs.readFileSync('temp/simple.txt', 'utf8');
assert.equal(result, expect);
done();

});

});

0 comments on commit 6721a5e

Please sign in to comment.