STAN CLI is a command line interface for development on STAN admin. STAN CLI is split in to two shell scripts; a global app which will handle the core functionality inititialisaton, install, clone etc. This should live in a dir listed in the export path - eg /usr/bin/stan.
The second script is an app to be included locally within each project and will handle the day to day development tasks for the project. This can the be customised on a per project basis and commited back to the projects git repo. This should live in the project directory ./stan-cli
Run the following commands as root/sudo to install the global stan application. Once the global app is installed you will be able to run commands to install a new project or clone an existing project which will install the local app.
wget https://raw.githubusercontent.com/awmly/stan-cli/master/stan -O /usr/local/bin/stan
chmod +x /usr/local/bin/stanAll commands are run within the terminal using the prefix stan and then specifying the required method. eg stan install. When a command is run it gets sent to the global app /usr/bin/stan, if the method is defined within the global app it is executed, if it's not defined the global app sends the command to the local app within your cwd (current working directory) ./stan-cli.
L - Denotes command to be run on local server
R - Denotes command to be run on remote server
stan remote - This will configure the remote server ready for the project and MUST be run before running the install command on the local server. The command needs to be run within the projetcs vhost directory eg var/www/vhosts/project-name.co.uk - this command will prompt for your sudo password.
stan init - This will clone the stan repository in to your cwd. After the project has been initialised you will need to edit httpdocs/config/config.php before running the install command.
stan install - This will install the project, databases, node modules, bower components, composer classes, build the js/css libraries, do an ititial commit to git and upload to the remote server.
stan clone - This will clone an existing project in to your cwd. Please not the name of your cwd must match the git remote path.
stan update - This will update ./stan-cli with the latest version from this repo. Note - this will overwrite any custom methods you have added to the current project.
stan update global - This will update /usr/bin/stan with the latest version from this repo. Requires su permissions.
stan - To start developing on a project simply run the stan command with no added method. This will start the mysql server, http server, open atom and open chrome.
stan build - This will check for bower updates, recompile bower components and project specific less/js.
stan upload - This will upload to the remote server. If $STAGING_SERVER is set to true then it will upload to staging/ else it will upload to httpdocs/.
stan rebase - This will rebase the with the remote repo. A stash will be created and re-applied if required.
stan speedtests - This will run speedtests using gtmetrix and sitespeed.io.
stan optimise - This will optimise images used within the project.
stan db conf - This will create mysql.cnf files for the local, staging and production databases. This command will only need to be run if values change within httpdocs/config/config.php.
stan db synclocal - Exports the current staging or production database (based on $STAGING_SERVER value) and loads it in to the local mysql server.
stan db exportlocal - Export the current local database to database/database.sql.
stan db importlocal - Import database/database.sql in to the local mysql server.
stan db exportstaging - Export the current staging database to database/database.sql.
stan db importstaging - Import database/database.sql in to the staging mysql server.
stan db exportproduction - Export the current production database to database/database.sql.
stan db importproduction - Import database/database.sql in to the production mysql server.
stan deploy - This will deploy the current project/database from staging to production. A snapshot of tje production environment is automatically created.
stan snapshot - Create a snapshot of the current production environment. This will create an archive of the current httpdocs directory along with a copy of the production database. It will be stored in snapshots/[sitename]-[timestame].tar.gz.
stan restore snapshots/[filename] - This will delete the current production environment (no snapshot taken) and load in the specified snapshot.