'Resolving incompatible ruby gems: fast_excel and jira-ruby

I've been using the fast_excel gem to write data to an excel sheet and have recently imported the jira-ruby gem to pull data from Atlassian Jira. As soon as I imported the jira-ruby gem I started getting the below error when trying to use the fast_excel gem:

NoMethodError (undefined method `utc_offset' for nil:NilClass)

Which is being thrown from this chunk of code in the fast_excel gem:

      # Try use Rails' app timezone
      if Time.respond_to?(:zone)
        offset = Time.zone.utc_offset
      else
        offset = 0 # rollback to UTC
      end

A simple test:

require 'jira-ruby'

if Time.respond_to?(:zone)
  offset = Time.zone.utc_offset
else
  offset = 0
end

puts offset

produces NoMethodError (undefined method utc_offset for nil:NilClass), whereas

if Time.respond_to?(:zone)
  offset = Time.zone.utc_offset
else
  offset = 0
end

puts offset

Produces 0 as expected.

Now I can raise an issue with the maintainers of these gems, but in the meantime how can I identify the source of the issue and fix it? Obviously I can monkey around the fast_excel gem source code which would solve the problem locally but our build process pulls these gems down automatically and it would fail there. Any pointers appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source