Skip to content

Commit

Permalink
Merge pull request #21 from insales/rails71
Browse files Browse the repository at this point in the history
Allow and test rails 7.1
  • Loading branch information
Vasfed authored Oct 23, 2023
2 parents 444fff7 + 244f833 commit 8e13212
Show file tree
Hide file tree
Showing 35 changed files with 414 additions and 427 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pronto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
ruby-version: '3.2'
bundler-cache: true
- run: bundle exec pronto run -f github_status github_pr_review -c origin/master
env:
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ jobs:
strategy:
matrix:
include:
# EKAM
- ruby-version: 2.5.8
- ruby-version: 2.6.10
rails-version: 52
# InSales, 1C
- ruby-version: 2.6.6
rails-version: 52
- ruby-version: 2.6.6
- ruby-version: 2.6.10
rails-version: 60
- ruby-version: 2.6.6
- ruby-version: 2.6.10
rails-version: 61
- ruby-version: 2.7.5
- ruby-version: 2.7.8
rails-version: 61
- ruby-version: 2.7.5
- ruby-version: 2.7.8
rails-version: 70
- ruby-version: 3.2.2
rails-version: 71

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails-version }}.gemfile
Expand Down Expand Up @@ -55,4 +53,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bundle exec appraisal rails_${{ matrix.rails-version }} rake test
echo BUNDLE_GEMFILE=$BUNDLE_GEMFILE
bundle exec rake test
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ inherit_from:
AllCops:
TargetRubyVersion: 2.6
TargetRailsVersion: 5.2

Rails/I18nLocaleAssignment: { Enabled: false } # TODO: enable?
12 changes: 8 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# frozen_string_literal: true

appraise 'rails_52' do
gem 'activesupport', '~> 5.2.0'
gem 'activesupport', '~>5.2.8'
end

appraise 'rails_60' do
gem 'activesupport', '~>6.0.4.4'
gem 'activesupport', '~>6.0.6'
end

appraise 'rails_61' do
gem 'activesupport', '~>6.1.4.4'
gem 'activesupport', '~>6.1.7'
end

appraise 'rails_70' do
gem 'activesupport', '~>7.0.0'
gem 'activesupport', '~>7.0.8'
end

appraise 'rails_71' do
gem 'activesupport', '~>7.1.1'
end
41 changes: 23 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ source 'https://rubygems.org'

gemspec

gem 'actionpack'
gem 'activerecord'
gem 'activesupport'
gem 'i18n', '>= 0.8.5'
gem 'mocha'
gem 'pg', '~> 1.1'
gem 'rake'
gem 'test-unit-activesupport'
# gem 'actionpack'
# gem 'activerecord'
# gem 'activesupport'
# gem 'i18n', '>= 0.8.5'

gem 'appraisal'
gem 'pry'
gem 'pry-byebug'
# gem 'mocha'
# gem 'pg', '~> 1.1'
# gem 'rake'
# gem 'test-unit-activesupport'

gem 'rubocop', '0.81.0'
gem 'rubocop-rails', '2.5.2'
gem 'rubocop-rspec', '1.38.1'
gem 'rubocop-performance', '1.5.2'
unless defined?(Appraisal)
group :lint do
gem 'rubocop'
gem 'rubocop-rails'
gem 'rubocop-rspec'
gem 'rubocop-performance'

gem 'pronto', '>= 0.11', require: false
gem 'pronto-brakeman', require: false
gem 'pronto-rubocop', require: false
gem 'pronto', '>= 0.11', require: false
gem 'pronto-brakeman', require: false
gem 'pronto-rubocop', require: false
end

gem 'appraisal'
gem 'pry'
gem 'pry-byebug'
end
19 changes: 1 addition & 18 deletions gemfiles/rails_52.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@

source "https://rubygems.org"

gem "actionpack"
gem "activerecord"
gem "activesupport", "~> 5.2.0"
gem "i18n", ">= 0.8.5"
gem "mocha"
gem "pg", "~> 1.1"
gem "rake"
gem "test-unit-activesupport"
gem "appraisal"
gem "pry"
gem "pry-byebug"
gem "rubocop", "0.81.0"
gem "rubocop-rails", "2.5.2"
gem "rubocop-rspec", "1.38.1"
gem "rubocop-performance", "1.5.2"
gem "pronto", ">= 0.11", require: false
gem "pronto-brakeman", require: false
gem "pronto-rubocop", require: false
gem "activesupport", "~>5.2.8"

gemspec path: "../"
19 changes: 1 addition & 18 deletions gemfiles/rails_60.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@

source "https://rubygems.org"

gem "actionpack"
gem "activerecord"
gem "activesupport", "~>6.0.4.4"
gem "i18n", ">= 0.8.5"
gem "mocha"
gem "pg", "~> 1.1"
gem "rake"
gem "test-unit-activesupport"
gem "appraisal"
gem "pry"
gem "pry-byebug"
gem "rubocop", "0.81.0"
gem "rubocop-rails", "2.5.2"
gem "rubocop-rspec", "1.38.1"
gem "rubocop-performance", "1.5.2"
gem "pronto", ">= 0.11", require: false
gem "pronto-brakeman", require: false
gem "pronto-rubocop", require: false
gem "activesupport", "~>6.0.6"

