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

Commit

Permalink
Add the gulp-bump plugin to gulpfile.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurizio Turatti committed Mar 17, 2016
1 parent 3e722c9 commit 469fb54
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 30 deletions.
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ This module contains the following services:

For more information on Restangular refer to its [documentation](https://github.com/mgonto/restangular)

## Build and release a new version of this library

> Note: this section is for library's developers only.
1) set the VERSION number in **gulpfile.js** then

```
gulp build
```

The [gulp-bump](https://www.npmjs.com/package/gulp-bump) plugin automatically updates the version number in both **bower.json** and **package.json**.

2) `git tag` with the same VERSION

3) `git push` the new release.

4) Increase the VERSION number to the next one and run `gulp build' again, so that it's ready for the successive release.

## Installation

### Bower
Expand All @@ -38,9 +56,9 @@ Inject the two services into your Controller.
```javascript
.controller('MyCtrl', ['RhAuth', 'Rh',
function (RhAuth, Rh) {

// here your logic

}
});
```
Expand All @@ -58,15 +76,15 @@ You have to configure angular-restheart before using it.

`onUnauthenticated(callback)` to set the callback function the be called on `401 - Unauthorized`

`onTokenExpired(callback)` to set the callback function the be called on `401 - Unauthorized` due to token expiration
`onTokenExpired(callback)` to set the callback function the be called on `401 - Unauthorized` due to token expiration

The callback functions are passed two arguments: `$location` and `$state`, that can be used for redirection.
The callback functions are passed two arguments: `$location` and `$state`, that can be used for redirection.

Also, in case of errors the `rh_error` varible is set in the local storage:

```
rh_error: {"why": ["forbidded" | "expired" "not_authenticated"], "path": <path_where_error_occurred>, "state": <state_name_where_error_occurred>, "params": <state_params_object> }
```
```

### Configuration Example
```javascript
Expand Down Expand Up @@ -139,7 +157,7 @@ The two main public methods are `signin()` and `signout()`.
console.log("Not Authorized");
}
})

}
}])
```
Expand Down Expand Up @@ -167,10 +185,9 @@ The two main public methods are `signin()` and `signout()`.
function (Rh) {
$scope.simpleRestangularRequest = function () {
Rh.all('/db/coll').getList().then(function (documents) { // returns a list of the collection documents
console.log(documents);
console.log(documents);
})
}

}])
```

64 changes: 42 additions & 22 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,57 @@
/**
* IMPORTANT: set the version number here when ready for a new release
* then run the 'gulp build' task to update both bower.json and package.json
* See the README.md file for more information.
*/
var VERSION = '1.1.5';

var gulp = require('gulp'),
del = require('del'),
runSequence = require('run-sequence'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
del = require('del'),
runSequence = require('run-sequence'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
bump = require('gulp-bump');

// Update bower, component, npm at once:
gulp.task('bump', function() {
gulp.src(['./bower.json', './component.json', './package.json'])
.pipe(bump({
version: VERSION
}))
.pipe(gulp.dest('./'));
});

gulp.task('default', function(callback) {
runSequence('build', callback);
runSequence('build', callback);
});

gulp.task('build', function (callback) {
runSequence(
'clean',
'copy-build',
callback);
gulp.task('build', function(callback) {
runSequence(
'clean',
'bump',
'copy-build',
callback);
});


gulp.task('clean', function () {
return del(['./dist'], {force: true});
gulp.task('clean', function() {
return del(['./dist'], {
force: true
});
});

gulp.task('copy-build', [ 'concat-js','concat-min-js']);
gulp.task('copy-build', ['concat-js', 'concat-min-js']);


gulp.task('concat-js', function () {
return gulp.src(['./angular-restheart.module.js','./angular-restheart.config.js','./services/**/*.js','!node_modules{,/**}','!example/{,/**}','!gulpfile.js'])
.pipe(concat('angular-restheart.js'))
.pipe(gulp.dest('./dist'));
gulp.task('concat-js', function() {
return gulp.src(['./angular-restheart.module.js', './angular-restheart.config.js', './services/**/*.js', '!node_modules{,/**}', '!example/{,/**}', '!gulpfile.js'])
.pipe(concat('angular-restheart.js'))
.pipe(gulp.dest('./dist'));
});

gulp.task('concat-min-js', function () {
return gulp.src(['./angular-restheart.module.js','./angular-restheart.config.js','./services/**/*.js','!node_modules{,/**}','!example/{,/**}','!gulpfile.js'])
.pipe(concat('angular-restheart.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist'));
gulp.task('concat-min-js', function() {
return gulp.src(['./angular-restheart.module.js', './angular-restheart.config.js', './services/**/*.js', '!node_modules{,/**}', '!example/{,/**}', '!gulpfile.js'])
.pipe(concat('angular-restheart.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist'));
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-bump": "^2.0.1",
"gulp-concat": "^2.6.0",
"gulp-inject": "^3.0.0",
"gulp-uglify": "^1.5.3",
Expand Down

0 comments on commit 469fb54

Please sign in to comment.