sshkit: SSHKit::Runner::ExecuteError: Exception while executing as deploy@myserver.com: undefined method `colorize' for :deploy:Symbol

First, thank you for all the hard work you guys have done on this project and capistrano. Capistrano is a critical a tool in the development, maintenance, and deployment of my rails apps. I don’t know if you guys hear that enough, but you should know that almost every rails dev I talk to uses capistrano to deploy. So thank you again.

Now, on to it:

Gem versions:

capistrano 3.3.5
sshkit 1.6.1
colorize 0.7.5

Whenever I attempt to attempt to deploy via the cap deploy task, I get the following error:

SSHKit::Runner::ExecuteError: Exception while executing as deploy@server.com: undefined method `colorize' for :deploy:Symbol

After running a stack trace, the error pointed to /lib/sshkit/color.rb:7.

module Color
  String.colors.each do |color|
    instance_eval <<-RUBY, __FILE__, __LINE__
      def #{color}(string = '')
        string = yield if block_given?
        colorize? ? string.colorize(:color => :#{color}) : string  # LINE 7
      end
    RUBY
  end

  # omitted
end

The quick fix for me was simply calling to_s on string

colorize? ? string.to_s.colorize(:color => :#{color}) : string

I don’t know if this is the right solution (probably not), but it solved my problem. If you like, I can submit a pull request.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Colorize dependency was removed in db7de6daae7211a3fd39d53833e2466d2c614d28