Skip to content

Commit

Permalink
feat: Upgrade to Polymer 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Grappendorf committed Jun 22, 2015
1 parent df9b0d9 commit 79b5116
Show file tree
Hide file tree
Showing 11 changed files with 300 additions and 230 deletions.
69 changes: 48 additions & 21 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
module.exports = function(grunt) {

var mapDotDotUrlToLib = function(req, res, next) {
var url_parts = req.url.split('/');
if (url_parts.length > 2 && ['lib', 'test'].indexOf(url_parts[1]) == -1) {
req.url = '/lib' + req.url;
}
return next();
};

grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),

Expand Down Expand Up @@ -44,7 +36,10 @@ module.exports = function(grunt) {
},

coffeelint: {
src: ['src/*.coffee']
src: ['src/*.coffee'],
options: {
max_line_length: { level: 'ignore' }
}
},

coffee: {
Expand All @@ -60,7 +55,7 @@ module.exports = function(grunt) {
htmlbuild: {
dist: {
src: 'src/*.html',
dest: './',
dest: 'build/',
options: {
scripts: {
dist: ['build/*.js']
Expand All @@ -75,19 +70,21 @@ module.exports = function(grunt) {
}
},

connect: {
server: {
options: {
port: 8080,
base: '.',
middleware: function(connect, options, middlewares) {
middlewares.unshift(mapDotDotUrlToLib);
return middlewares;
}
}
replace: {
dist: {
src: 'build/*.html',
dest: './',
replacements: [{
from: /href="..\/lib\/([^"]+)"/g,
to: 'href="../$1"'
}]
}
},

connect: {
server: {}
},

watch: {
stylesheets: {
files: 'src/*.less',
Expand Down Expand Up @@ -127,6 +124,12 @@ module.exports = function(grunt) {
changelog: {
options: {
}
},

shell: {
test: {
command: 'xvfb-run -a ./bin/grunt wct-test'
}
}
});

Expand All @@ -140,9 +143,33 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-html-build');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-text-replace');

grunt.registerTask('build', 'Compile all assets and create the distribution files',
['less', 'coffeelint', 'coffee', 'htmlbuild']);
['less', 'coffeelint', 'coffee', 'htmlbuild', 'replace']);

grunt.registerTask('wct-test', function() {
var
done = this.async(),
wct = require('web-component-tester'),
options = {
remote: false,
persistent: false,
root: '.',
plugins: {
local: {
browsers: ['chrome']
}
}
};
wct.test(options, function() {
done();
process.exit(0);
});
});

grunt.registerTask('test', 'Test the web application', ['shell:test']);

grunt.task.renameTask('bump', 'bumpversion');

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ grapp-rest-resource

A web component that encapsulates REST API calls.

Attributes
Properties
----------

* **url**
Expand Down
11 changes: 5 additions & 6 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"keywords": [
"web-components",
"polymer",
"coyoho",
"grappendorf"
],
"authors": [
Expand All @@ -32,12 +31,12 @@
"url": "git://github.com/grappendorf/grapp-rest-resource.git"
},
"dependencies": {
"polymer": "Polymer/polymer#~0.5.1",
"core-ajax": "Polymer/core-ajax#~0.5.1"
"polymer": "Polymer/polymer#~1.0.0",
"iron-ajax": "PolymerElements/iron-ajax#~1.0.0"
},
"devDependencies": {
"coffee-script": "latest",
"jquery": "latest",
"web-component-tester": "Polymer/web-component-tester#2.2.6"
"web-component-tester": "Polymer/web-component-tester#3.1.7",
"jquery": "2.1.4",
"coffee-script": "1.9.3"
}
}
Loading

0 comments on commit 79b5116

Please sign in to comment.