Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

rename project (fixes #23) — DON'T MERGE! #184

Closed
wants to merge 1 commit into from
Closed
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
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Oghliner is an experimental template and tool for deploying Offline Web Apps to GitHub Pages. As a template, Oghliner can be used to bootstrap an offline app that deploys to GitHub Pages. As a tool, Oghliner adds offlining and GitHub Pages deployment into your existing app.
offline-github-pages is an experimental template and tool for deploying Offline Web Apps to GitHub Pages. As a template, offline-github-pages can be used to bootstrap an offline app that deploys to GitHub Pages. As a tool, offline-github-pages adds offlining and GitHub Pages deployment into your existing app.

Offline Web Apps are web apps that work when your network doesn't. They use Service Workers to cache and serve your app's assets (HTML, JavaScript, CSS, images, etc.) on a user's machine, regardless of the status of its network connection. And they degrade gracefully, so the app works identically in browsers that don't support Service Workers when the machine is online.

[![Build Status](https://travis-ci.org/mozilla/oghliner.svg?branch=master)](https://travis-ci.org/mozilla/oghliner)
[![dependencies](https://david-dm.org/mozilla/oghliner.svg)](https://david-dm.org/mozilla/oghliner)
[![devdependencies](https://david-dm.org/mozilla/oghliner/dev-status.svg)](https://david-dm.org/mozilla/oghliner#info=devDependencies)
[![Build Status](https://travis-ci.org/mozilla/offline-github-pages.svg?branch=master)](https://travis-ci.org/mozilla/offline-github-pages)
[![dependencies](https://david-dm.org/mozilla/offline-github-pages.svg)](https://david-dm.org/mozilla/offline-github-pages)
[![devdependencies](https://david-dm.org/mozilla/offline-github-pages/dev-status.svg)](https://david-dm.org/mozilla/offline-github-pages#info=devDependencies)

Using The Template
------------------
Expand All @@ -16,16 +16,16 @@ git clone git@github.com:mykmelez/test-app.git
cd test-app
```

If you haven't already, install gulp and oghliner.
If you haven't already, install gulp and offline-github-pages.

```bash
npm install -g gulp oghliner
npm install -g gulp offline-github-pages
```

Then bootstrap your app with the bootstrap command which puts assets in *app/* and includes a simple *gulpfile.js* that builds to *dist/*, but you can modify the build any way you like.

```bash
oghliner bootstrap
oghp bootstrap
```

Invoke `gulp` to rebuild your app and regenerate the script that offlines it. Invoke `gulp deploy` to publish it to GitHub Pages.
Expand All @@ -34,7 +34,7 @@ Invoke `gulp` to rebuild your app and regenerate the script that offlines it. In
gulp && gulp deploy
```

At least one commit to the repository is required for successful deploy. The following could be used to commit the changes by Oghliner to the repository:
At least one commit to the repository is required for successful deploy. The following could be used to commit the changes by offline-github-pages to the repository:

```bash
git add . && git commit -m "Initial version of app"
Expand All @@ -43,20 +43,20 @@ git add . && git commit -m "Initial version of app"
Using The Tool
--------------

To integrate offlining and deployment into your existing app, `npm install -g oghliner`, then run `oghliner offline [root-dir]` to offline your app (i.e. regenerate the offline-worker.js script) and `oghliner deploy [root-dir]` to deploy it. Both commands take an optional *root-dir* argument that specifies the directory to offline/deploy. Its default value is the current directory (`./`).
To integrate offlining and deployment into your existing app, `npm install -g offline-github-pages`, then run `oghp offline [root-dir]` to offline your app (i.e. regenerate the offline-worker.js script) and `oghp deploy [root-dir]` to deploy it. Both commands take an optional *root-dir* argument that specifies the directory to offline/deploy. Its default value is the current directory (`./`).

The *offline* command also allows you to specify these options:

- *--file-globs*: a comma-separated list of file globs to offline (default: `**/*`). The files specified by *--file-globs* are matched inside *root-dir*.
- *--import-scripts*: a comma-separated list of additional scripts to import into offline-worker.js. This is useful, for example, when you want to use the [Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API).

Alternately, you can `npm install --save oghliner` and then add tasks to your *gulpfile.js* which call *oghliner.offline* and *oghliner.deploy*, for example:
Alternately, you can `npm install --save offline-github-pages` and then add tasks to your *gulpfile.js* which call *oghp.offline* and *oghp.deploy*, for example:

```js
var oghliner = require('oghliner');
var oghp = require('offline-github-pages');

gulp.task('offline', function(callback) {
oghliner.offline({
oghp.offline({
rootDir: 'dist/',
fileGlobs: [
'**/*.html',
Expand All @@ -66,37 +66,37 @@ gulp.task('offline', function(callback) {
});

gulp.task('deploy', function(callback) {
oghliner.deploy({
oghp.deploy({
rootDir: 'dist/',
}, callback);
});
```

The *oghliner.offline* task takes a *config* object and a *callback*. The properties of the *config* object are:
The *oghp.offline* task takes a *config* object and a *callback*. The properties of the *config* object are:
- *rootDir*: the directory to offline (default: `./`);
- *fileGlobs*: an array of file globs to offline (default: `['**/*']`). The files specified by *fileGlobs* are matched inside *rootDir*.
- *importScripts*: an array of additional scripts to import into offline-worker.js (default: `[]`). This is useful, for example, when you want to use the [Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API).

*oghliner.deploy* deploys your files to GitHub Pages. It takes a *config* object and a *callback*. The properties of the *config* object are:
*oghp.deploy* deploys your files to GitHub Pages. It takes a *config* object and a *callback*. The properties of the *config* object are:

- *rootDir*: the directory to deploy (default: `./`).

Finally, in order for offline-worker.js to be evaluated, you need to load the offline manager script in your app by copying it to the location of your other scripts. To do this, use the *integrate* command (or *oghliner.integrate* function):
Finally, in order for offline-worker.js to be evaluated, you need to load the offline manager script in your app by copying it to the location of your other scripts. To do this, use the *integrate* command (or *oghp.integrate* function):

```bash
oghliner integrate path/to/your/scripts/
oghp integrate path/to/your/scripts/
```

Automatic Deployment Via Travis
-------------------------------

Oghliner can configure a repository to automatically deploy to GitHub Pages whenever you push to its *master* branch. Auto-deploy uses [Travis CI](https://travis-ci.org/), a continuous integration service. Oghliner takes care of most of the steps to configure your repository to auto-deploy via Travis.
offline-github-pages can configure a repository to automatically deploy to GitHub Pages whenever you push to its *master* branch. Auto-deploy uses [Travis CI](https://travis-ci.org/), a continuous integration service. offline-github-pages takes care of most of the steps to configure your repository to auto-deploy via Travis.

If you bootstrapped your app from the template, your repository already has a suitable Travis configuration file (.travis.yml) and a *configure* task in gulpfile.js. Just `gulp configure` to configure your repository.

If you integrated the tool into an existing app, `npm install -g oghliner && oghliner configure` to configure your repository.
If you integrated the tool into an existing app, `npm install -g offline-github-pages && oghp configure` to configure your repository.

Oghliner will prompt you for your GitHub credentials in order to create a token that authorizes Travis to push changes to your repository. The token will give Travis limited access to your GitHub account. Specifically: it will have the *public_repo* [scope](https://developer.github.com/v3/oauth/#scopes), which gives it "read/write access to code, commit statuses, collaborators, and deployment statuses for public repositories and organizations."
offline-github-pages will prompt you for your GitHub credentials in order to create a token that authorizes Travis to push changes to your repository. The token will give Travis limited access to your GitHub account. Specifically: it will have the *public_repo* [scope](https://developer.github.com/v3/oauth/#scopes), which gives it "read/write access to code, commit statuses, collaborators, and deployment statuses for public repositories and organizations."

After configuring the repository, add and commit the changes to *.travis.yml* and push the *master* branch to the *origin* remote on GitHub to make Travis build and auto-deploy your app:

Expand Down
14 changes: 7 additions & 7 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<head>
<meta charset="utf-8">
<title>Oghliner</title>
<meta name="description" content="Oghliner : template and tool for deploying Offline Web Apps to GitHub Pages">
<title>offline-github-pages</title>
<meta name="description" content="offline-github-pages : template and tool for deploying Offline Web Apps to GitHub Pages">

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="images/apple-touch-icon-57x57.png" />
Expand Down Expand Up @@ -45,12 +45,12 @@

<!-- MAIN CONTENT -->
<main class="center">
<h1>Oghliner</h1>
<h1>offline-github-pages</h1>
<h2 class="subtitle center-text">Deploy Offline Web Apps to GitHub Pages</h2>

<section class="buttons">
<a href="https://github.com/mozilla/oghliner" class="button">Fork on GitHub</a>
<a href="https://www.npmjs.com/package/oghliner" class="button">Discover on npm</a>
<a href="https://github.com/mozilla/offline-github-pages" class="button">Fork on GitHub</a>
<a href="https://www.npmjs.com/package/offline-github-pages" class="button">Discover on npm</a>
</section>

<section>
Expand Down Expand Up @@ -92,9 +92,9 @@ <h3>ServiceWorker API Status</h3>
<!-- FOOTER -->
<footer class="inner">
<p>
<span class="copyright">Oghliner is a <a href="https://github.com/mozilla">Mozilla</a> project.</span>
<span class="copyright">offline-github-pages is a <a href="https://github.com/mozilla">Mozilla</a> project.</span>
&bull;
<a href="https://github.com/mozilla/oghliner">Oghliner on GitHub</a>
<a href="https://github.com/mozilla/offline-github-pages">offline-github-pages on GitHub</a>
</p>
</footer>

Expand Down
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var template = require('gulp-template');
var marked = require('marked');
var argv = require('yargs').argv;

var oghliner = require('./index.js');
var oghp = require('./index.js');

gulp.task('default', ['build', 'offline']);

Expand All @@ -47,16 +47,16 @@ gulp.task('build-tabzilla', ['copy-files'], function() {
return gulp.src('node_modules/mozilla-tabzilla/**/*.{css,png}').pipe(gulp.dest('dist/styles/tabzilla'));
});

gulp.task('configure', oghliner.configure);
gulp.task('configure', oghp.configure);

gulp.task('deploy', function() {
return oghliner.deploy({
return oghp.deploy({
rootDir: 'dist',
});
});

gulp.task('offline', ['build'], function() {
return oghliner.offline({
return oghp.offline({
rootDir: 'dist/',
fileGlobs: [
'images/**',
Expand Down
12 changes: 6 additions & 6 deletions lib/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ function templateConfigToString(config) {

function getDefaultTemplateConfig(dir) {
var config = {
name: 'oghliner-template-app',
repository: 'https://oghliner-template-app.git',
description: 'A template app bootstrapped with oghliner.',
name: 'offline-github-pages-template-app',
repository: 'https://offline-github-pages-template-app.git',
description: 'A template app bootstrapped with offline-github-pages.',
license: 'Apache-2.0',
};

Expand All @@ -119,7 +119,7 @@ function sink() {
module.exports = function(config) {
config = config || {};

console.log('Bootstrapping current directory as Oghliner app…\n');
console.log('Bootstrapping current directory as offline-github-pages app…\n');

var rootDir = config.rootDir ? config.rootDir : '.';
return getDefaultTemplateConfig(rootDir)
Expand Down Expand Up @@ -167,11 +167,11 @@ module.exports = function(config) {
console.log(
'Your app has been bootstrapped! Just commit the changes and push the commit\n' +
'to the origin/master branch:\n\n' +
chalk.bold('git add --all && git commit -m"initial version of Oghliner app"') + '\n' +
chalk.bold('git add --all && git commit -m"initial version of offline-github-pages app"') + '\n' +
chalk.bold('git push origin master') + '\n\n' +
'Then you can build, offline, and deploy the app using ' + chalk.bold.italic('gulp') + ' commands.\n\n' +
chalk.bold.blue('ℹ For more information about building, offlining and deployment, see:\n' +
' https://mozilla.github.io/oghliner/')
' https://mozilla.github.io/offline-github-pages/')
);

resolve();
Expand Down
8 changes: 4 additions & 4 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var github = new GitHub({
// debug: true,
protocol: 'https',
headers: {
'user-agent': 'Oghliner',
'user-agent': 'offline-github-pages',
},
});

Expand All @@ -66,7 +66,7 @@ travis.users.sync.post = promisify(travis.users.sync.post);

// The URL of this project, which we specify in the note_url field
// when creating GitHub tokens.
var noteUrl = 'https://github.com/mozilla/oghliner';
var noteUrl = 'https://github.com/mozilla/offline-github-pages';

// The active spinner message. Used by interruptSpinner to replace
// the active spinner message with an interrupted version of it.
Expand Down Expand Up @@ -325,7 +325,7 @@ module.exports = function() {
startSpinner(message);

return createToken(['read:org', 'user:email', 'repo_deployment', 'repo:status', 'write:repo_hook'],
'temporary Oghliner token to get Travis token for ' + slug, noteUrl)
'temporary offline-github-pages token to get Travis token for ' + slug, noteUrl)
.then(function(res) {
stopSpinner(message);

Expand Down Expand Up @@ -368,7 +368,7 @@ module.exports = function() {
var message = 'Creating permanent GitHub token for Travis to push to the repository…';
startSpinner(message);

return createToken(['public_repo'], 'Oghliner token for ' + slug, noteUrl)
return createToken(['public_repo'], 'offline-github-pages token for ' + slug, noteUrl)
.then(function(res) {
token = res.token;
stopSpinner(message);
Expand Down
4 changes: 2 additions & 2 deletions lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(config) {
var cloneDir = config.cloneDir ? config.cloneDir : null;

if (config.fileGlobs) {
var dir = temp.mkdirSync('oghliner');
var dir = temp.mkdirSync('offline-github-pages');

config.fileGlobs.map(function(v) {
return path.join(rootDir, v);
Expand Down Expand Up @@ -93,7 +93,7 @@ module.exports = function(config) {

// We can't log on Travis because it would leak the GitHub token.
// We can't use the gh-pages silent option because it makes error messages
// less informative (https://github.com/mozilla/oghliner/pull/58#issuecomment-147550610).
// less informative (https://github.com/mozilla/offline-github-pages/pull/58#issuecomment-147550610).
ghPagesConfig.logger = ('GH_TOKEN' in process.env) ? function() {} : console.log;

if ('GH_TOKEN' in process.env) {
Expand Down
8 changes: 4 additions & 4 deletions lib/integrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function(config) {
return new Promise(function(resolve, reject) {
var dir = config.dir || './';

console.log('Integrating Oghliner into the app in the current directory…\n');
console.log('Integrating offline-github-pages into the app in the current directory…\n');

startSpinner('Copying offline-manager.js to ' + dir + '…');

Expand All @@ -63,18 +63,18 @@ module.exports = function(config) {
stopSpinner();

console.log(
'Oghliner has been integrated into the app!\n\n' +
'offline-github-pages has been integrated into the app!\n\n' +

'The app needs to load the script offline-manager.js in order to register\n' +
'the service worker that offlines the app. To load the script, add this line\n' +
'to the app\'s HTML page(s)/template(s):\n\n' +
chalk.bold('<script src="' + dest + '"></script>') + '\n\n' +
'And commit the changes and push the commit to the origin/master branch:\n\n' +
chalk.bold('git commit -m"integrate Oghliner" --all') + '\n' +
chalk.bold('git commit -m"integrate offline-github-pages" --all') + '\n' +
chalk.bold('git push origin master') + '\n\n' +
'Then you can offline and deploy the app using the ' + chalk.bold.italic('offline') + ' and ' + chalk.bold.italic('deploy') + ' commands.\n\n' +
chalk.bold.blue('ℹ For more information about offlining and deployment, see:\n' +
' https://mozilla.github.io/oghliner/')
' https://mozilla.github.io/offline-github-pages/')
);

resolve();
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "oghliner",
"name": "offline-github-pages",
"version": "0.10.1",
"description": "template and tool for deploying Offline Web Apps to GitHub Pages",
"main": "index.js",
Expand All @@ -8,10 +8,10 @@
},
"repository": {
"type": "git",
"url": "https://github.com/mozilla/oghliner/"
"url": "https://github.com/mozilla/offline-github-pages/"
},
"author": "Myk Melez <myk@mykzilla.org>",
"bin": "./cli.js",
"bin" : { "oghp" : "./cli.js" },
"license": "Apache-2.0",
"keywords": [
"offline",
Expand Down
2 changes: 1 addition & 1 deletion templates/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2 id="project_tagline">Template App</h2>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">Bootstrapped with <a href="https://github.com/mozilla/oghliner/">oghliner</a>.
<p class="copyright">Bootstrapped with <a href="https://github.com/mozilla/offline-github-pages/">offline-github-pages</a>.
</footer>
</div>
</body>
Expand Down
8 changes: 4 additions & 4 deletions templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

var connect = require('gulp-connect');
var gulp = require('gulp');
var oghliner = require('oghliner');
var oghp = require('offline-github-pages');

gulp.task('default', ['build', 'offline']);

gulp.task('build', function(callback) {
return gulp.src('app/**').pipe(gulp.dest('dist'));
});

gulp.task('configure', oghliner.configure);
gulp.task('configure', oghp.configure);

gulp.task('deploy', function() {
return oghliner.deploy({
return oghp.deploy({
rootDir: 'dist',
});
});

gulp.task('offline', ['build'], function() {
return oghliner.offline({
return oghp.offline({
rootDir: 'dist/',
fileGlobs: [
'images/**',
Expand Down
2 changes: 1 addition & 1 deletion templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"dependencies": {
"gulp": "^3.9.0",
"gulp-connect": "^2.2.0",
"oghliner": "^0.9.3"
"offline-github-pages": "^0.9.3"
}
}
6 changes: 3 additions & 3 deletions test/liveUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ var github = new GitHub({
version: '3.0.0',
protocol: 'https',
headers: {
'user-agent': 'Oghliner',
'user-agent': 'offline-github-pages',
},
});

var liveUtils = {
repoName: 'test_oghliner_live_' + process.version + '_' + process.pid,
repoName: 'test_offline-github-pages_live_' + process.version + '_' + process.pid,
githubNote: 'test' + process.version + '_' + process.pid,
githubNoteURL: 'http://www.test.org/' + process.version + '_' + process.pid,
githubToken: null,
Expand Down Expand Up @@ -215,7 +215,7 @@ function cleanup(username, password) {
.catch(function() {
// Ignore error if the authorization doesn't exist.
}),
getTokenId(username, password, 'Oghliner token for ' + username + '/' + liveUtils.repoName, 'https://github.com/mozilla/oghliner')
getTokenId(username, password, 'offline-github-pages token for ' + username + '/' + liveUtils.repoName, 'https://github.com/mozilla/offline-github-pages')
.then(deleteAuthorization)
.catch(function() {
// Ignore error if the authorization doesn't exist.
Expand Down
Loading