seattlerb/rake-remote_task

domain/repository/ attributes are polluted everywhere

mechiland opened this issue · 6 comments

require 'rake/remote_task'

class Test

end

# puts Test.domain
puts Test.methods

You will get a lot of methods!

private_class_method
autoload
autoload?
instance_method
public_instance_method
rake_extension
rake_original_const_missing
repository
deploy_to
domain
deploy_timestamped
deploy_via
keep_releases
rake_cmd
revision
rsync_cmd
rsync_flags
ssh_cmd
ssh_flags
sudo_cmd
sudo_flags
sudo_prompt
umask
mkdirs
shared_paths
perm_owner
perm_group
current_release
latest_release
previous_release
release_name
release_path
releases
current_path
releases_path
scm_path
shared_path
sudo_password

...And if it is used with vlad...you will never the Model.domain right because the remote_task will hijack the access. I already found it conflict with ActionMailer when it trying to access the domain method which will throw an exception saying cannot found :domain.

Please fix this asap, it's horrible to see I have a clean model but remote_task inject the attributes inside it.

Fix what?

% ruby -e 'class X; end; p X.methods.size'
81

Why are you loading rake/remote_task along-side action mailer? Vlad should only be loaded when you're deploying.

Hello?

I didn't load rake/remote_task along-side with action mailer - probably vlad did this? I don't know why but if you create a simple rails 3 app with Gemfile included below:

group :development do
  gem 'vlad'
end

and then run rails c, with very simple code like Object.domain, you will get error like this:

Rake::ConfigurationError: Please specify the server domain via the :domain variable

while obviously domain is not a method for Object, it should throw something like method not defined.

I agree that we should load remote-task only in a limited scope, then this should be an vlad issue. I switched to capistrano anyway so I am less concerned by the issue though.

On Apr 1, 2012, at 01:50 , Michael Chen wrote:

I agree that we should load remote-task only in a limited scope, then this should be an vlad issue. I switched to capistrano anyway so I am less concerned by the issue though.

Ah. No. This is a bundler autoload issue. Turn off autoload for vlad and it will be fine.

Other than the bundler autoload issue - is there a better way to mixin those methods? or it's by design - which means the user should be careful not to require remote-task many places?

it's by design... much like the rake dsl.