Skip to content

Commit

Permalink
Merge pull request #17 from webrain/fix-bug-serialized
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
davidthou committed Jun 14, 2014
2 parents 1af61cb + 95973d7 commit 1ba5d9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tasks/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ exports.init = function (grunt) {

exports.replace_urls_in_serialized = function(search, replace, string) {
var length_delta = search.length - replace.length;
var searchRegExp = new RegExp(search, 'g');
var search_regexp = new RegExp(search, 'g');

// Replace for serialized data
var matches, length, delimiter, old_serialized_data, target_string, new_url, occurences;
Expand All @@ -112,12 +112,12 @@ exports.init = function (grunt) {

// If the string contains the url make the substitution
if (target_string.indexOf(search) !== -1) {
occurences = target_string.match(searchRegExp).length;
occurences = target_string.match(search_regexp).length;
length = matches[1];
delimiter = matches[2];

// Replace the url
new_url = target_string.replace(searchRegExp, replace);
new_url = target_string.replace(search_regexp, replace);
length -= length_delta * occurences;

// Compose the new serialized data
Expand Down
2 changes: 1 addition & 1 deletion test/deployments_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
},

replace_urls_in_serialized: function(test) {
test.expect(3);
test.expect(4);

var search = 'http://loremipsum';
var replace = 'http://www.loremipsum.com';
Expand Down

0 comments on commit 1ba5d9c

Please sign in to comment.