What are the available methods does deploy_revision have to check the source repo versions?

Hi Chefellas!

I’ve deployed a rails 3 app using deploy_revision resource with asset compilation is done inside the before_restart block and it works fine.

Since it takes too long and though any assets is not changed, it will still do the precompilation.

before_restart do
bash “asset_precompile” do
cwd current_release
user app[:owner]
group app[:group]
code %{
export RAILS_ENV=#{rails_env}
bundle exec rake assets:precompile --trace
}
action :run
end
end

There are several work arounds in capistrano. One of which is https://github.com/capistrano/capistrano/pull/174/files#L1L40

Does the deploy_revision have the following kind of methods which capistrano has?

e.g. source, previous_revision

So that I could make the asset compilation conditional.


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tue, May 29, 2012 at 8:15 PM, Sachin Sagar Rai millisami@gmail.com wrote:

Hi Chefellas!

I've deployed a rails 3 app using deploy_revision resource with asset
compilation is done inside the before_restart block and it works fine.

Since it takes too long and though any assets is not changed, it will still
do the precompilation.

before_restart do
bash "asset_precompile" do
cwd current_release
user app[:owner]
group app[:group]
code %{
export RAILS_ENV=#{rails_env}
bundle exec rake assets:precompile --trace
}
action :run
end
end

No reason to look for a workaround, this should work. I.e. the
before_restart will only be invoked if the revision changed.

If you're seeing a different behavior, you should try to figure out
what's going wrong instead of looking for complicated workarounds.
Not to pick on you, but the number one rule when seeking help on a ml
for an open source project is, provide enough information that people
can help you.
Please send the relevant parts of a chef-client -l debug.
You are looking for a line similar to: #{@new_resource} is the latest version

Andrea

Thaks, very well said.

@millisami
~Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com

On Thu, May 31, 2012 at 12:39 PM, Andrea Campi <andrea.campi@zephirworks.com

wrote:

On Tue, May 29, 2012 at 8:15 PM, Sachin Sagar Rai millisami@gmail.com
wrote:

Hi Chefellas!

I've deployed a rails 3 app using deploy_revision resource with asset
compilation is done inside the before_restart block and it works fine.

Since it takes too long and though any assets is not changed, it will
still
do the precompilation.

before_restart do
bash "asset_precompile" do
cwd current_release
user app[:owner]
group app[:group]
code %{
export RAILS_ENV=#{rails_env}
bundle exec rake assets:precompile --trace
}
action :run
end
end

No reason to look for a workaround, this should work. I.e. the
before_restart will only be invoked if the revision changed.

If you're seeing a different behavior, you should try to figure out
what's going wrong instead of looking for complicated workarounds.
Not to pick on you, but the number one rule when seeking help on a ml
for an open source project is, provide enough information that people
can help you.
Please send the relevant parts of a chef-client -l debug.
You are looking for a line similar to: #{@new_resource} is the latest
version

Andrea