Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Ruby 2.6.0-preview1 #4

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
@@ -1 +1 @@
2.5.3
2.6.0
4 changes: 1 addition & 3 deletions Gemfile
@@ -1,7 +1,7 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '>= 2.3.0', '< 2.6.0'
ruby ' 2.6.0'

gem 'pkg-config', '~> 1.3'

Expand Down Expand Up @@ -29,7 +29,6 @@ gem 'browser'
gem 'charlock_holmes', '~> 0.7.6'
gem 'iso-639'
gem 'chewy', '~> 5.0'
gem 'cld3', '~> 3.2.0'
gem 'devise', '~> 4.5'
gem 'devise-two-factor', '~> 3.0'

Expand All @@ -53,7 +52,6 @@ gem 'http', '~> 3.3'
gem 'http_accept_language', '~> 2.1'
gem 'http_parser.rb', '~> 0.6', git: 'https://github.com/tmm1/http_parser.rb', ref: '54b17ba8c7d8d20a16dfc65d1775241833219cf2'
gem 'httplog', '~> 1.1'
gem 'idn-ruby', require: 'idn'
gem 'kaminari', '~> 1.1'
gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.2', require: 'mime/types/columnar'
Expand Down
10 changes: 1 addition & 9 deletions Gemfile.lock
Expand Up @@ -142,8 +142,6 @@ GEM
elasticsearch (>= 2.0.0)
elasticsearch-dsl
chunky_png (1.3.10)
cld3 (3.2.2)
ffi (>= 1.1.0, < 1.10.0)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
Expand Down Expand Up @@ -281,7 +279,6 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.0)
ipaddress (0.8.3)
iso-639 (0.2.8)
jaro_winkler (1.5.1)
Expand Down Expand Up @@ -671,7 +668,6 @@ DEPENDENCIES
capybara (~> 3.12)
charlock_holmes (~> 0.7.6)
chewy (~> 5.0)
cld3 (~> 3.2.0)
climate_control (~> 0.2)
derailed_benchmarks
devise (~> 4.5)
Expand All @@ -695,7 +691,6 @@ DEPENDENCIES
http_parser.rb (~> 0.6)!
httplog (~> 1.1)
i18n-tasks (~> 0.9)
idn-ruby
iso-639
json-ld (~> 2.2)
json-ld-preloaded (~> 2.2)
Expand Down Expand Up @@ -770,7 +765,4 @@ DEPENDENCIES
webpush

RUBY VERSION
ruby 2.5.3p105

BUNDLED WITH
1.16.6
ruby 2.6.0
11 changes: 2 additions & 9 deletions app/lib/language_detector.rb
Expand Up @@ -5,10 +5,6 @@ class LanguageDetector

CHARACTER_THRESHOLD = 140

def initialize
@identifier = CLD3::NNetLanguageIdentifier.new(1, 2048)
end

def detect(text, account)
input_text = prepare_text(text)
return if input_text.blank?
Expand All @@ -17,9 +13,7 @@ def detect(text, account)
end

def language_names
@language_names =
CLD3::TaskContextParams::LANGUAGE_NAMES.map { |name| iso6391(name.to_s).to_sym }
.uniq
[:en]
end

private
Expand All @@ -35,8 +29,7 @@ def unreliable_input?(text)
def detect_language_code(text)
return if unreliable_input?(text)

result = @identifier.find_language(text)
iso6391(result.language.to_s).to_sym if result.reliable?
return nil
end

def iso6391(bcp47)
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Expand Up @@ -99,7 +99,7 @@ class Application < Rails::Application
config.active_job.queue_adapter = :sidekiq

config.middleware.use Rack::Attack
config.middleware.use Rack::Deflater
config.middleware.insert_after ActionDispatch::Static, Rack::Deflater

config.to_prepare do
Doorkeeper::AuthorizationsController.layout 'modal'
Expand Down