cmf-sandbox icon indicating copy to clipboard operation
cmf-sandbox copied to clipboard

handle jackrabbit setup on vagrant up even if composer install was already run

Open lsmith77 opened this issue 11 years ago • 0 comments

this is a continuation of the work done in #120

i just added a command to list workspaces (requires updating phpcr-utils and the PHPCR bundle): app/console doctrine:phpcr:workspace:list

so if someone has time they could work on using this in the recipe:

diff --git a/vagrant/cookbook/recipes/default.rb b/vagrant/cookbook/recipes/default.rb
index 344c880..8423f7f 100644
--- a/vagrant/cookbook/recipes/default.rb
+++ b/vagrant/cookbook/recipes/default.rb
@@ -87,8 +87,8 @@ execute "date.timezone = UTC in php.ini?" do
   command "echo -e '\ndate.timezone = UTC\n' >> /etc/php5/cli/php.ini"
 end

-bash "Running composer install and preparing the phpcr repository" do
-  not_if "test -e /vagrant/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public"
+bash "Running composer install" do
+  not_if "test -e /vagrant/vendor/composer/installed.json"
   user "vagrant"
   cwd "/vagrant"
   code <<-EOH
@@ -96,10 +96,20 @@ bash "Running composer install and preparing the phpcr repository" do
     ln -sf /var/tmp/vendor
     curl -s https://getcomposer.org/installer | php
     COMPOSER_VENDOR_DIR="/var/tmp/vendor" php composer.phar install
-    echo "Waiting for Jackrabbit:"
+  EOH
+end
+
+bash "Waiting for Jackrabbit and preparing the phpcr repository" do
+  user "vagrant"
+  cwd "/vagrant"
+  code <<-EOH
+    set -e
     while [[ -z `curl -s "http://localhost:8080"` ]] ; do sleep 1s; echo -n "."; done
-    app/console doctrine:phpcr:workspace:create sandbox
-    app/console doctrine:phpcr:register-system-node-types
-    app/console -v doctrine:phpcr:fixtures:load
+    app/console doctrine:phpcr:workspace:list
+    if () {
+        app/console doctrine:phpcr:workspace:create sandbox
+        app/console doctrine:phpcr:register-system-node-types
+        app/console -v doctrine:phpcr:fixtures:load
+    }
   EOH
 end

lsmith77 avatar Sep 11 '12 09:09 lsmith77