[Git][noosfero/noosfero][api] Define specific grape logging version to avoid undefined method "downcase"

Antonio Terceiro terceiro at colivre.coop.br
Tue Jul 21 10:43:56 BRT 2015


On Mon, Jul 20, 2015 at 09:55:43PM -0300, Leandro Nunes wrote:
> Hi Terceiro,
> 
> I asked the package's author for a new release.
> Without this fix the tests are breaking.
> I think we have two options:
>    - Make a monkey patch: We could forget to remove all the code related
> with the correction

what kind of test fails because of a problem with logging ?

>    - Refer the commit like I did: Is more easy to fix the code after the
> package update

the problem with doing this is that it is now *impossible* to satisfy
the dependencies with packages.

> What is the way we have to follow?

can't you just disable the logging if the version is smaller than what
you need, e.g. something like this in lib/noosfero/api/api.rb:

module Noosfero
  module API
    class API < Grape::API

      # ...

      if GrapeLogging::VERSION > '1.1.3'
        logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log"))
        logger.formatter = GrapeLogging::Formatters::Default.new
        use GrapeLogging::Middleware::RequestLogger, { logger: logger }
      end

      # ...
    end
  end
end

By the way, are you sure that this logging setup there is thread safe?

-- 
Antonio Terceiro <terceiro at colivre.coop.br>
Colivre - Cooperativa de Tecnologias Livres
http://www.colivre.coop.br/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150721/b31f34eb/attachment.pgp>


More information about the Noosfero-dev mailing list