Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
node_modules/*
src/jspm_packages/*
node_modules/
src/jspm_packages/
dist/

# TODO: Remove
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO remove?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Those files current go into root. I'd prefer them to be in build/ and dist/, but I haven't found a way to do so without breaking everything. Wherever they go, they should not be committed to the repo, but rather be generated in the by gulp build. For the time being, they're stuck in root until I find a better solution.

build.min.js
build.min.js.map
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js
node_js:
- '0.12'
before_install:
- npm install -g jspm
- jspm config registries.github.auth $RADIFY_JSPM_GITHUB_AUTH_TOKEN
before_script:
- npm install
- jspm install
script: gulp
env:
global:
secure: lPYM9GGMD1qyd4/zhRTGpipOtxHwtQ0EFxgNg9KjRBEMkTLHjeZI0JQNskn0E8ZYXbjYghdUFvXkAAED5F9d0igPRcuLtAau1iGnW2PGyK2rzHE/fpplWFYIdm65CtQP4hv0bEGw3UBx9WkFDqs7NiRTE5YiDh75woP88weI7oxqlfpJdyvMJgoSda87dBYkYVOHCaMGrLkXK3GQhR6eJ20WZIp0TCbiMYLEzpo45BDMZSf9K0yRPiJ9vA3bgWUJGqfW4Dt6k10pKD1Q5SE/WeingOphiBK5Lrfp+Y7i1JkOpPzRC5rDMwJJUbJQpUeAvrmDQCf9VUmrib2iBA5dpRAe4xgOmdNEZaJEjS9lSU+dOtcBHo9mrlJ9pEHSzJO7Q3oLQC8nq7bf/SP1ZlQUnWqtxM3eIUnkIYJTBtzzQkHC3qpa5OZvWHrJIGqj8E1Mafp+1YHhelCHhg+ePiy1sXUvWF+1w3FC8M3O51Q/9YhjetpoqeshjmMdwJaV/8+WMZBieFHLzgLGIySTK6YQUMkUppqmVg524AwTDmMvgfZtr8xN/eBX3SnrUZjW9ILk00qCU/Q6qc/6IczCRyaByBajG2jqePn0wM78F6fGUMVO2Cdpp0P3+uSzKDb8XA8Vp7T1c4JthZ2ljRgP/Lgp4lUD/qEO1qio4a36sd6OVjc=
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/radify/PR.js.svg)](https://travis-ci.org/radify/PR.js)

# PR.js

_Programatically validate pull requests against the [contribution guidelines](https://help.github.com/articles/setting-guidelines-for-repository-contributors/)_
Expand Down Expand Up @@ -34,7 +36,7 @@ Most projects have rules of some kind about how to submit pull requests, which o

**Test**

- [`http://localhost:3003/test.html`](http://localhost:3003/test.html)
- `gulp test`

### Roadmap

Expand Down
1 change: 0 additions & 1 deletion dist/app.min.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/img/PRjs.svg

This file was deleted.

1 change: 0 additions & 1 deletion dist/img/radify.svg

This file was deleted.

10 changes: 10 additions & 0 deletions gulp/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

var gulp = require('gulp');
var runSeq = require('run-sequence');

gulp.task('build', function(done) {
runSeq('clean', ['buildjs', 'buildcss', 'buildimg'], done);
});


19 changes: 19 additions & 0 deletions gulp/buildcss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');

// Build CSS for distribution.
gulp.task('buildcss', function () {
gulp.src(global.paths.css)
.pipe(concat('app.css'))
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(global.paths.dist));
});
16 changes: 16 additions & 0 deletions gulp/buildimg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');

// Build images for distribution.
gulp.task('buildimg', function () {
gulp.src(global.paths.img)
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest(global.paths.dist + '/img'));
});
16 changes: 16 additions & 0 deletions gulp/buildjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

var gulp = require('gulp');
var exec = require('child_process').execSync;

// Build JS for distribution.
gulp.task('buildjs', function () {
exec('npm run buildjs', function (err, stdout, stderr) {
if (err) {
throw err;
}
else {
console.log('Build complete!');
}
});
});
9 changes: 9 additions & 0 deletions gulp/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

var gulp = require('gulp');
var del = require('del');

// Empty the build dir.
gulp.task('clean', function (done) {
del([global.paths.dist + '/*'], done);
});
15 changes: 15 additions & 0 deletions gulp/serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

var gulp = require('gulp');
var connect = require('gulp-connect');

// Start local dev server.
gulp.task('serve', function() {
connect.server({
root: global.paths.index,
port: 3003,
livereload: true
});

console.log("Demo server started at localhost:3003");
});
10 changes: 10 additions & 0 deletions gulp/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

require('babel-core/register');

var gulp = require('gulp');
var jasmine = require('gulp-jasmine');

gulp.task('test', function () {
return gulp.src(global.paths.specs).pipe(jasmine({ includeStackTrace: true }));
});
43 changes: 35 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
'use strict';

/*
* gulpfile.js
* ===========
* Rather than manage one giant configuration file responsible
* for creating multiple tasks, each task has been broken out into
* its own file in the 'gulp' folder. Any files in that directory get
* automatically required below.
*
* To add a new task, simply add a new task file in that directory.
*/

