Skip to content

Commit

Permalink
Implement new init replacements for better initial scaffolding.
Browse files Browse the repository at this point in the history
  • Loading branch information
spAnser committed May 4, 2017
1 parent c28d4ba commit 55c3ce3
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 28 deletions.
13 changes: 4 additions & 9 deletions root/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
### In terminal run:

1. `npm install`
1. `cd dist && valet link example && cd ..`
1. `cd dist && valet link {%= domain_name %} && cd ..`
1. `brew update && brew install bash` for OSX to upgrade to Bash 4.x
1. `addSubmodules.sh --force` to install submodules. If you want to cherry pick specific submodules, run the command without `--force`
1. `grunt`
Expand All @@ -27,7 +27,7 @@
* MySQL Host: `127.0.0.1`
* Username: `root`
* Password: *None*
* Database: `PROJECT_cmsdb_dev`
* Database: `{%= domain_name %}_cmsdb_dev`
* Port: (default)

### Dev DB Backup
Expand Down Expand Up @@ -81,13 +81,8 @@ If the plugin does not have a public repository. You can just copy the plugin fo

This will rsync down the media files from the server. It will most likely ask for a password when run.

##### From Prod
1. script will need execute permissions `chmod +x ./rsync_media_prod.sh`
1. `./rsync_media_prod.sh`

##### From Stage
1. script will need execute permissions `chmod +x ./rsync_media_stage.sh`
1. `./rsync_media_stage.sh`
1. script will need execute permissions `chmod +x ./rsync.sh`
1. `./rsync.sh`

### Upgrading Craft CMS to the latest version
* Update the version in `grunt/curl.coffee`.
Expand Down
4 changes: 2 additions & 2 deletions root/grunt/critical.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
module.exports = (grunt) ->
grunt.config 'critical',
page:
src: 'http://example.dev'
src: 'http://{%= domain_name %}.dev'
dest: './src/templates/page_critical.css'
options:
width: 1200
height: 900
four_o_four:
src: 'http://example.dev/404'
src: 'http://{%= domain_name %}.dev/404'
dest: './src/templates/404_critical.css'
options:
width: 1200
Expand Down
56 changes: 56 additions & 0 deletions root/rsync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#! /bin/bash

printf " [0] Dev -> Local\n"
printf " [1] Stage -> Local\n"
printf " [2] Prod -> Local\n"
printf " [3] Dev -> Stage\n"
printf " [4] Dev -> Prod\n"
printf " [5] Stage -> Dev\n"
printf " [6] Stage -> Prod\n"
printf " [7] Prod -> Dev\n"
printf " [8] Prod -> Stage\n"
echo "Which rsync do you want to run?"
read Choice

if [ "${Choice}" -eq "0" ]; then
rsync -avzh {%= server_user %}:/srv/dev_{%= domain_name %}_{%= domain_tld %}/public/media ./src

elif [ "${Choice}" -eq "1" ]; then
rsync -avzh {%= server_user %}:/srv/stage_{%= domain_name %}_{%= domain_tld %}/public/media ./src

elif [ "${Choice}" -eq "2" ]; then
rsync -avzh {%= server_user %}:/srv/{%= domain_name %}_{%= domain_tld %}/public/media ./src

elif [ "${Choice}" -eq "3" ]; then
ssh {%= server_user %} << EOF
rsync -avzh /srv/dev_{%= domain_name %}_{%= domain_tld %}/public/media/ /srv/stage_{%= domain_name %}_{%= domain_tld %}/public/media
EOF

elif [ "${Choice}" -eq "4" ]; then
ssh {%= server_user %} << EOF
rsync -avzh /srv/dev_{%= domain_name %}_{%= domain_tld %}/public/media/ /srv/{%= domain_name %}_{%= domain_tld %}/public/media
EOF

elif [ "${Choice}" -eq "5" ]; then
ssh {%= server_user %} << EOF
rsync -avzh /srv/stage_{%= domain_name %}_{%= domain_tld %}/public/media/ /srv/dev_{%= domain_name %}_{%= domain_tld %}/public/media
EOF

elif [ "${Choice}" -eq "6" ]; then
ssh {%= server_user %} << EOF
rsync -avzh /srv/stage_{%= domain_name %}_{%= domain_tld %}/public/media/ /srv/{%= domain_name %}_{%= domain_tld %}/public/media
EOF

