Skip to content

Instantly share code, notes, and snippets.

@kellishouts
Last active September 29, 2016 20:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellishouts/0a1edf2fa1826483ba888074ab71efa6 to your computer and use it in GitHub Desktop.
Save kellishouts/0a1edf2fa1826483ba888074ab71efa6 to your computer and use it in GitHub Desktop.
Airship Users - Aug 27, 2016

Updated Aug 27, 2016

Install Airship CLI

Installing the cli tools on a Mac or Linux

You only need to do this for your system when you first start developing Airship projects, or whenever a new version of the cli becomes available. Download the latest version of the cli at:

[install.airshipcms.io[(http://install.airshipcms.io)

Installing the cli tools on a PC

Nope.

AirshipCMS Setup

projectsubdomain.airshipcms.io/admin

Before you start building your project templates, set up the basic pages, collections, and product collections in your project's AirshipCMS admin panel. Remember the names of the layouts, templates, and template directories you are using for each page and section.

Local Development Setup

In your terminal, navigate to the directory you would like to work on Airship files. Ideally, this also the home for your project Git repository.

  • Run airship login projectsubdomain, and y to set the project root. Enter your superadmin email and password for the project
  • Run airship land to get the initial project files. You only need to do this once, if you are using Git to keep your files synced with other developers in your team. You may occasionally need to run airship land again, if Airship core files change and you need to re-sync the hidden ".airship" files.
  • Run airship serve to pull in content from the cms.
  • Add the markup {{{help}}} in any template file to see what data is retreivable via HandlebarsJS.
  • Set up your .gitignore and any pre-process files and development files outsite of the compartments directory.
  • Use SourceTree or some other GUI to manage git files.
  • Use Chrome to view the locally running project at localhost:9001

Project Directory Structure

.airship
/compartments
  /airmail
  /layouts
  /partials
  /assets
    /styles
    /scripts
    /media
  /templates
.env
/(other development project directories and assets go out here)
  • All compartments struts are synced with Airship.
  • layouts and templates mirror the layouts & template settings in the CMS for the project.
  • assets contain the scripts and styles and media directories. These directories can have any number of subdirectories.
  • For a list of allowed file types for each directory: [need to document]
  • Keep any code and files that are not necessary for production outside of compartments

Airship CLI

List all airship commands

This lists all commands.

airship

airship login

Log in to your project with your superadmin access level email, your password, and your AirshipCMS subdomain.

airship login projectname

You will be prompted to enter your email (careful, backspace is disabled).
Then you will be prompted to enter your password.

Note: airship login [projectname] connects you to the airship server for the project globally on your computer. If you have landed the project in more than one location, logging in will open the connection to airship for the project in all those locations.

airship land

Do this the first time you work on the project. This pulls down necessary Airship config files and initial project structure. After the first time, you should have all your files frequently backed up in Git, so you will never really have to run airship land anymore, and you can simply create and launch your new files without ever landing again.

airship land

If for some reason you want to pull down the files that are live, you can run airship land again. Be sure you have backed up your local files because airship land will overwrite them. If you are using Git and have things safely backed up, you have nothing to worry about.

airship serve

Airship serve runs the server that will locally render layouts, templates, and pull content from AirshipCMS. Run this in a terminal tab, while in other tabs you can run other airship commands and other processes that may be located outside of the compartments directory (such as scss compiline, gulp, etc).

airship serve

airship launch

When you are ready to launch your local changes to production, run airship launch. This will overwrite all files on the server to match your local directory structure. If you have added files locally, they will be added to the server. If you have deleted files locally, they will be deleted from the server.

airship launch

If for some reason you need to back up the state of production compartments, then airship land files in a separate directory, or better yet, you already have them backed up in a different Git branch.

airship logout

airship logout

Note: airship logout disconnects you from the airship server for the project globally on your computer. If you have landed the project in more than one location, logging out will close the connection to airship for the project in all those locations.

Notes

  • When you to scripts or styles that are located in the /assets/scripts or /assets/styles directories, they will link to "/assets/scripts/yourfile.js" and "/assets/styles/app.css"
  • you can add whatever files you want outside of /compartments
  • Only add .html templates files to /airmail, /layouts, and /templates.
  • you can add .js and other scripts (and subdirectories) to /assets/scripts.
  • You can add .css (and subdirectories) to /assets/styles.
  • when you add a new collection or product collection, you need to add the appropriate /templatedirectory to /templates. The template directory should contains only the following 4 templates: index.html, show.html, categories.html, category.html (You can omit any of these, though they correspond directly to the list of aerostats, a view of a single aerostat, the list of categories for the collection, a list of aerostats within a category for a collection. Of course, if your collection does not require a show.html view or categories.html list, it is safe to omit the irrelevant files and not use the route.
  • run {{{ help }}} on any template to get a generated list of accessible properties
  • Airship propellers rendering uses _HandlebarsJS. View (Handlebars Documentation)[] for rendering syntax.
  • Alternatively, you can access all content through the API, so you do not have to rely on handlebars rendering at all. This is especially useful when you want to filter items that have complex queries and constraints. With the api, you can build a custom app or mini-app that simply pulls data from Airship API and uses whatever method you want for rendering.
  • If you have a shop on your site, you will need the cart and checkout scripts.

Coming Soon:

  • need to add content to each page and section because otherwise nothing will render.
  • create template directories. templates autogenerate. template directories do not.
  • add base markup or autogenerate markup for each page & section.
@kellishouts
Copy link
Author

kellishouts commented Jul 10, 2016

When you run the installer, it is supposed to clear out old versions of the cli tools and server. If it does not, then before installing new versions:
rm /usr/local/bin/airship and
rm -r /usr/local/lib/airship

@kellishouts
Copy link
Author

When you run the installer, if you don't have proper permissions to run anything, run chmod +x ~/.airship-bin/*

@kellishouts
Copy link
Author

kellishouts commented Sep 29, 2016

Final Steps for clients to "go live":

  1. Create a CNAME for www pointing www.domain.com to subdomain.airshipcms.io
  2. Create a Redirect for domain.com pointing to www.domain.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment