phallstrom / slackistrano

Slack integration for Capistrano deployments.
MIT License
374 stars 74 forks source link

undefined method `after' for main:Object #16

Closed comp615 closed 9 years ago

comp615 commented 9 years ago

So got everything set up and working when I'm using capistrano, but outside of that, when I try to run a normal rails rake task (e.g. rake routes) I'm getting: NoMethodError: undefined method `after' for main:Object /opt/twitter/rvm/gems/ruby-2.2.0/gems/slackistrano-0.1.6/lib/slackistrano/tasks/slack.rake:76

rails 4.2 capistrano 3.4 slackistrano 0.1.6

I was able to fix this in my Gemfile by doing: gem 'slackistrano', :require => nil

But I figure there must be a better way since I haven't had to do this for any other cap plugins. Just thought I'd post my solution here and see if anyone could translate that into a patch!

phallstrom commented 9 years ago

I've always used gem 'slackistrano', require: false. Do your other cap plugins add rake tasks? Point me to one and I'll see if I can make an adjustment.

comp615 commented 9 years ago

https://github.com/capistrano/rails/ https://github.com/capistrano/rvm/blob/master/lib/capistrano/tasks/rvm.rake etc. I think those both seem to have the after requirements in them too, but handle it differently via namespacing?

phallstrom commented 9 years ago

So, the difference is that the above gems don't load an task files by default. That is gem 'capistrano-rvm' doesn't really require anything. Which is why the instructions say to add require 'capistrano/rvm' to your Capfile. Slackistrano doesn't do it that way so the require: false is necessary. I could change it, but it would mean having to make everyone change their Capfile to load some other file as well. Going to leave it as is for now.