Search code examples
gitsymfonycompass-sassassetic

assetic:dump from composer strange environment issue


I have composer setup to run assetic:dump :

"scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "php app/console assetic:dump --env=prod",
            "php app/console cache:clear --env=prod"
        ],

When I SSH into my server and run composer install, it works great with no issues. However, when I run composer install from a git post-update hook, I get strange errors about ruby not being able to find compass. Ruby and compass are both installed correctly and it works fine when I run composer install "manually".

Is there some environment issue that I am running into?

edit:

The actual error message is:

...../rubygems/dependency.rb:298:in `to_specs`: Could not find 'compass' (>= 0) among 14 total gem(s) (Gem::LoadError)

Solution

  • I figured out the issue. The git deploy script was running with an environment that did not contain the GEM_PATH environment variable. By adding this line before running assetic:dump in the git hook script, everything worked:

    export GEM_PATH=/usr/local/rvm/gems/ruby-2.1.2:/usr/local/rvm/gems/ruby-2.1.2@global