snapdrop

A Progressive Web App for local file sharing
git clone http://git.hanabi.in/repos/snapdrop.git
Log | Files | Refs | README | LICENSE

commit c962909c0e5214fc34ab95e3561d65a463cf50fe
parent aa9e9497d6ba290e3d0680dcbc1a462336cd33c0
Author: Robin Linus <robin_woll@capira.de>
Date:   Wed, 22 Jun 2016 14:10:27 -0600

Cleanup unused files

Diffstat:
D.travis.yml | 26--------------------------
DCONTRIBUTING.md | 72------------------------------------------------------------------------
MLICENSE.md | 2+-
Mapp/elements/buddy-finder/buddy-avatar.html | 11-----------
Mapp/elements/buddy-finder/buddy-finder.html | 1-
Mapp/elements/elements.html | 4+---
Mapp/elements/file-sharing/file-selection-behavior.html | 1-
Mapp/elements/p2p-network/binaryjs.html | 227-------------------------------------------------------------------------------
Mapp/elements/p2p-network/p2p-network.html | 1-
Mapp/elements/p2p-network/web-socket.html | 1-
Dapp/elements/routing.html | 38--------------------------------------
Dapp/elements/text-sharing/demo/index.html | 48------------------------------------------------
Dapp/elements/text-sharing/text-sharing.html | 0
Mapp/elements/x-cards/settings-page.html | 6------
Dapp/images/touch/JZH3ff5.png | 0
Dapp/images/touch/snapdrop-icon copy.png | 0
Mapp/index.html | 14--------------
Mapp/scripts/app.js | 12+-----------
Mapp/styles/main.css | 26--------------------------
Mapp/sw-import.js | 9---------
Dapp/test/index.html | 32--------------------------------
Dapp/test/my-greeting-basic.html | 50--------------------------------------------------
Dapp/test/my-list-basic.html | 65-----------------------------------------------------------------
Ddocs/README.md | 8--------
Ddocs/add-es2015-support-babel.md | 129-------------------------------------------------------------------------------
Ddocs/chrome-dev-editor.md | 52----------------------------------------------------
Ddocs/deploy-to-firebase-pretty-urls.md | 67-------------------------------------------------------------------
Ddocs/deploy-to-github-pages.md | 23-----------------------
Ddocs/mobile-chrome-apps.md | 131-------------------------------------------------------------------------------
Ddocs/polymer-perf.md | 100-------------------------------------------------------------------------------
Mserver/ws-server.js | 4++--
Dtasks/ensure-files.js | 34----------------------------------
Dtravis-runner.sh | 18------------------
33 files changed, 5 insertions(+), 1207 deletions(-)

