One of the most requested features of the Forge platform, particularly from the more techie folks who are used to using services like Heroku, Firebase and other such developer platforms, has been to provide a command-line-interface (CLI) for Forge.
Up until now you had 3 ways to publish your sites to Forge
- Drag and Drop a .zip into the browser
- Github Sync
- Dropbox Sync
Each of these has made it infinitely easier to create and deploy your static sites than it would be otherwise.
We then added autosync and webhooks so that you can automate the deployment, such as when you commit some code to your Github repository or updating some content on an external service like Contentful.
But, for many users who live in the Terminal (or platform equivalent), not being able to perform these tasks without opening the browser or creating service-specific accounts was a barrier, and if not, could be a workflow / productivity hurdle too far.
So this festive period, we set about building a small CLI that enables you to do pretty much everything you'd initially expect. Here's the full run-down of the Forge-CLI app.
For now at least, you can try the BETA by cloning the Forge-CLI Repo
git clone https://github.com/beachio/forge-cli.git cd forge-cli ruby install.rb
Using the Forge-CLI:
forge-cli --help forge-cli <task> --help
will prompt for user email and password to authenticate
forge-cli login --email "[email protected]" --password "qwerty123"
login by passing your credentials
will logout and clear your session / stored credentials
create a new forge site (subject to account limitations)
forge-cli create --name "hammer"
will create a site called
forge-cli create --name "hammerformac.com" --custom
create a custom domain (if allowed) with name hammerformac.com
forge-cli add hammerformac.com
will assign the remote site to the current directory
deploy site to the linked remote destination (if present)
forge-cli deploy hammerformac.com
deploy the explicitly referenced site
forge-cli deploy -m "added new page"
deploy with version description message
rollback related site to last version
forge-cli rollback --version "123"
rollback site to specified version (coming soon)
list all versions for the site (coming soon)
lists the sites available for current user
create a hammer.json file in the project with forge configuration settings as needed....