elif [ "${Choice}" -eq "7" ]; then
ssh {%= server_user %} << EOF
rsync -avzh /srv/{%= domain_name %}_{%= domain_tld %}/public/media/ /srv/dev_{%= domain_name %}_{%= domain_tld %}/public/media
EOF

elif [ "${Choice}" -eq "8" ]; then
ssh {%= server_user %} << EOF
rsync -avzh /srv/{%= domain_name %}_{%= domain_tld %}/public/media/ /srv/stage_{%= domain_name %}_{%= domain_tld %}/public/media
EOF

else
echo "Incorrect Selection"
fi
2 changes: 0 additions & 2 deletions root/rsync_media_prod.sh

This file was deleted.

2 changes: 0 additions & 2 deletions root/rsync_media_stage.sh

This file was deleted.

14 changes: 7 additions & 7 deletions root/src/craft/config/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@
// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' => '127.0.0.1',
// The database username to connect with.
'user' => 'DB_USERNAME',
'user' => '{%= server_user %}',
// The database password to connect with.
'password' => 'DB_PASSWORD',
// The name of the database to select.
'database' => 'PROJECT_cmsdb_prod',
'database' => '{%= domain_name %}_cmsdb_prod',
// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => 'craft',
),
'stage.' => array(
// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' => '127.0.0.1',
// The database username to connect with.
'user' => 'DB_USERNAME',
'user' => '{%= server_user %}',
// The database password to connect with.
'password' => 'DB_PASSWORD',
// The name of the database to select.
'database' => 'PROJECT_cmsdb_stage',
'database' => '{%= domain_name %}_cmsdb_stage',
// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => 'craft',
),
'dev.' => array(
// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' => '127.0.0.1',
// The database username to connect with.
'user' => 'DB_USERNAME',
'user' => '{%= server_user %}',
// The database password to connect with.
'password' => 'DB_PASSWORD',
// The name of the database to select.
'database' => 'PROJECT_cmsdb_dev',
'database' => '{%= domain_name %}_cmsdb_dev',
// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => 'craft',
),
Expand All @@ -52,7 +52,7 @@
// The database password to connect with.
'password' => '',
// The name of the database to select.
'database' => 'PROJECT_cmsdb_dev',
'database' => '{%= domain_name %}_cmsdb_dev',
// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => 'craft',
),
Expand Down
8 changes: 4 additions & 4 deletions root/src/craft/config/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
'maxUploadFileSize' => '120000000',

'environmentVariables' => array(
'baseUrl' => 'http://example.com/',
'baseUrl' => 'http://{%= domain_name %}.{%= domain_tld %}/',
'enableBugHerd' => false,
)
),

'stage.' => array(
'environmentVariables' => array(
'baseUrl' => 'http://stage.example.com/',
'baseUrl' => 'http://stage.{%= domain_name %}.{%= domain_tld %}/',
'enableBugHerd' => true,
)
),
Expand All @@ -31,7 +31,7 @@
'enableTemplateCaching' => false,

'environmentVariables' => array(
'baseUrl' => 'http://dev.example.com/',
'baseUrl' => 'http://dev.{%= domain_name %}.{%= domain_tld %}/',
'enableBugHerd' => true,
)
),
Expand All @@ -42,7 +42,7 @@
'enableTemplateCaching' => false,

'environmentVariables' => array(
'baseUrl' => 'http://example.dev/',
'baseUrl' => 'http://{%= domain_name %}.dev/',
'enableBugHerd' => true,
)
),
Expand Down
2 changes: 1 addition & 1 deletion root/src/craft/config/imager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
),
'.dev' => array(
'cacheEnabled' => false,
'imagerSystemPath' => $_SERVER['HOME'] . '/.valet/Sites/example/public/imager', // This is needed since valet doesn't report set the $_SERVER['DOCUMENT_ROOT'] properly
'imagerSystemPath' => $_SERVER['HOME'] . '/.valet/Sites/{%= domain_name %}/public/imager', // This is needed since valet doesn't report set the $_SERVER['DOCUMENT_ROOT'] properly
)
);
5 changes: 4 additions & 1 deletion template.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ exports.template = function(grunt, init, done) {
// Prompt for these values.
init.prompt('name'),
init.prompt('author_name'),
init.prompt('author_email')
init.prompt('author_email'),
init.prompt('domain_name'),
init.prompt('domain_tld'),
init.prompt('server_user')
], function(err, props) {
// Files to copy (and process).
var files = init.filesToCopy(props);
Expand Down

0 comments on commit 55c3ce3

Please sign in to comment.