diff --git a/.travis.yml b/.travis.yml @@ -1,26 +0,0 @@ -language: node_js -sudo: false -addons: - firefox: latest - apt: - sources: - - google-chrome - - ubuntu-toolchain-r-test - packages: - - google-chrome-stable - - g++-4.8 -node_js: - - '4.2' - - '5.1' -before_script: - - 'export DISPLAY=:99.0' - - sh -e /etc/init.d/xvfb start - - sleep 3 - - npm i -g bower gulp - - bower i -script: - - ./travis-runner.sh -env: - global: - - "CXX='g++-4.8'" - - secure: SbcQ7plU7aRGQlaAG2ffMhSvEs84073YSljOQ62DZAjRxgizMhF4xM7H2mPrmac9YRM4IBrQRvBKMMZy3L6OhN8gwpm8o+w2zV+5Q1fwpY9V8bilznnhp1JUY6jrB2l7aLTOFxt/cG+5ABxiupwWz/n+I7BaByYhBiHWntIBgDc528eecRNDYI5R36KWjLO/yr+SdElvyxDlDOdJGaluPvgMItbinFGcE1hYb/Jqrkkw8zpE6CTDmvMOq1aRBWSo9afgh2zDeKc02lTYP/4N0xcn8CqzHF7k5zGWHjN9DR8Ep8Bp1ff/sM7zHGZBqgVhn5WGv305jBQY6eOxiTp5cDP0WVIOjgJeM5rBu9hBQxhZSaMKBPr2B1NYUjIwTVQkBsnR4sr095Ugjg8JCZAmEevf/Ysl4CzQyW3gT+WcEluqjxUuicQWDclH6L/kOVPBJ+Eqdo/LY3G1tpLcc6fsvj4FlVO6LPTrbMyCagwQvnjX3uIdFyuthqtWWrHKQMGx2Ow9suNUi8Hyvk7WboS1Z6jrLIcs1rvXSX8rQmlMR5vJBK3Ejg6fS1OHxn/lrtLhj4lDLB9r/Fcu2PEHT1lcvQqsTa3W+t4Fk1qaShUlBDiwMbZWZgmlf1SdG5OzK1yrPLjTTdRFdqJGgb6TANCdetgczRWynvjIhr5IDMxvfJg= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md @@ -1,72 +0,0 @@ - -<!-- -This file is autogenerated based on -https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md - -If you edit that file, it will get updated everywhere else. -If you edit this file, your changes will get overridden :) ---> -# Polymer Elements -## Guide for Contributors - -Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines: - -### Filing Issues - -**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions: - - 1. **Who will use the feature?** _“As someone filling out a form…”_ - 2. **When will they use the feature?** _“When I enter an invalid value…”_ - 3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_ - -**If you are filing an issue to report a bug**, please provide: - - 1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug: - - ```markdown - The `paper-foo` element causes the page to turn pink when clicked. - - ## Expected outcome - - The page stays the same color. - - ## Actual outcome - - The page turns pink. - - ## Steps to reproduce - - 1. Put a `paper-foo` element in the page. - 2. Open the page in a web browser. - 3. Click the `paper-foo` element. - ``` - - 2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output). - - 3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers. - -### Submitting Pull Requests - -**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request. - -When submitting pull requests, please provide: - - 1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax: - - ```markdown - (For a single issue) - Fixes #20 - - (For multiple issues) - Fixes #32, #40 - ``` - - 2. **A succinct description of the design** used to fix any related issues. For example: - - ```markdown - This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked. - ``` - - 3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered. - -If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that! diff --git a/LICENSE.md b/LICENSE.md @@ -2,7 +2,7 @@ Everything in this repo is BSD style license unless otherwise specified. -Copyright (c) 2015 The Polymer Authors. All rights reserved. +Copyright (c) 2015 Robin Linus. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/app/elements/buddy-finder/buddy-avatar.html b/app/elements/buddy-finder/buddy-avatar.html @@ -127,50 +127,39 @@ return status; }, attached: function() { - // var adsDialog = document.querySelector('#ads'); this.async(function() { app.conn.addEventListener('file-offered', function(e) { if (e.detail.to === this.contact.peerId) { this.status = 'Waiting to accept...'; - //adsDialog.open(); } }.bind(this), false); app.conn.addEventListener('upload-started', function(e) { if (e.detail.to === this.contact.peerId) { this.status = 'Uploading...'; - // adsDialog.setState('Uploading...'); } }.bind(this), false); app.conn.addEventListener('download-started', function(e) { if (e.detail.from === this.contact.peerId) { this.status = 'Downloading...'; - //adsDialog.open(); - // adsDialog.setState('Downloading...'); } }.bind(this), false); app.conn.addEventListener('upload-complete', function(e) { if (e.detail.from === this.contact.peerId) { this.status = this.defaultStatus; - adsDialog.setState('Transfer Complete'); - // adsDialog.close(); } }.bind(this), false); app.conn.addEventListener('download-complete', function(e) { if (e.detail.from === this.contact.peerId) { this.status = this.defaultStatus; - adsDialog.setState('Transfer Complete'); - // adsDialog.close(); } }.bind(this), false); app.conn.addEventListener('file-declined', function(e) { if (e.detail.from === this.contact.peerId) { this.status = this.defaultStatus; - // adsDialog.close(true); } }.bind(this), false); app.conn.addEventListener('upload-error', function(e) { this.status = this.defaultStatus; - // adsDialog.close(); }.bind(this), false); }, 200); } diff --git a/app/elements/buddy-finder/buddy-finder.html b/app/elements/buddy-finder/buddy-finder.html @@ -167,7 +167,6 @@ var peerId = e.model.item.peerId; var file = e.detail; app.conn.sendFile(peerId, file); - //document.querySelector('#ads').open(); }, _computeShowExplanation: function(nBuddies) { if (!nBuddies || nBuddies === 0) { diff --git a/app/elements/elements.html b/app/elements/elements.html @@ -3,9 +3,7 @@ <link rel="import" href="../bower_components/paper-toast/paper-toast.html"> <link rel="import" href="../bower_components/paper-progress/paper-progress.html"> <link rel="import" href="../bower_components/neon-animation/neon-animated-pages.html"> -<!-- Configure your routes here -<link rel="import" href="routing.html"> ---> + <!-- Add your elements here --> <link rel="import" href="../styles/app-theme.html"> <link rel="import" href="x-cards/about-page.html"> diff --git a/app/elements/file-sharing/file-selection-behavior.html b/app/elements/file-sharing/file-selection-behavior.html @@ -8,7 +8,6 @@ Chat.FileSelectionBehavior = { return; } this._fileSelected(files[0]); //single select - //files.forEach(this._fileSelected.bind(this)); //multi-select }, _fileSelected: function(file) { if (file) { diff --git a/app/elements/p2p-network/binaryjs.html b/app/elements/p2p-network/binaryjs.html @@ -982,234 +982,7 @@ BlobReadStream.prototype._emitReadChunk = function(){ }; -/* - - - -function BlobWriteStream(options){ - - stream.Stream.call(this); - - options = _.extend({ - onFull: onFull, - onEnd: function(){}, - minBlockAllocSize: 0, - drainDelay:0 - }, options); - - this._onFull = options.onFull; - this._onEnd = options.onEnd; - this._onWrite = options.onWrite; - - this._minBlockAllocSize = options.minBlockAllocSize; - this._maxBlockAllocSize = options.maxBlockAllocSize; - this._drainDelay = options.drainDelay; - - this._buffer = new Buffer(options.minBlockAllocSize); - this._destination = this._buffer; - this._destinationPos = 0; - - this._writeQueue = []; - this._pendingOnFull = false; - this._pendingQueueDrain = false; - - this.writable = true; - this.bytesWritten = 0; -} - -util.inherits(BlobWriteStream, stream.Stream); - -BlobWriteStream.prototype.getBuffer = function(){ - return this._buffer; -}; - -BlobWriteStream.prototype.write = function(data, encoding){ - - if(!this.writable){ - throw new Error("stream is not writable"); - } - - if(!Buffer.isBuffer(data)){ - data = new Buffer(data, encoding); - } - - if(data.length){ - this._writeQueue.push(data); - } - - this._commit(); - - return this._writeQueue.length === 0; -}; - -BlobWriteStream.prototype._commit = function(){ - - var self = this; - - var destination = this._destination; - var writeQueue = this._writeQueue; - - var startDestinationPos = this._destinationPos; - - while(writeQueue.length && destination.length){ - - var head = writeQueue[0]; - - var copySize = Math.min(destination.length, head.length); - - head.copy(destination, 0, 0, copySize); - - head = head.slice(copySize); - destination = destination.slice(copySize); - - this.bytesWritten += copySize; - this._destinationPos += copySize; - - if(head.length === 0){ - writeQueue.shift(); - } - else{ - writeQueue[0] = head; - } - } - - this._destination = destination; - - bytesCommitted = this._destinationPos - startDestinationPos; - if(bytesCommitted){ - if(this._onWrite){ - - if(writeQueue.length){ - this._pendingQueueDrain = true; - } - - // By locking destination the buffer is frozen and the onWrite - // callback cannot miss any write commits - this._destination = emptyBuffer; - - var consumer = this._onWrite; - this._onWrite = null; - - consumer.call(this, function(nextCallback){ - util.setZeroTimeout(function(){ - self._destination = destination; - self._onWrite = nextCallback; - self._commit(); - }); - }, consumer); - - return; - } - } - - if(writeQueue.length){ - - this._pendingQueueDrain = true; - this._growBuffer(); - } - else if(this._pendingQueueDrain){ - - this._pendingQueueDrain = false; - - if(this._drainDelay !== 0){ - setTimeout(function(){ - self.emit("drain"); - }, this._drainDelay); - } - else{ - util.setZeroTimeout(function(){ - self.emit("drain"); - }); - } - } -}; - -BlobWriteStream.prototype._growBuffer = function(){ - - var self = this; - var writeQueue = this._writeQueue; - - var requestSize = this._minBlockAllocSize; - - var maxBlockAllocSize = this._maxBlockAllocSize; - var add = (maxBlockAllocSize === undefined ? function(a, b){return a + b;} : function(a, b){return Math.min(a + b, maxBlockAllocSize);}); - - for(var i = 0, queueLength = writeQueue.length; i < queueLength; i++){ - requestSize = add(requestSize, writeQueue[i].length); - } - - // Prevent concurrent onFull callbacks - if(this._pendingOnFull){ - return; - } - this._pendingOnFull = true; - - this._onFull(this._buffer, requestSize, function(buffer, destination){ - util.setZeroTimeout(function(){ - - self._pendingOnFull = false; - - if(!destination){ - if(self.writable){ - self.emit("error", new Error("buffer is full")); - } - self.destroy(); - return; - } - - self._buffer = buffer; - self._destination = destination; - - self._commit(); - }); - }); -}; - -BlobWriteStream.prototype.end = function(data, encoding){ - - var self = this; - - function _end(){ - self.writable = false; - self._onEnd(); - } - - if(data){ - if(this.write(data, encoding)){ - _end(); - }else{ - self.writable = false; - this.once("drain", _end); - } - } - else{ - _end(); - } -}; - -BlobWriteStream.prototype.destroy = function(){ - this.writable = false; - this._pendingQueueDrain = false; - this._writeQueue = []; -}; - -BlobWriteStream.prototype.consume = function(consume){ - - this._buffer = this._buffer.slice(consume); - this._destinationPos -= consume; -}; - -BlobWriteStream.prototype.getCommittedSlice = function(){ - return this._buffer.slice(0, this._destinationPos); -}; - -function onFull(buffer, extraSize, callback){ - var newBuffer = new Buffer(buffer.length + extraSize); - buffer.copy(newBuffer); - callback(newBuffer, newBuffer.slice(buffer.length)); -} -*/ exports.BlobReadStream = BlobReadStream; function BinaryStream(socket, id, create, meta) { diff --git a/app/elements/p2p-network/p2p-network.html b/app/elements/p2p-network/p2p-network.html @@ -109,7 +109,6 @@ console.log(err); if (err.message.indexOf('Connection is not open') > -1) { console.error('Handle this error!!', err); - //this.connectToPeer(requestedPeer, callback); } }.bind(this)); diff --git a/app/elements/p2p-network/web-socket.html b/app/elements/p2p-network/web-socket.html @@ -33,7 +33,6 @@ parts.push(data); } }.bind(this)); - // when finished, set it as the background image stream.on('end', function() { var blob = new Blob(parts, { type: meta.type diff --git a/app/elements/routing.html b/app/elements/routing.html @@ -1,38 +0,0 @@ -<script src="../bower_components/page/page.js"></script> -<script> - window.addEventListener('WebComponentsReady', function() { - - // We use Page.js for routing. This is a Micro - // client-side router inspired by the Express router - // More info: https://visionmedia.github.io/page.js/ - - // Removes end / from app.baseUrl which page.base requires for production - if (window.location.port === '') { // if production - page.base(app.baseUrl.replace(/\/$/, '')); - } - - - page('/', function() { - app.route = 'home'; - }); - - page(app.baseUrl, function() { - app.route = 'home'; - }); - - - - // 404 - page('*', function() { - app.$.toast.text = 'Can\'t find: ' + window.location.href + '. Redirected you to Home Page'; - app.$.toast.show(); - page.redirect(app.baseUrl); - }); - - // add #! before urls - page({ - hashbang: true - }); - - }); -</script> diff --git a/app/elements/text-sharing/demo/index.html b/app/elements/text-sharing/demo/index.html @@ -1,47 +0,0 @@ -<!doctype html> -<!-- -@license -Copyright (c) 2015 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt ---> -<html> -<head> - - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> - - <title>paper-dialog demo</title> - - <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.js"></script> - - <link rel="import" href="../text-input-dialog.html"> - <link rel="import" href="../../../bower_components/paper-button/paper-button.html"> - <link rel="import" href="../../../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html"> - <link rel="import" href="../../../bower_components/paper-styles/color.html"> - <link rel="import" href="../../../bower_components/paper-styles/demo-pages.html"> - <link rel="import" href="../../../bower_components/neon-animation/neon-animations.html"> - <link rel="import" href="../../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html"> - <link rel="import" href="../../../bower_components/paper-menu/paper-menu.html"> - <link rel="import" href="../../../bower_components/paper-item/paper-item.html"> - - <link rel="stylesheet" href="../../../paper-styles/demo.css"> - - -</head> -<body> - - <text-input-dialog></text-input-dialog> - - - <script> - document.querySelector("text-input-dialog").open(); - - </script> - -</body> -</html> -\ No newline at end of file diff --git a/app/elements/text-sharing/text-sharing.html b/app/elements/text-sharing/text-sharing.html diff --git a/app/elements/x-cards/settings-page.html b/app/elements/x-cards/settings-page.html @@ -13,12 +13,6 @@ background-color: #4285f4; @apply(--layout-fit); } - /* paper-icon-button { - position: absolute; - top: 16px; - right: 16px; - z-index: 2; - }*/ #container { @apply(--layout-fit); diff --git a/app/images/touch/JZH3ff5.png b/app/images/touch/JZH3ff5.png Binary files differ. diff --git a/app/images/touch/snapdrop-icon copy.png b/app/images/touch/snapdrop-icon copy.png Binary files differ. diff --git a/app/index.html b/app/index.html @@ -95,20 +95,6 @@ ga('create', 'UA-71686975-1', 'auto'); ga('send', 'pageview'); </script> - <!-- <div id="ads"> - <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> - <ins class="adsbygoogle" style="display:inline-block;width:320px;height:100px" data-ad-client="ca-pub-9914824802194583" data-ad-slot="1331757352"></ins> - <script> - (adsbygoogle = window.adsbygoogle || []).push({}); - </script> - </div> - <div id="ads2"> - <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> - <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-9914824802194583" data-ad-slot="4027871759"></ins> - <script> - (adsbygoogle = window.adsbygoogle || []).push({}); - </script> - </div> --> </body> </html> diff --git a/app/scripts/app.js b/app/scripts/app.js @@ -1,18 +1,11 @@ (function(document) { 'use strict'; - // Grab a reference to our auto-binding template - // and give it some initial binding values - // Learn more about auto-binding templates at http://goo.gl/Dx1u2g var app = document.querySelector('#app'); // Sets app default base URL app.baseUrl = '/'; - if (window.location.port === '') { // if production - // Uncomment app.baseURL below and - // set app.baseURL to '/your-pathname/' if running from folder in production - // app.baseUrl = '/polymer-starter-kit/'; - } + // don't display the install prompt if the user has *already* installed window.addEventListener('beforeinstallprompt', function(event) { @@ -49,9 +42,6 @@ }); app._showAbout=function(){ - document.querySelector('#pages').select(1); - }; - app._showAbout=function(){ document.querySelector('#pages').select(0); }; })(document); diff --git a/app/styles/main.css b/app/styles/main.css @@ -14,29 +14,3 @@ body { overflow-x: hidden; } -#ads, -#ads2 { - display: none; -} - -@media screen and (min-width: 520px) { - #ads { - display: block; - position: absolute; - top: 8px; - left: 50%; - margin-left: -150px; - } -} - -@media screen and (min-width: 720px) { - #ads{ - display: none; - } - #ads2 { - display: block; - position: absolute; - bottom: 4px; - left: 4px; - } -} diff --git a/app/sw-import.js b/app/sw-import.js @@ -1,10 +1 @@ -/* -Copyright (c) 2015 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ - importScripts('bower_components/platinum-sw/service-worker.js'); diff --git a/app/test/index.html b/app/test/index.html @@ -1,32 +0,0 @@ -<!doctype html> -<!-- -@license -Copyright (c) 2015 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt ---> - -<html> - - <head> - <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> - <title>Elements Test Runner</title> - <meta charset="UTF-8"> - - <script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> - <script src="../bower_components/web-component-tester/browser.js"></script> - </head> - - <body> - - <script> - WCT.loadSuites(['my-greeting-basic.html', 'my-list-basic.html']); - </script> - - - </body> - -</html> diff --git a/app/test/my-greeting-basic.html b/app/test/my-greeting-basic.html @@ -1,50 +0,0 @@ -<!doctype html> -<!-- -@license -Copyright (c) 2015 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt ---> - -<html> -<head> - <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> - <title>my-greeting-basic</title> - - <script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> - <script src="../bower_components/web-component-tester/browser.js"></script> - - <!-- Import the element to test --> - <link rel="import" href="../elements/my-greeting/my-greeting.html"> - -</head> -<body> - - <test-fixture id="basic"> - <template> - <my-greeting></my-greeting> - </template> - </test-fixture> - - <script> - - suite('my-greeting tests', function() { - var greeting, header; - - setup(function() { - greeting = fixture('basic'); - }); - - test('Welcome!', function() { - header = greeting.querySelector('h2'); - assert.equal(header.textContent, 'Welcome!'); - }); - - }); - </script> - -</body> -</html> diff --git a/app/test/my-list-basic.html b/app/test/my-list-basic.html @@ -1,65 +0,0 @@ -<!doctype html> -<!-- -@license -Copyright (c) 2015 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt ---> - -<html> -<head> - <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> - <title>my-list-basic</title> - - <script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> - <script src="../bower_components/web-component-tester/browser.js"></script> - - <!-- Import the element to test --> - <link rel="import" href="../elements/my-list/my-list.html"> - -</head> -<body> - - <test-fixture id="basic"> - <template> - <my-list></my-list> - </template> - </test-fixture> - - <script> - suite('my-list tests', function() { - var list, listItems; - - setup(function() { - list = fixture('basic'); - }); - - test('Item lengths should be equalled', function(done) { - // Test a property - // TODO: Fix list.items.push('Foo') causing a WeakMap exception - // Invalid value used as weak map key - list.items = [ - 'Responsive Web App boilerplate', - 'Iron Elements and Paper Elements', - 'End-to-end Build Tooling (including Vulcanize)', - 'Unit testing with Web Component Tester', - 'Routing with Page.js', - 'Offline support with the Platinum Service Worker Elements' - ]; - - // Data bindings will stamp out new DOM asynchronously - // so wait to check for updates - flush(function() { - listItems = list.querySelectorAll('li'); - assert.equal(list.items.length, listItems.length); - done(); - }); - }) - }); - </script> - -</body> -</html> diff --git a/docs/README.md b/docs/README.md @@ -1,8 +0,0 @@ -# Recipes - -* [Add ES2015 (formally ES6) support using Babel](add-es2015-support-babel.md) -* [Polymer Performance Recipe](polymer-perf.md) -* [Use PSK with Chrome Dev Editor](chrome-dev-editor.md) -* [Deploy to Github Pages](deploy-to-github-pages.md) -* [Deploy to Firebase using Pretty URLs](deploy-to-firebase-pretty-urls.md) -* [Use PSK for Mobile Chrome Apps](mobile-chrome-apps.md) diff --git a/docs/add-es2015-support-babel.md b/docs/add-es2015-support-babel.md @@ -1,129 +0,0 @@ -# Add ES2015 support through Babel - -Although support for ES2015 (formerly ES6) is improving in modern browsers, the majority do not yet support the full set of features. To benefit from the awesomeness of the new ES2015 syntax while keeping backwards compatibility with Polymer's supported browsers, you'll need to transpile your JS code from ES2015 to ES5 - -This recipe focuses on adding an ES2015 to ES5 transpile step to Share With Me's build pipeline using [BabelJS](https://babeljs.io/). - - -## Create a transpile gulp task - -- Install the gulp Babel, Sourcemap, Crisper plugins and Babel ES2015 preset: `npm install --save-dev gulp-babel gulp-sourcemaps gulp-crisper babel-preset-es2015` -- Add the following gulp task in the `gulpfile.js` file: - -```patch -+ // Transpile all JS to ES5. -+ gulp.task('js', function () { -+ return gulp.src(['app/**/*.{js,html}', '!app/bower_components/**/*']) -+ .pipe($.sourcemaps.init()) -+ .pipe($.if('*.html', $.crisper({scriptInHead:false}))) // Extract JS from .html files -+ .pipe($.if('*.js', $.babel({ -+ presets: ['es2015'] -+ }))) -+ .pipe($.sourcemaps.write('.')) -+ .pipe(gulp.dest('.tmp/')) -+ .pipe(gulp.dest(dist())); -+ }); -``` - -This task will transpile all JS files and inline JS inside HTML files and also generate sourcemaps. The resulting files are generated in the `.tmp` and the `dist` folders - -[Crisper](https://github.com/PolymerLabs/crisper) extracts JavaScript that's inline to HTML files (such as imports). We need this as Babel does not support transpiling HTML files such as `<script>` tags directly - -Note: At the time of writing Crisper does not generate the sourcemaps. Your app will work but you won't get sourcemaps for files transformed by Crisper. Relevant issues: - - - [ragingwind/gulp-crisper#4](https://github.com/ragingwind/gulp-crisper/issues/4) - - [PolymerLabs/crisper#14](https://github.com/PolymerLabs/crisper/issues/14) - - -## Integrating the transpile task - -Make sure the `js` gulp task is triggered by the common build tasks: - - - In the gulp `serve` task, make sure `js` is triggered initially and on HTML and JS files changes: - -```patch --gulp.task('serve', ['lint', 'styles', 'elements', 'images'], function () { -+gulp.task('serve', ['lint', 'styles', 'elements', 'images', 'js'], function () { - - ... - -- gulp.watch(['app/**/*.html'], reload); -+ gulp.watch(['app/**/*.html'], ['js', reload]); - gulp.watch(['app/styles/**/*.css'], ['styles', reload]); - gulp.watch(['app/elements/**/*.css'], ['elements', reload]); -- gulp.watch(['app/{scripts,elements}/**/{*.js,*.html}'], ['lint']); -+ gulp.watch(['app/{scripts,elements}/**/{*.js,*.html}'], ['lint', 'js']); - gulp.watch(['app/images/**/*'], reload); -}); -``` - - - In the `default` task make sure `js` is run in parallel to `elements`: - -```patch -gulp.task('default', ['clean'], function (cb) { - - ... - - runSequence( - ['copy', 'styles'], -- 'elements', -+ ['elements', 'js'], - ['lint', 'images', 'fonts', 'html'], - 'vulcanize', // 'cache-config', - cb); -}); -``` - - - In the `html` task replace `app` in the paths by `dist` since dist should already contain all JS and HTML files now transpiled. - - ```patch - // Scan your HTML for assets & optimize them - gulp.task('html', function () { - return optimizeHtmlTask( -- ['app/**/*.html', '!app/{elements,test}/**/*.html'], -+ [dist('/**/*.html'), '!' + dist('/{elements,test}/**/*.html')], - dist()); - }); - ``` - - - - In the `optimizeHtmlTask` function remove the `searchPath` attribute since all assets should be found under the `dist` folder and we want to make sure we are not picking up duplicates and un-transpiled JS files: - -```patch -var optimizeHtmlTask = function (src, dest) { -- var assets = $.useref.assets({searchPath: ['.tmp', 'app', 'dist']}); -+ var assets = $.useref.assets(); -``` - - -## Configure linters for ES2015 - -- Enable ES2015 support in JSCS. Add `"esnext": true` to the `.jscsrc` file: - -```patch -{ -+ "esnext": true, - "preset": "google", - "disallowSpacesInAnonymousFunctionExpression": null, - "excludeFiles": ["node_modules/**"] -} -``` - -- Enable ES2015 support in JSHint. Add `"esnext": true` to the `.jshintrc` file: - -```patch -{ -+ "esnext": true, - "node": true, - "browser": true, -``` - -## Optional - When using shadow-dom instead shady-dom -Place this configuration ([Read more](https://www.polymer-project.org/1.0/docs/devguide/settings.html)) in a separate file like `scripts/polymer-settings` - -```html -<script> - window.Polymer = window.Polymer || {}; - window.Polymer.dom = 'shadow'; -</script> -``` diff --git a/docs/chrome-dev-editor.md b/docs/chrome-dev-editor.md @@ -1,52 +0,0 @@ -# Use Share With Me on Chrome Dev Editor - -If you are using a Chromebook, one of the few IDE you can use is [Chrome Dev Editor](https://github.com/GoogleChrome/chromedeveditor). - -To use the Share With Me you have to download the [latest release](https://github.com/PolymerElements/polymer-starter-kit/releases) in the `light` flavor (the additional tools can't be used from CDE). - -After downloading the `polymer-starter-kit-light-*.zip` file unpack it in a new folder (for Example `psk-light`) you should have a directory structure like - -![psk-light-folder-p1](https://cloud.githubusercontent.com/assets/1431346/9451900/a73ffcf2-4ab1-11e5-8742-e0b5523ba9d5.png) - - -Before opening the folder inside CDE, we need to move the file `bower.json` to `app/bower.json`, this way running `Bower Update` from CDE's menu, will place the updated packages in `app/bower_components` - -![bower json-post](https://cloud.githubusercontent.com/assets/1431346/9452119/c5826a46-4ab2-11e5-96c5-00cf404d9c50.png) - - -We can now `Open Folder...` inside CDE and start renaming the file `app/manifest.json` to `app/web-app-manifest.json`, followed by updating the link to it in the file `app/index.html` - -![manifest json](https://cloud.githubusercontent.com/assets/1431346/9452182/27e41478-4ab3-11e5-8e40-d7c0f1249feb.png) - - -*This change is needed because `manifest.json` is interpreted by CDE as a [Chrome Apps Manifest](https://developer.chrome.com/extensions/manifest) and the [web app manifest](https://w3c.github.io/manifest/) is slightly different* - -Open `app/elements/routing.html` and add the following code after the last route: - -```javascript -page('*', function () { - app.route = 'home'; -}); -``` - -After the change, the code will look like the following: - -```javascript -... -page('/contact', function () { - app.route = 'contact'; -}); - -page('*', function () { - app.route = 'home'; -}); - -// add #! before urls -page({ - hashbang: true -}); -... -``` - - -Select `app/index.html` and hit run (or press CTRL+R) to see the application running in the browser. diff --git a/docs/deploy-to-firebase-pretty-urls.md b/docs/deploy-to-firebase-pretty-urls.md @@ -1,67 +0,0 @@ -# Deploy to Firebase using Pretty URLs - -Firebase is a very simple and secure way to deploy a Share With Me site. You can sign up for a free account and deploy your application in less than 5 minutes. - -The instructions below are based on the [Firebase hosting quick start -guide](https://www.firebase.com/docs/hosting/quickstart.html). - -1. [Sign up for a Firebase account](https://www.firebase.com/signup/) - -1. Install the Firebase command line tools - - npm install -g firebase-tools - - The `-g` flag instructs `npm` to install the package globally so that you - can use the `firebase` command from any directory. You may need - to install the package with `sudo` privileges. - -1. `cd` into your project directory - -1. Inititalize the Firebase application - - firebase init - - Firebase asks you which app you would like to use for hosting. If you just - signed up, you should see one app with a randomly-generated name. You can - use that one. Otherwise go to - [https://www.firebase.com/account](https://www.firebase.com/account) to - create a new app. - -1. Firebase asks you the name of your app's public directory. Enter `dist`. - This works because when you run `gulp` to build your application, PSK - builds everything and places it all in `dist`. So `dist` contains - everything your application needs to run. - -1. Edit firebase.json add rewrites section - - { - "firebase": "polymer-starter-kit", - "public": "dist", - "ignore": [ - "firebase.json", - "**/.*", - "**/node_modules/**" - ], - "rewrites": [ { - "source": "**", - "destination": "/index.html" - } ] - } - -1. Add `<base href="/">` to `head` in index.html - -1. Remove `hashbang: true` in routing.html near bottom. The call to `page` should look like this now: - - page(); - -1. Build - - gulp - -1. Deploy - - firebase deploy - - The URL to your live site is listed in the output. - -You can see a demo of Share With Me hosted on Firebase using pretty URLs at https://polymer-starter-kit.firebaseapp.com. diff --git a/docs/deploy-to-github-pages.md b/docs/deploy-to-github-pages.md @@ -1,23 +0,0 @@ -# Deploy to Github Pages - -You can deploy to github pages with a couple minor changes to Share With Me: - -1. Uncomment this line `// app.baseUrl = '/polymer-starter-kit/';` in app.js near the top - - ```JavaScript - // Sets app default base URL - app.baseUrl = '/'; - if (window.location.port === '') { // if production - // Uncomment app.baseURL below and - // set app.baseURL to '/your-pathname/' if running from folder in production - // app.baseUrl = '/polymer-starter-kit/'; - } - ``` -2. Change `app.baseUrl = '/polymer-starter-kit/';` to `app.baseUrl = '/your-pathname/';` (ex: if you repo is `github.com/username/bobs-awesome-site` you would change this to `bobs-awesome-site`) -3. Run `gulp build-deploy-gh-pages` from command line -4. To see changes wait 1-2 minutes then load Github pages for your app (ex: http://polymerelements.github.io/polymer-starter-kit) - -### Notes - -* When deploying to Github Pages we recommend using hashbangs which is Share With Me default. -* This method should work for most hosting providers when using a subfolder. diff --git a/docs/mobile-chrome-apps.md b/docs/mobile-chrome-apps.md @@ -1,131 +0,0 @@ -# Use Share With Me for [Mobile Chrome Apps](https://github.com/MobileChromeApps/mobile-chrome-apps) - -## Getting started - -Share With Me could be fully adapted to Mobile Chrome Apps through mobile-friendly features. Mobile Chrome Apps, is based on Apache Cordova, and requires mobile application SDKs such as Android and iOS. so please make sure that installation development tool by following [installation guide](https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/docs/Installation.md) of Mobile Chrome Apps. And then, You do some further steps to resolve some of restrictions and configurations to use Share With Me on Cordova. Looking for a [guide video](https://www.youtube.com/watch?v=-ifgyobPLVg) below to better understand. - -[![](https://camo.githubusercontent.com/7c498c4d60113dd1ea072576df897283100428b6/687474703a2f2f696d672e796f75747562652e636f6d2f76692f2d696667796f62504c56672f302e6a7067)](https://www.youtube.com/watch?v=-ifgyobPLVg) - -## Download Share With Me into your workspace - -To download and preparation, follow this [guide of Share With Me](https://github.com/PolymerElements/polymer-starter-kit#getting-started). Make sure that install all of dependencies of npm and Bower. - -## Create a Cordova project - -Create a Cordova project in path `polymer-starter-kit` by following command. `platform` is the path for Cordova project files, `com.your.app` is the project name/id and next following string is the description for your app. - -```sh -cca create platform com.your.app "Your Share With Me App" -``` - -If you have no problems while creating a project you will seeing the message of installing successful coming from Cordova and have the tree of the project below. - -```sh -└── polymer-starter-kit - └── app - │   ├── elements - │   ├── images - │   ├── index.html - │   ├── manifest.json - │   ├── scripts - │   ├── styles - │   └── test - ├── bower.json - ├── bower_components - ├── docs - ├── gulpfile.js - ├── node_modules - ├── package.json - ├── platform - │   ├── config.xml - │   ├── hooks - │   ├── platforms - │   ├── plugins - │   └── www -``` - -For further informations of Cordova, please visit [corodova document](https://github.com/MobileChromeApps/mobile-chrome-apps/tree/master/docs) - -## Configuration - -You need to have some changes of configuration to fit for Mobile Chrome Apps as it was mentioned above. - -### Configure path for app built by gulp - -- Change the path `dist` in `gulpfile.js` from `dist` to `platform/www/app`, then the app built with Share With Me will be placed under `platform/www` will be used by Cordova. - ```js - var DIST = 'platform/www/app'; - ``` - -- Change the path in `platform/www/background.js` into new path - ```js - chrome.app.runtime.onLaunched.addListener(function() { - chrome.app.window.create('app/index.html', { - width: 244, - height: 380, - }); - }); - ``` - -- Add path `/app` to `app.baseURL` in `app/scripts/app.js'. `platform/www` is root path of app that will prevent errors coming from page routing. - ```js - app.baseUrl = '/app'; - ``` - -### Update gulp tasks - -- Using `polybuild(vulcanize + crisper)` task is mandatory because of Chrome Apps doesn't allow inline script blocks according to [CSP](https://developer.chrome.com/apps/contentSecurityPolicy). You should replace current `vulcanize` task with new task below. To do this install `polybuild` first with `npm install --save-dev polybuild` command - ```js - // load polybuild - var polybuild = require('polybuild'); - - // Vulcanize granular configuration - gulp.task('vulcanize', function() { - return gulp.src('app/elements/elements.html') - .pipe(polybuild({maximumCrush: true})) - .pipe($.rename(function(file) { - if (file.extname === '.html') { - file.basename = file.basename.replace('.build', ''); - } - })) - .pipe(gulp.dest(dist('elements'))) - .pipe($.size({title: 'vulcanize'})); - }); - ``` - -### More updates - -- Remove useless files generated from Cordova. - ```sh - rm platform/www/index.* - ``` -- To complete first route for `home` you need to put try/catch block into the first route code on starting app, in `app/elements/routing.html`, because Chrome Apps doesn't allow using `history` APIs which related to error message `history.pushState/replaceState is not available in packaged apps`. - ```js - try { - page({ - hashbang: true - }); - } catch (e) { - app.route = 'home'; - } - ``` - -- Using `@import` instead of `link` to download external Google robot fonts which is related to `Refused to load the stylesheet` errors. Update code in `bower_components/font-roboto/roboto.html` to using `@import` code below - ``` - @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic); - @import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700); - ``` - -## Build and run app - -After done of above steps. run this command on root path that let you see Chrome Apps built with Share With Me. - -```sh -gulp && cd platform && cca run chrome -``` - -or to run on Android emulator or devices - -```sh -gulp && cd platform && cca run android -``` diff --git a/docs/polymer-perf.md b/docs/polymer-perf.md @@ -1,100 +0,0 @@ -### Polymer Performance Recipe - -In the following write up we are going to take a look at how to optimize the loading of Web Component enabled websites. The goal here is not to give you a copy and paste approach, but rather to give you the starting components and thought process with how to optimize your web app given your domain constraints. - -Current native support for Web Components is limited but growing, with only Chrome and Opera having a “fully" implemented spec. Due to the limited support, using Polymer or any web components in production across more than just chrome requires you to load a polyfill. As with any polyfill there is a performance tradeoff, in the run time performance, spec compliance, as well as the network cost overhead. Lets dive into a few approaches that you can use to conditionally load the polyfill only when it is required. - -The first step in conditionally loading the Web Component polyfill is detecting whether or not the environment that we are in supports the features that are required. - -Over in GitHub land @geenlen has cooked up a nifty technique bit of code to do this work for us: - -```js -var webComponentsSupported = ('registerElement' in document - && 'import' in document.createElement('link') - && 'content' in document.createElement('template')); -``` - -Once we know if things are supported or not we can then dynamically load our polyfill and then load up our custom elements so that our app will be able to properly upgrade our custom elements. - -```js -if (webComponentsSupported) { - loadElements(); -} else { - loadWebComponentPolyfill(loadElements) -} -``` - -This bit of code can be placed directly in [`app.js`](https://github.com/PolymerElements/polymer-starter-kit/blob/master/app/scripts/app.js), right under the beginning of the IIFE. - -Now that we have our initial sniff and load call, let’s take a look at the code for `loadWebComponentPolyfill`, and how exactly it works. - -```js -function loadWebComponentPolyfill(cb) { - var polyfill = document.createElement('script'); - polyfill.onload = cb || null; - polyfill.src = 'webcomponents-lite.min.js'; - document.head.appendChild(polyfill); -} -``` - -So what is going on here, how does it work? The first thing that this method does is dynamically create a script tag, then conditionally assign a callback when the resource loads, the code then sets the src of the script tag, and then injects the script tag into the head of our document. Once the tag is placed inside of our document, the network request will start and the resource is fully downloaded the callback will be invoked. - -Awesome! So now let’s move onto the logic around `loadElements`. - -You might be wondering why `loadElements` is even needed? Why can we not just `<link rel="import" href="path_to_elements.html">` directly in our html. The reason why `loadElements` is needed is because we are loading the webComponents polyfill async to the initial page load, therefore we can not assume that our import statements will always work across browsers and browser versions, rather we need to explicitly call into loadElements only after we are sure the current environment supports webComponents (even if we have to polyfill it first). - -```js -function loadElements() { - var bundle = document.createElement('link'); - bundle.rel = 'import'; - bundle.href = 'elements/path_to_bundle.html'; - - document.head.appendChild(bundle); -} -``` - -`loadElements` follows a very similar pattern as `loadWebComponentPolyfill`, only this time we are dynamically injecting a link tag into our head that will load our element bundle. Now that we have both of these methods defined, we are left with a very basic example of loading our polyfill and element async to the `window.onload` event. - -This approach opens up the possibility for you to only have users download the elements that they need for specific pages in your app. Consider for instance an application with an admin panel and a general app view. Given the fact that most users in our made up app do not go to the admin panel too often, there is no need for them to always incur the cost of downloading the admin suite of elements. Instead we will only have users download the “bundle" that they need depending on what page they enter on. - -For example with page.js your router could be structured as follows to optimize page load time, given a few assumptions about how users will be interacting with your app. - -```js -page.on('admin', ensureWebComponentSupport, function() { - loadElementBundle('admin'); - renderAdminPane(); -}); -``` - -#### Further Thoughts - -With Polymer, it is easy to fall into the trap of getting a flash of unstyled content, or a blank page while the polyfill and elements are downloading. The best way to avoid these pitfalls is to use a "loading" screen approach. The simplest of the loading approach to create a "splash" screen to display while your elements bundle is downloading. - -You can easily modify `loadElements` to enable this type of behavior. - -```js -function loadElements() { - document.body.innerHTML = '<div><!-- loading screen markup → --></div>'; - bundle.rel = 'import'; - bundle.href = 'elements/path_to_bundle.html'; - bundle.onload = function() { - document.body.innerHTML = '<real-markup></real-markup>'; - }; - - document.head.appendChild(bundle); -} -``` - -You can take this concept of a loading screen one step further by instead of showing a loading screen show a screen that looks like a lite version of your app. By this I mean simple shapes and blocks that match the color and blocks of your app once your elements are fully upgraded, so that your user has a faster perceived loading time. - -Hopefully these approaches give you some ideas on how to make your app lightning fast. - -We hope to explore further ideas including [application shells](https://github.com/ebidel/polymer-experiments/blob/master/polymersummit/fouc/appshell.html) and being smart about your first meaningful paint in the near future. - --------- - -Further reading - -* [Fast Polymer app loading](https://gist.github.com/ebidel/1ba71473d687d0567bd3) from Eric Bidelman -* [Polymer Perf Patterns](https://www.youtube.com/watch?v=Yr84DpNaMfk) from Eric Bidelman -* [Polymer for the Performance-obsessed](https://aerotwist.com/blog/polymer-for-the-performance-obsessed/) from Paul Lewis diff --git a/server/ws-server.js b/server/ws-server.js @@ -50,8 +50,8 @@ exports.create = function(server) { client.uuidRaw = guid(); //ip is hashed to prevent injections by spoofing the 'x-forwarded-for' header - client.hashedIp = 1; - // client.hashedIp = hash(getIP(client._socket)); + // client.hashedIp = 1; //use this to test locally + client.hashedIp = hash(getIP(client._socket)); client.deviceName = getDeviceName(client._socket.upgradeReq); diff --git a/tasks/ensure-files.js b/tasks/ensure-files.js @@ -1,34 +0,0 @@ -var fs = require('fs'); - -/** - * @param {Array<string>} files - * @param {Function} cb - */ - -function ensureFiles(files, cb) { - var missingFiles = files.reduce(function(prev, filePath) { - var fileFound = false; - - try { - fileFound = fs.statSync(filePath).isFile(); - } catch (e) { } - - if (!fileFound) { - prev.push(filePath + ' Not Found'); - } - - return prev; - }, []); - - if (missingFiles.length) { - var err = new Error('Missing Required Files\n' + missingFiles.join('\n')); - } - - if (cb) { - cb(err); - } else if (err) { - throw err; - } -} - -module.exports = ensureFiles; diff --git a/travis-runner.sh b/travis-runner.sh @@ -1,18 +0,0 @@ -#!/bin/bash -set -o pipefail - -if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] -then - git config --global user.email "samccone@gmail.com" && \ - git config --global user.name "auto deployer" && \ - echo "Deploying!" && \ - sed -i.tmp "s/\/\/ app.baseUrl = '\/polymer-starter-kit/app.baseUrl = '\/polymer-starter-kit/" app/scripts/app.js && \ - rm app/scripts/app.js.tmp && \ - bower i && \ - gulp build-deploy-gh-pages && \ - sed -i.tmp "s/app.baseUrl = '\/polymer-starter-kit/\/\/ app.baseUrl = '\/polymer-starter-kit/" app/scripts/app.js && \ - rm app/scripts/app.js.tmp -else - npm run lint - npm test -fi