lavmeiker / capistrano-wpcli

Provides command line tools to facilitate Wordpress deploy.
MIT License
117 stars 34 forks source link

Small issue with using Vagrant as a local dev environment. #38

Open Vinsanity opened 8 years ago

Vinsanity commented 8 years ago

Love this plugin BTW. Thanks for the hard work.

I ran into an issue with Vagrant being my local dev environment and using the server ... :roles%w{dev} and :dev_path settings you defined at the bottom of the README within deploy.rb.

Using Capistrano 3.6.1 and the current version of this plugin.

Basically when I attempt to run cap <stage> deploy it tries to deploy to my remote stage and the vagrant box simultaneously and errors out. However, when I set that server to :no_release, true it works again.

I created a development.rb file in the deploy folder so I could use the wpcli:run command from outside the box but I can't run that command from outside the box because it is looking for a release_path. Since my vagrant box isn't a release, would you recommend I take another approach or create a pull request to modify that task for wpcli:run?

My idea would be to modify it for the dev role something like this:

task :run, :command do |t, args|
  args.with_defaults(:command => :help)
    on roles(:dev) do
      within fetch(:dev_path) do
        execute :wp, args[:command], fetch(:wpcli_args)
      end
  end
  on release_roles(fetch(:wp_roles)) do
    within release_path do
      execute :wp, args[:command], fetch(:wpcli_args)
    end
  end
end

I haven't tested this yet. Just wondering if this is the right approach based on the deploy issue above?