bodrovis / lokalise_rails

Ruby on Rails integration for Lokalise
MIT License
17 stars 3 forks source link

lokalise_rails:import fails in v4.0.0 #10

Closed SidorenkoD closed 2 years ago

SidorenkoD commented 2 years ago

Running of rails lokalise_rails:import raises #<NoMethodError: undefined method 'filter' for #<Array:...>>

The reason is usage of Array#filter here. Array#filter was added in Ruby 2.6, while gemspec of lokalise_manager v2.1.0 is meant to work on Ruby 2.5.0

bodrovis commented 2 years ago

Yeah, unfortunately it seems to be the case. I'm sorry for this! Here's a quick solution:

class Array
  def filter(&block)
    self.select(&block)
  end
end

This will serve as polyfill for the filter method (select should be available in 2.5).

bodrovis commented 2 years ago

I've published lokalise_manager v2.2.1 which is used by lokalise_rails v4 and fixed that issue https://github.com/bodrovis/lokalise_manager/commit/9fc47fb7c5bcaa002c0ba77e40e60af492d57b5d Just to be on a safe side, you can manually include it into your Gemfile:

lokalise_rails, '~> 4'
lokalise_manager, '2.2.1'
SidorenkoD commented 2 years ago

Now there's a problem with faraday:

  1. lokalise_manager v2.2.1 requires ruby-lokalise-api v5.0
  2. ruby-lokalise-api v5.0 requires faraday v2.0
  3. faraday v2.0 requires Ruby 2.6

Please check all your dependecies chain on Ruby 2.5, so I'm not ought to report it again =)

bodrovis commented 2 years ago

Weeeell, yeah. Formally, this gem had Ruby 2.5 specified as a supported platform but actually I'm pretty sure it was a mistake from my side as it was never tested with that version, at least starting from v3. Ruby 2.5 was abandoned quite some time ago and I really don't have any plans to backport this gem for Ruby 2.5, to be honest. I'll see what can be done but can't make any promises :(

bodrovis commented 2 years ago

Perhaps, the simplest solution is to stay on v3 which is very similar to v4 (the main difference is that it doesn't use multithreading). In this case you should be good as it relies on Faraday 1.