grunt-ghost-upload
Upload a theme to Ghost Pro via the POST API.
Motivation
Basically, I was tired of the boresome process of uploading a theme to Ghost Pro, where you need to:
- Create a zip
- Open your browser
- Login
- Select the zip in the form
- Press save
Yikes!
So, I did what any programmer tired of repetition does: I automated the process.
This task uses your credentials to login and upload your theme zip.
DISCLAIMER: This is a major hack and is in no way guaranteed to work for you :)
Once the Ghost API is finished and public, I'll probably rewrite this using it.
Getting Started
This plugin requires Grunt 0.4.5
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-ghost-upload --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
Credentials in environment variables
Your credentials in Ghost Pro are expected to be in environment variables GHOST_USER
and GHOST_PASS
.
You can export them by issuing the following commands in your terminal:
export GHOST_USER=myuser@gmail.com
export GHOST_PASS=mysupersecretpassword
The "ghost-upload" task
Overview
In your project's Gruntfile, add a section named ghost-upload
to the data object passed into grunt.initConfig()
.
grunt;
Required properties
zip
Type: String
The path to your theme's zip file.
blog
Type: String
The id of your blog in Ghost Pro. It's the string that appears after blogs/
when you're logged in.
For example, if your URL reads:
https://ghost.org/blogs/firstdoit/
Then, the blog id is firstdoit
.
grunt-contrib-compress
Using with You can use grunt-contrib-compress in tandem with this task to achieve easy deploy of your Ghost theme. You can check a working example at this Gruntfile.
Contributing
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.
Release History
- 2015-02-22 v0.1.0 Initial release.