npm-antman v1.0.1
\ /
\ /
\.-./
(o\^/o) _ _ _ __
./ \.\ ( )-( )-( ) .-' '-.
{-} \(// || \\/ ( )) '-.
//-__||__.-\\. .-'
(/ () \)'-._.-'
|| || \\
(' (' ')
. . . . . . . ANTMAN . . . . . . . .
Antman is a set of scripts to automate site updating on your local machine, staging and live.
Install
First, make sure you have composer installed.
Add "ROOT FOLDER/vendor" to your project .gitignore file.
Next, in de Drupal root add the following to existing composer.json or create a new one:
{
"name": "puresign/antmanclient",
"minimum-stability": "dev",
"require": {
"puresign/antman": "dev-master"
},
"repositories": [
{
"type": "git",
"url": "git@gitlab.com:puresign/antman.git"
}
]
}
Then run:
$ composer install
Composer will create a new directory called 'vendor' in your site's root with the project's composer files.
Update
In theory, the following procedure should update and keep your project's settings:
$ composer update
If you have changes, which will be the case if you have made your personal changes in settings.sh, composer will show you something like:
Updating puresign/antman dev-master (850ec67 => 71226dd) The package has modified files: M bin/antman.sh M bin/helpers.sh M bin/settings.sh Discard changes y,n,v,d,s,??
Choose 's', which means stash local changes and re-apply after update. In most cases this works with a problem.
If you want to be sure, make a copy of your settings.sh to your project root, and cross-check after update.
Test Antman
In your site root, run:
$ sh vendor/bin/antman.sh
Note: Antman always must be run from your site root.
Settings file
Update local, stagig and live credentials in the antman settings file
vendor/puresign/antman/bin/settings.sh
Alias
Add alias to your bash profile:
alias am="sh vendor/bin/antman.sh"
Then you can run the script using:
$ am
Commands
Local
$ am local
Will:
- make sure your code is up to date
- test if the DB exists and if not, creates it
- update your local site with a fresh DB import from staging
- sanitize the DB
- run any pending database updates
- enable or disabled modules according to your settings
- setup stage_file_proxy
- update some configuration for development
- clear caches
Has options:
- --modules: only check the modules to be enabled or disabled
- --modules-debug: install package of debug and analysis modules
- --scrub: sanitize your local DB again
- --skip-db: all but DB import from staging + scrubbing
- --live-db: Update local with a DB dump from live
Staging
$ am staging
Will:
- make sure the code is up to date
- run any pending database updates
- enable or disabled modules according to your settings
- clear caches
Has options:
- --ssh: open ssh terminal to this server
Live
$ am live
Will:
- make sure the code is up to date
- run any pending database updates
- enable or disabled modules according to your settings
- clear caches
Has options:
- --ssh: open ssh terminal to this server
Future
- Copy and import DB from live directly to staging and keep a backup DB dump on staging.
- Extensive DB scrubbing on local after DB import
- NPM version
- ...