gemspec path: "../"
19 changes: 1 addition & 18 deletions gemfiles/rails_61.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@

source "https://rubygems.org"

gem "actionpack"
gem "activerecord"
gem "activesupport", "~>6.1.4.4"
gem "i18n", ">= 0.8.5"
gem "mocha"
gem "pg", "~> 1.1"
gem "rake"
gem "test-unit-activesupport"
gem "appraisal"
gem "pry"
gem "pry-byebug"
gem "rubocop", "0.81.0"
gem "rubocop-rails", "2.5.2"
gem "rubocop-rspec", "1.38.1"
gem "rubocop-performance", "1.5.2"
gem "pronto", ">= 0.11", require: false
gem "pronto-brakeman", require: false
gem "pronto-rubocop", require: false
gem "activesupport", "~>6.1.7"

gemspec path: "../"
19 changes: 1 addition & 18 deletions gemfiles/rails_70.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@

source "https://rubygems.org"

gem "actionpack"
gem "activerecord"
gem "activesupport", "~>7.0.0"
gem "i18n", ">= 0.8.5"
gem "mocha"
gem "pg", "~> 1.1"
gem "rake"
gem "test-unit-activesupport"
gem "appraisal"
gem "pry"
gem "pry-byebug"
gem "rubocop", "0.81.0"
gem "rubocop-rails", "2.5.2"
gem "rubocop-rspec", "1.38.1"
gem "rubocop-performance", "1.5.2"
gem "pronto", ">= 0.11", require: false
gem "pronto-brakeman", require: false
gem "pronto-rubocop", require: false
gem "activesupport", "~>7.0.8"

gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/rails_71.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activesupport", "~>7.1.1"

gemspec path: "../"
8 changes: 5 additions & 3 deletions globalize.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.platform = Gem::Platform::RUBY

s.add_dependency('actionpack', ['>= 4.0', '< 7.1'])
s.add_dependency('activerecord', ['>= 4.0', '< 7.1'])
s.add_dependency('activesupport', ['>= 4.0', '< 7.1'])
s.metadata['rubygems_mfa_required'] = 'true'

s.add_dependency('actionpack', ['>= 4.0', '< 7.2'])
s.add_dependency('activerecord', ['>= 4.0', '< 7.2'])
s.add_dependency('activesupport', ['>= 4.0', '< 7.2'])
s.add_dependency('i18n', '>= 0.8.5')

s.add_development_dependency('mocha')
Expand Down
2 changes: 1 addition & 1 deletion lib/globalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

require 'rails_edge_load_path_patch.rb' unless I18n.respond_to?(:load_path)

ActiveRecord::Base.send :include, Globalize::Model::ActiveRecord::Translated
ActiveSupport.on_load(:active_record) { include Globalize::Model::ActiveRecord::Translated }

I18n.backend = Globalize::Backend::Static.new

Expand Down
25 changes: 13 additions & 12 deletions lib/globalize/backend/pluralizing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ def pluralizer(locale)
end

protected
def default_pluralizer
pluralizers[:en]
end

def pluralizers
@pluralizers ||= { :en => lambda{|n| n == 1 ? :one : :other } }
end

# Overwrite this method to return something other than a String
def translation(string, attributes)
string
end

def default_pluralizer
pluralizers[:en]
end

def pluralizers
@pluralizers ||= { en: ->(num) { num == 1 ? :one : :other } }
end

# Overwrite this method to return something other than a String
def translation(string, _attributes)
string
end
end
end
end
2 changes: 1 addition & 1 deletion lib/globalize/i18n/missing_translations_log_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def missing_translations_logger=(logger)
@@missing_translations_logger = logger
end

def missing_translations_log_handler(exception, locale, key, options)
def missing_translations_log_handler(exception, _locale, _key, _options)
if MissingTranslationData === exception
missing_translations_logger.warn(exception.message)
return exception.message
Expand Down
2 changes: 1 addition & 1 deletion lib/globalize/i18n/missing_translations_raise_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# I18n.exception_handler = :missing_translations_raise_handler
module I18n
class << self
def missing_translations_raise_handler(exception, locale, key, options)
def missing_translations_raise_handler(exception, _locale, _key, _options)
raise exception
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/globalize/locale/language_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def parent
def parents(include_self = true)
result, parent = [], self.dup
result << parent if include_self
while parent = parent.parent
while (parent = parent.parent)
result << parent
end
result
Expand Down
2 changes: 1 addition & 1 deletion lib/globalize/model/active_record/uniqueness.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def find_finder_class_for(record) #:nodoc:
class_hierarchy.detect { |klass| !klass.abstract_class? }
end

def build_relation(klass, table, attribute, value) #:nodoc:
def build_relation(klass, _table, attribute, value) # :nodoc:
sql_attribute = klass.translation_coalesce(attribute)
Arel::Nodes::Equality.new(Arel::Nodes::SqlLiteral.new(sql_attribute), Arel::Nodes.build_quoted(value))
end
Expand Down
Loading

0 comments on commit 8e13212

Please sign in to comment.