diff options
-rw-r--r-- | files/wordpress.sh (renamed from templates/wordpress.sh.erb) | 26 | ||||
-rw-r--r-- | manifests/init.pp | 27 |
2 files changed, 28 insertions, 25 deletions
diff --git a/templates/wordpress.sh.erb b/files/wordpress.sh index 052543c..773eab7 100644 --- a/templates/wordpress.sh.erb +++ b/files/wordpress.sh @@ -3,8 +3,10 @@ # wordpress management script. # -BASE="<%= folder %>" -LOCALE="<%= real_wordpress_locale %>" +BASE="/var/www/data" +LOCALE="-pt_BR" +WP_CLI="/usr/local/bin/wp-cli" +BASENAME="`basename $0`" # Set alternative base function wordpress_set_base { @@ -23,7 +25,7 @@ function wordpress_check_existing { if [ -e "$BASE/wordpress-$1" ]; then echo "Folder $BASE/wordpress-$1 already exists, skipping." exit 1 - fi + fi } # Deploy a fresh wordpress tree @@ -68,10 +70,10 @@ function wordpress_upgrade { fi cp -alf wordpress-$old wordpress-$old.backup - + # Deploy a fresh wordpress tree wordpress_deploy $new - + # Copy files for file in .htaccess wp-config.php; do if [ -e "wordpress-$old/$file" ]; then @@ -85,7 +87,7 @@ function wordpress_upgrade { cp -Rp ../wordpress-$old/$extra_folder . fi done - + # Files rsync -av wordpress-$old/wp-content/uploads/ wordpress-$new/wp-content/uploads/ rsync -av wordpress-$old/wp-content/blogs.dir/ wordpress-$new/wp-content/blogs.dir/ @@ -130,11 +132,11 @@ function wordpress_upgrade { # Usage function wordpress_usage { echo "Installation management commands:" - echo " wp deploy <version>" - echo " wp upgrade <old-version> <new-version>" + echo " $BASENAME deploy <version>" + echo " $BASENAME upgrade <old-version> <new-version>" echo "" echo -n "Wordpress CLI " - /usr/local/share/wp-cli/bin/wp help + $WP_CLI help } # Main procedure @@ -152,7 +154,7 @@ elif [ "$1" == "help" ]; then #elif [ "$1" == "core" ]; then # echo "Please use deploy or upgrade instead." else - # Send all other requests to wp-cli - #/usr/local/share/wp-cli/src/bin/wp --path=$BASE/wordpress $* - /usr/local/share/wp-cli/bin/wp $* + # Send all other requests to wp-cli + #$WP_CLI --path=$BASE/wordpress $* + $WP_CLI $* fi diff --git a/manifests/init.pp b/manifests/init.pp index 423b3ba..9af4b97 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,29 +1,30 @@ -class wordpress( - $folder = '/var/www/data', - $locale = hiera('wordpress::locale', '') -) { - - $real_wordpress_locale = $locale ? { - '' => '', - default => "-${locale}" - } - +class wordpress { file { "/usr/local/sbin/wordpress": ensure => present, - content => template('wordpress/wordpress.sh.erb'), + source => "puppet:///modules/wordpress/wordpress.sh", owner => root, group => root, mode => 755, } + # Composer + exec { 'getwp': + command => '/usr/bin/wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp-cli', + user => 'root', + cwd => '/tmp', + creates => '/usr/local/bin/wp-cli', + } + + # TODO: remove in the future file { "/usr/local/sbin/wp": - ensure => '/usr/local/sbin/wordpress', + ensure => absent, owner => root, group => root, } + # TODO: remove in the future vcsrepo { "/usr/local/share/wp-cli": - ensure => present, + ensure => absent, provider => git, source => 'git://github.com/wp-cli/wp-cli.git', revision => 'b30a0745ef5ffe1c9f2a4d9a021aef213a78c867', |