Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do some tasks after deploy #98

Closed
musashimm opened this issue Feb 24, 2013 · 7 comments
Closed

Do some tasks after deploy #98

musashimm opened this issue Feb 24, 2013 · 7 comments

Comments

@musashimm
Copy link

I want to do some tasks after deploy. So i put invoke as last entry in deploy section

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do

  to :launch do
    queue 'touch tmp/restart.txt'
    invoke :qwerty
  end
end
end

task :qwerty do
  puts "ls"
  system 'ls'
end

But ls command is run before commands in the queue:

ls
Gemfile  Gemfile.lock  README.rdoc  Rakefile  app config  config.ru  db doc  lib  log  public  script  test  tmp  vendor
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'

So how to check if deploy is finished or run command after deploy.

@beirigo
Copy link
Contributor

beirigo commented Feb 25, 2013

puts and system run directly on your terminal (not on the remote server) right away after invoked.
queuein the other hand queues a given command to run on the server. That's why you see the output of qwertyfirst.

@musashimm
Copy link
Author

As I expected, but do you think there is a need for such functionality. As I studied source code there is only one command queue, which is executed on the remote end. In my situation I would like to override some configuration but only after deployment. Now I do it by defining tasks with only system commands and executing them after deploy task.

@beirigo
Copy link
Contributor

beirigo commented Feb 25, 2013

I'm not sure if I understand you.
Do you want to run querty on the server after deploy? if so you can do as follows:

task :qwerty do
  queue!  %[echo "ls"]
  queue! "ls"
end

@musashimm
Copy link
Author

No , I want something such as:

task :qwerty => :deploy do
  system "scp specific_config.txt #{deploy_to}/config"
end

@elskwid
Copy link

elskwid commented Dec 1, 2013

@musashimm, I have no idea if you're still struggling with this. I had a need for this exact functionality so I put together mina-hooks which gives you the ability to use before_mina :"some:task" and after_mina :"another:task", :"and:another:task".

Let me know if you have an issues.

@musashimm
Copy link
Author

now i do

mina deploy; mina something

from shell but no doubt I wanted the functionality You wrote. I will test it at the first opportunity.
Thanks for your work.

@d4be4st
Copy link
Member

d4be4st commented Jul 5, 2015

this can be done with :after_hooks in newer mina versions

@d4be4st d4be4st closed this as completed Jul 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants