djoos-cookbooks / composer

Repository for composer cookbook
http://community.opscode.com/cookbooks/composer
MIT License
27 stars 38 forks source link

composer_project skipping due to "only_if" #63

Closed eugeneromero closed 8 years ago

eugeneromero commented 8 years ago

Hi guys! I need a bit of help. I'm obviously using the cookbook wrong, but I can't figure out why.

Got the following recipe:

include_recipe 'composer'

composer_project '/www/satis' do
  vendor 'composer/satis'
  path '/www/satis'
  dev true
  quiet false
  action [:require, :install]
end

Which I would think installs composer and deploys "satis" to my machine. However, when my recipe runs, I get the following output for "composer_project":

* composer_project[/www/satis] action require
           * execute[Install-composer-for-single-project] action run (skipped due to only_if)
         * composer_project[/www/satis] action install
           * execute[install-composer-for-project] action run (skipped due to only_if)

Composer installs but satis is not deployed. What is the proper way of doing what I'm trying to do?

Thanks in advance!

djoos commented 8 years ago

Hi @papa-gene,

could you give this a go?

init a composer.json in /www/satis

composer_project '/www/satis' do vendor 'composer/satis' dev true quiet false action :require end

composer install

composer_project '/www/satis' do dev true quiet false action :install end

Thanks in advance for your feedback! David

eugeneromero commented 8 years ago

Hey David, thanks for getting back to me! I think I figured out the cause of my problem. I guess the destination directory you feed composer_project must already exist (in this case, /www/satis)! Since running composer manually creates the last destination dir, and other cookbook I'd tried do that too, I for some reason never stopped to think it might need to already exist here. Maybe it would be good to add a note to the README?

Now that I have that working, I'm wondering, how can I pass the equivalent of "--stability=dev" and "--keep-vcs" to composer_project? Since satis only exists at "dev" level, running the recipe like above gives me the following error: "Could not find package composer/satis at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability". Ideas?

Sorry for spamming the issues section asking general usage questions... Couldn't think of a better way to reach out to the dev :)

djoos commented 8 years ago

Those options are not available in the LWRP, however: what about laying down your composer.json via Chef (ie. write file to disk via a template) and then using the LWRP for the actual install?

It would be good to allow for "extra_params" on the command(s) in the LWRP to make it more flexible though in this cookbook...

Hope this helps! David

djoos commented 8 years ago

Oh, re: dir Yes, it would be good to put that in the docs!

eugeneromero commented 8 years ago

Thanks David! That is a good idea. I'll test it out on Monday when I'm back at the office (just got off). Feel free to close the issue, or leave it open if you need a reminder regarding the README change :)

djoos commented 8 years ago

Thanks for the pointers, closing this ticket!