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

Added deploy:set_rails_env to run after invoking stage #66

Merged
merged 1 commit into from May 26, 2014
Merged

Added deploy:set_rails_env to run after invoking stage #66

merged 1 commit into from May 26, 2014

Conversation

sponomarev
Copy link
Contributor

Hello!

What about setting RAILS_ENV before all tasks after invoking stage?

Capistrano::DSL.stages.each do |stage|
  after stage, 'deploy:set_rails_env'
end

It'l be useful in other gems using RAILS_ENV for transparent support, ex. capistrano3-rails etc.

@donbobka
Copy link

👍

@kirs
Copy link
Member

kirs commented Apr 11, 2014

Nice idea!
Are you sure that in task :normalize_assets => [:set_rails_env] :set_rails_envwon't be executed twice?

@sponomarev
Copy link
Contributor Author

Yes, i am. Rake dependencies run only once. Simple example can prove it.

namespace :my_test do
  desc 'Dependency'
  task :dependency do
    puts 'This is very important dependency'
  end

  desc 'Task1'
  task :task1 => :dependency do
    puts 'This is task 1'
  end

  desc 'Task2'
  task :task2 => :dependency do
    puts 'This is task 2'
  end

  desc 'Run all tasks'
  task :all => [:task1, :task2]
end

dependency task runs only once as you see.

toad@taunton:~/Projects/SaltPepper/snp-testapp $ rake my_test:all --trace
** Invoke my_test:all (first_time)
** Invoke my_test:task1 (first_time)
** Invoke my_test:dependency (first_time)
** Execute my_test:dependency
This is very important dependency
** Execute my_test:task1
This is task 1
** Invoke my_test:task2 (first_time)
** Invoke my_test:dependency
** Execute my_test:task2
This is task 2
** Execute my_test:all

capistrano:deploy's trace also proves it, but it's log is so looooong 😄

kirs added a commit that referenced this pull request May 26, 2014
Added deploy:set_rails_env to run after invoking stage
@kirs kirs merged commit 82894e8 into capistrano:master May 26, 2014
@kirs
Copy link
Member

kirs commented May 26, 2014

Thanks!

zshannon pushed a commit to zshannon/capistrano-rails that referenced this pull request Nov 3, 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

Successfully merging this pull request may close these issues.

None yet

3 participants