Skip to content
This repository has been archived by the owner on Dec 20, 2020. It is now read-only.

Commit

Permalink
Fix building
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrsmk committed Jul 29, 2015
1 parent 4df9c94 commit c517b34
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qwest 2.0.3
qwest 2.0.4
============

Qwest is a simple ajax library based on `promises` and that supports `XmlHttpRequest2` special data like `ArrayBuffer`, `Blob` and `FormData`.
Expand Down
2 changes: 1 addition & 1 deletion build/qwest.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 25 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ======================================== Prepare tasks

var fs = require('fs'),
gulp = require('gulp'),
size = require('gulp-sizereport'),
Expand All @@ -12,6 +10,19 @@ var fs = require('fs'),
merge = require('merge2'),
shell = require('gulp-shell');

// ======================================== Config

var replacements = {
browser: [
{regex: /PINKYSWEAR/, string: 'window.pinkySwear'},
{regex: /PARAM/, string: 'window.param'}
],
npm: [
{regex: /PINKYSWEAR/, string: "require('pinkyswear')"},
{regex: /PARAM/, string: "require('jquery-param')"}
]
};

// ======================================== gulp lint

gulp.task('lint', function() {
Expand All @@ -26,17 +37,18 @@ gulp.task('lint', function() {

gulp.task('build', ['lint'], function() {

var streams = merge();
var streams = merge(),
files = [
resolve.sync('jquery-param', {moduleDirectory: './node_modules'}),
resolve.sync('pinkyswear', {moduleDirectory: './node_modules'}),
'./src/qwest.js'
];

streams.add(
gulp.src([
resolve.sync('jquery-param', {moduleDirectory: './node_modules'}),
resolve.sync('pinkyswear', {moduleDirectory: './node_modules'}),
'./src/qwest.js'
])
gulp.src( files )
.pipe( concat('qwest.js') )
.pipe( replace(/<<PINKYSWEAR>>/, 'window.pinkySwear') )
.pipe( replace(/<<PARAM>>/, 'window.param') )
.pipe( replace(replacements.browser[0].regex, replacements.browser[0].string) )
.pipe( replace(replacements.browser[1].regex, replacements.browser[1].string) )
.pipe( size() )
.pipe( gulp.dest('./tests/') )
.pipe( uglify() )
Expand All @@ -46,14 +58,10 @@ gulp.task('build', ['lint'], function() {
);

streams.add(
gulp.src([
resolve.sync('jquery-param', {moduleDirectory: './node_modules'}),
resolve.sync('pinkyswear', {moduleDirectory: './node_modules'}),
'./src/qwest.js'
])
gulp.src( files )
.pipe( concat('qwest.js') )
.pipe( replace(/<<PINKYSWEAR>>/, "require('pinkySwear')") )
.pipe( replace(/<<PARAM>>/, "require('jquery-param')") )
.pipe( replace(replacements.npm[0].regex, replacements.npm[0].string) )
.pipe( replace(replacements.npm[1].regex, replacements.npm[1].string) )
.pipe( size() )
.pipe( uglify() )
.pipe( rename('qwest.min.js') )
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "qwest",
"description": "Ajax library with XHR2, promises and request limit",
"version": "2.0.3",
"version": "2.0.4",
"author": "Aurélien Delogu <pyrsmk@dreamysource.fr> (http://dreamysource.fr)",
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions src/qwest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! qwest 2.0.3 (https://github.com/pyrsmk/qwest) */
/*! qwest 2.0.4 (https://github.com/pyrsmk/qwest) */

;(function(context, name, definition) {
if(typeof module!='undefined' && module.exports) {
Expand Down Expand Up @@ -67,7 +67,7 @@
timeout_start,

// Create the promise
promise = <<PINKYSWEAR>>(function(pinky) {
promise = PINKYSWEAR(function(pinky) {
pinky['catch'] = function(f) {
return pinky.then(null, f);
};
Expand Down Expand Up @@ -305,7 +305,7 @@
data = JSON.stringify(data);
break;
case 'post':
data = <<PARAM>>(data);
data = PARAM(data);
}

// Prepare headers
Expand Down
2 changes: 1 addition & 1 deletion tests/qwest.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
})(typeof module == 'undefined' ? [window, 'pinkySwear'] : [module, 'exports']);


/*! qwest 2.0.3 (https://github.com/pyrsmk/qwest) */
/*! qwest 2.0.4 (https://github.com/pyrsmk/qwest) */

;(function(context, name, definition) {
if(typeof module!='undefined' && module.exports) {
Expand Down

0 comments on commit c517b34

Please sign in to comment.