A grunt task to automate the deployment of your status page themes to your Sorry account.
This task takes your themes source code, bundles it up into a deployable zip and uploads it to your status page through the Sorry API.
This plugin requires Grunt ~0.4.4
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-sorry-theme-deploy --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-sorry-theme-deploy');
Run this task with the grunt sorry-theme-deploy
command.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
Some options such as 'page' and 'host' may also be supplied as command line parameters.
In your project's Gruntfile, add a section named sorry_theme_deploy
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
sorry_theme_deploy: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
Type: String
This is your API Token which is available from within your Sorry account.
Type: String
The ID of the page to which you wish to deploy your theme. You can find this in the address bar of your Sorry account when viewing your page. i.e. a URL of http://app.sorryapp.com/pages/my-page
means your page ID is my-page
.
Type: String
Default Value: /dist/theme.zip
This is the location (relative to the Gruntfile) in which we'll store the bundled version of your theme before uploading it.
Type: String
Default Value: https://api.sorryapp.com
This is only applicable to Sorry development staff who wish to point the script at development and staging endpoints.
We need somewhere to keep your Sorry login credentials. In the root of your project create a file called sorry.json
which contains your access token. You should never check your Sorry credentials in to version control! Load them from an external file like this, which is outside of the repo or excluded by .gitignore.
{
"accessToken": "your access token goes here"
}
Now you can configure your grunt task, loading your Sorry login details from the external file you created above.
grunt.initConfig({
// Load in your sorry credentials.
// NOTE: NEVER CHECK YOUR CREDENTIALS INTO YOUR REPOSITORY.
sorry: grunt.file.readJSON('sorry.json'),
// Configuration to be run.
sorry_theme_deploy: {
options: {
accessToken: '<%= sorry.accessToken %>'
},
theme: {
expand: true,
cwd: 'src/',
src: ['**/*']
},
}
});
You can also see from this config that we define the themes files as being in a directory named src
. These files could be anywhere you like, but we always recommend this as a sensible default.
Now your options are configured you can deploy your theme to your chosen page. Whist you can define your target page in the configuration, to give you flexibility we suggest using the command line argument --sorry-page
grunt sorry-theme-deploy --sorry-page=my-page
If you do not pass in an accessToken with your config, grunt-sorry-theme-deploy
will fallback to the following environment variables:
SORRY_ACCESSTOKEN
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Once you are happy that your contribution is ready for production please send us a pull request, at which point we'll review the code and merge it in.
For transparency and insight into our release cycle, and for striving to maintain backward compatibility, This project will be maintained under the Semantic Versioning guidelines as much as possible.
Releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bumps the patch
For more information on SemVer, please visit http://semver.org/.
Robert Rawlins
Robin Geall
© Copyright 2014 - Sorry. See LICENSE for details.