var gulp = require('gulp');
var conn = require('gulp-connect');
var requireDir = require('require-dir');

global.paths = {
// CSS sources
'css': './css/*',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these comments are redundant, but that's just my preference.

https://sourcemaking.com/refactoring/comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although that's an excellent article, I disagree that, in this case, these comments are superfluous. My general rule for comments--aside from conforming to JavaDoc-style conventions on certain projects--looks something like this:

  1. Could a novice programmer take more than three seconds to understand some code? If so, either comment, refactor, or both.
  2. Is a comment turning into an explanation? If so, refactor.

I can delete these comments if that's what you would prefer.

// Distribution folder.
'dist': './dist',
// Image sources.
'img': './img/*',
// TODO: replace with ./src or ./build
'index': './',
// Sources folder.
'src': './src',
// Specs folder.
'spec': './spec',
// Specs glob.
'specs': './spec/**/*Spec.js'
};

gulp.task('serve', function() {
conn.server({
root: __dirname,
port: 3003
});
// Require all tasks in the 'gulp' folder.
requireDir('./gulp', { recurse: false });

console.log("Demo server started at localhost:3003");
});
// Default task; test & build
gulp.task('default', ['test', 'build']);
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
"name": "pr.js",
"version": "0.1.1",
"description": "Simple validation for pull request workflows",
"main": "index.js",
"scripts": {},
"main": "index.html",
"scripts": {
"buildjs": "jspm bundle-sfx pr.js build.min.js --minify",
"test": "gulp test"
},
"author": {
"name": "Radify, Inc.",
"email": "line@radify.io",
Expand Down Expand Up @@ -34,11 +37,23 @@
],
"dependencies": {},
"devDependencies": {
"babel-core": "^5.8.22",
"del": "^1.2.1",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-babel": "^5.2.1",
"gulp-concat": "^2.6.0",
"gulp-connect": "^2.2.0",
"gulp-uglify": "^1.2.0"
"gulp-imagemin": "^2.3.0",
"gulp-jasmine": "^2.0.1",
"gulp-minify-css": "^1.2.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.2.0",
"imagemin-pngquant": "^4.1.2",
"jasmine": "^2.3.2",
"jspm": "^0.16.1",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.2"
},
"bugs": {
"url": "https://github.com/radify/PR.js/issues"
Expand Down
11 changes: 0 additions & 11 deletions spec/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion spec/parsers/Message.js → spec/parsers/MessageSpec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Message from "parsers/Message";
import Message from "../../src/parsers/Message";

describe("parsers/Message", () => {
it("should pull the first commit message from a PR, split into lines", () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/parsers/Subject.js → spec/parsers/SubjectSpec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Subject from "parsers/Subject";
import Subject from "../../src/parsers/Subject";

describe("parsers/Subject", () => {
it("should split valid subject lines into object hash", () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/rules/HasSubject.js → spec/rules/HasSubjectSpec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HasSubject from "rules/HasSubject";
import HasSubject from "../../src/rules/HasSubject";

describe("rules/HasSubject", () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SquashedCommits from "rules/SquashedCommits";
import SquashedCommits from "../../src/rules/SquashedCommits";

describe("rules/SquashedCommits", () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SubjectFormat from "rules/SubjectFormat";
import SubjectFormat from "../../src/rules/SubjectFormat";

describe("rules/SubjectFormat", () => {

Expand Down
17 changes: 5 additions & 12 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ System.config({
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*",
"*Spec": "../spec/*.js",
"jasmineBoot": "https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.3/boot.js",
"jasmineHtml": "https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.3/jasmine-html.js",
"jasmine": "https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.3/jasmine.js"
"*Spec": "../spec/*.js"
},

map: {
"angular": "npm:angular@1.4.0-rc.2",
"angular-ui-router": "npm:angular-ui-router@0.2.15",
"babel": "npm:babel-core@5.8.22",
"babel-runtime": "npm:babel-runtime@5.8.20",
"core-js": "npm:core-js@1.1.1",
"babel-core": "npm:babel-core@5.8.22",
"babel-runtime": "npm:babel-runtime@5.2.17",
"core-js": "npm:core-js@0.9.8",
"marked": "npm:marked@0.3.3",
"ramda": "npm:ramda@0.14.0",
"github:jspm/nodelibs-process@0.1.1": {
Expand All @@ -33,14 +31,9 @@ System.config({
"npm:angular@1.4.0-rc.2": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:babel-runtime@5.8.20": {
"npm:core-js@0.9.8": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:core-js@1.1.1": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:ramda@0.14.0": {
"process": "github:jspm/nodelibs-process@0.1.1"
}
Expand Down
Loading