Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethormandy committed Dec 15, 2014
0 parents commit 7967a4c
Show file tree
Hide file tree
Showing 11 changed files with 382 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# OS
.DS_Store

# Logs
logs
*.log

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules
components
bower_components

# Compile directories
www/
_book/
13 changes: 13 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"node": true
}
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "0.10"
before_install:
- npm update npm -g
before_script:
- npm install -g grunt-cli
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing

Thanks for considering contributing to the Grunt plugin for [Surge](http://surge.sh).

Feel free to [send Kenneth an email]([email protected]) or [open an issue here](http://github.com/chloi/grunt-surge/issues) if you have questions about Surge, contributing this project, or anything else related. Otherwise, here’s the general process we like to use to maintain the project:

## Reporting bugs

If you find a bug, we’ll really appreciate it if you [open an issue](https://github.com/chloi/grunt-surge/issues) with as many details as possible. The easier you make it for us to recreate the issue we found, the faster we can move onto trying to fix it.

If you taking the time to mention a problem, even a seemingly minor one, it is greatly appreciated, and a totally valid contribution to this project. Thank you!

## Fixing bugs

We love pull requests. Here’s a quick guide:

1. [Fork this repository](https://github.com/chloi/grunt-surge/fork) and then clone it locally:

```bash
git clone https://github.com/chloi/grunt-surge
```

2. Create a topic branch for your changes:

```bash
git checkout -b fix-for-that-thing
```
3. Commit a failing test for the bug:

```bash
git commit -am "Adds a failing test to demonstrate that thing"
```

4. Commit a fix that makes the test pass:

```bash
git commit -am "Adds a fix for that thing!"
```

5. Run the tests:

```bash
npm test
```

6. If everything looks good, push to your fork:

```bash
git push origin fix-for-that-thing
```

7. [Submit a pull request.](https://help.github.com/articles/creating-a-pull-request)

8. Enjoy being the wonderful person you are

After you’ve opened your pull request, if you’d like, [send us an email](mailto:[email protected]) with your work mailing address. We’ll send you a thank-you note and some stickers!

## Adding new features

Thinking of adding a new feature? Cool! [Open an issue](https://github.com/chloi/grunt-surge/issues) and let’s design it together. We’re very open to collaborating, and like to make sure that we’ll be able to merge your work before you have to put a lot of time into it.
63 changes: 63 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* grunt-surge
* https://github.com/chloi/grunt-surge
*
* Copyright © 2014 Chloi Inc.
* Available under the MIT license.
*/

'use strict';

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js',
'<%= nodeunit.tests %>',
],
options: {
jshintrc: '.jshintrc',
},
},

// Before generating any new files, remove any previously-created files.
clean: {
tests: ['tmp'],
},

// Configuration to be run (and then tested).
surge: {
basic: {
options: {
dist: './test/fixtures/',
domain: 'grunt-temp-1'
}
}
},

// Unit tests.
nodeunit: {
tests: ['test/*_test.js'],
}

});

// Actually load this plugin's task(s).
grunt.loadTasks('tasks');

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');

// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('test', ['clean', 'surge', 'nodeunit']);

// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'test']);

};
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright © 2014 [Chloi Inc.](http://chloi.io)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# grunt-surge

Publish Grunt projects to the web.

## Getting Started

This plugin requires Grunt `~0.4.1`

If you haven’t used [Grunt](http://gruntjs.com) before, consider taking a look at the stand-alone version of [Surge](https://github.com/sintaxi/surge).

Otherwise, be sure to check out the [Grunt’s Getting Started](http://gruntjs.com/getting-started) guide. It explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile), as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```bash
npm install --save-dev grunt-surge
```

## Usage

Next, add it to your project’s `gruntfile.js`:

```js
// Gruntfile.js

module.exports = function(grunt) {
grunt.initConfig({
surge: {
options: {
project: ['./dist/'],
domain: 'my-subdomain'
}
}
});
grunt.loadNpmTasks('grunt-surge');
};
```
Additional, really good instructions are going to be here soon, I promise! If you need them now, [bug me via email](mailto:[email protected]).

## Contributing

Thanks for considering contributing! There’s information about how to [get started here](CONTRIBUTING.md).

## License

[The MIT License (MIT)](LICENSE.md)

Copyright © 2014 [Chloi Inc.](http://chloi.io)
52 changes: 52 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "grunt-surge",
"description": "Easily get static builds online with Grunt.",
"version": "0.1.0",
"main": "Gruntfile.js",
"repository": "git://github.com/chloi/grunt-surge.git",
"homepage": "https://github.com/chloi/grunt-surge",
"license": "MIT",
"author": "Kenneth Ormandy <[email protected]>",
"contributors":
[ "Kenneth Ormandy <[email protected]>",
"Rob Ellis <[email protected]>"
, "Brock Whitten <[email protected]>"
],
"scripts": {
"test": "grunt test",
"start": "grunt"
},
"bugs": {
"url": "https://github.com/chloi/grunt-surge/issues"
},
"keywords": [
"gruntplugin",
"grunt",
"surge",
"deploy",
"publish",
"deploy",
"static",
"build"
],
"files": [
"tasks",
"LICENSE.md",
"README.md"
],
"engines": {
"node": ">= 0.10.16"
},
"peerDependencies": {
"grunt": "~0.4.1"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt": "~0.4.1"
},
"dependencies": {
"surge": "^0.5.0"
}
}
53 changes: 53 additions & 0 deletions tasks/grunt-surge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* grunt-surge
* https://github.com/chloi/grunt-surge
*
* Copyright © 2014 Chloi Inc.
* Available under the MIT license.
*/

'use strict';

module.exports = function(grunt) {

var surge = require('surge');
var path = require('path');

grunt.registerMultiTask('surge', 'Publishes files with Surge', function() {

var done = this.async();

// Merge the default options with task specific ones
var options = this.options({
dist: './dist',
domain: null,
endpoint: null,
verbose: false,
});

// if(!options.email) {
// grunt.warn('email is required')
// done();
// return;
// }
//
// if(!options.password) {
// grunt.warn('password is required')
// done();
// return;
// }

var project = path.resolve(options.dist);
var domain = options.domain;

surge.skin(project, domain, function (err) {
if(err) {
grunt.fail.fatal(err.message);
}
grunt.log.writeln('Deploy initiated…');
done();
});

});

};
8 changes: 8 additions & 0 deletions test/fixtures/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<title>Grunt Test</title>
</head>
<body>
<h1>Grunt Test</h1>
</body>
</html>
42 changes: 42 additions & 0 deletions test/surge_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

var grunt = require('grunt');

/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/

// TODO: write some tests.

exports.surge = {
setUp: function(done) {
// setup here if necessary
done();
},
basic: function(test) {
// test.expect(1);

test.done();
}
//some_test: function (test) {
// // ... run your test here.
// // test.done();
//}
// Add more tests here when necessary.
};

0 comments on commit 7967a4c

Please sign in to comment.