[DRE-commits] [ruby-gettext-i18n-rails] 01/05: Imported Upstream version 1.5.0
Sebastien Badia
sbadia-guest at moszumanska.debian.org
Fri Mar 4 20:09:02 UTC 2016
This is an automated email from the git hooks/post-receive script.
sbadia-guest pushed a commit to branch update
in repository ruby-gettext-i18n-rails.
commit c9afbbde4ed1e6f0edee350e564ba207ccd43377
Author: Sebastien Badia <seb at sebian.fr>
Date: Fri Mar 4 16:09:47 2016 -0300
Imported Upstream version 1.5.0
---
.travis.yml | 12 +-
Gemfile.lock | 4 +-
Readme.md | 8 +-
gemfiles/rails42.gemfile | 5 +
gemfiles/rails42.gemfile.lock | 153 +++++++++++++++
gemfiles/rails50.gemfile | 5 +
gemfiles/rails50.gemfile.lock | 206 +++++++++++++++++++++
lib/gettext_i18n_rails/active_model/translation.rb | 10 +-
lib/gettext_i18n_rails/model_attributes_finder.rb | 19 +-
lib/gettext_i18n_rails/railtie.rb | 1 +
lib/gettext_i18n_rails/tasks.rb | 6 +
lib/gettext_i18n_rails/version.rb | 2 +-
.../model_attributes_finder_spec.rb | 2 +-
13 files changed, 416 insertions(+), 17 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 0505694..32ef042 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,12 +9,16 @@ gemfile:
- gemfiles/rails32.gemfile
- gemfiles/rails40.gemfile
- gemfiles/rails41.gemfile
+ - gemfiles/rails42.gemfile
+ - gemfiles/rails50.gemfile
matrix:
exclude:
- - rvm: 2.0
- gemfile: gemfiles/rails23.gemfile
- - rvm: 2.1.2
- gemfile: gemfiles/rails23.gemfile
+ - rvm: 1.9.3
+ gemfile: gemfiles/rails50.gemfile
+ - rvm: 2.0.0
+ gemfile: gemfiles/rails50.gemfile
+ - rvm: 2.1.7
+ gemfile: gemfiles/rails50.gemfile
rvm:
- 1.9.3
- 2.0.0
diff --git a/Gemfile.lock b/Gemfile.lock
index 0a7da0f..187609e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- gettext_i18n_rails (1.3.1)
+ gettext_i18n_rails (1.5.0)
fast_gettext (>= 0.9.0)
GEM
@@ -145,4 +145,4 @@ DEPENDENCIES
wwtd
BUNDLED WITH
- 1.10.6
+ 1.11.2
diff --git a/Readme.md b/Readme.md
index 63982c8..48a6231 100644
--- a/Readme.md
+++ b/Readme.md
@@ -243,6 +243,7 @@ namespace :gettext do
task.files = files
task.enable_description = false
task.msgmerge_options = gettext_msgmerge_options
+ task.msgcat_options = gettext_msgcat_options
task.xgettext_options = gettext_xgettext_options
end
end
@@ -250,8 +251,8 @@ namespace :gettext do
end
```
-Changing msgmerge and xgettext options
-======================================
+Changing msgmerge, msgcat, and xgettext options
+===============================================
The default options for parsing and create `.po` files are:
@@ -265,6 +266,7 @@ If you want to override them you can put the following into an initializer like
```Ruby
Rails.application.config.gettext_i18n_rails.msgmerge = %w[--no-location]
+Rails.application.config.gettext_i18n_rails.msgcat = %w[--no-location]
Rails.application.config.gettext_i18n_rails.xgettext = %w[--no-location]
```
@@ -276,7 +278,7 @@ Rails.application.config.gettext_i18n_rails.default_options = %w[--no-location]
to override both.
-You can see the available options by running `rgettext -h` and `rxgettext -h`.
+You can see the available options by running `rgettext -h`, `rmsgcat -f` and `rxgettext -h`.
Using your translations from javascript
=======================================
diff --git a/gemfiles/rails42.gemfile b/gemfiles/rails42.gemfile
new file mode 100644
index 0000000..fe347f7
--- /dev/null
+++ b/gemfiles/rails42.gemfile
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gemspec :path => "../"
+
+gem "rails", "~> 4.2.0"
diff --git a/gemfiles/rails42.gemfile.lock b/gemfiles/rails42.gemfile.lock
new file mode 100644
index 0000000..c41ca98
--- /dev/null
+++ b/gemfiles/rails42.gemfile.lock
@@ -0,0 +1,153 @@
+PATH
+ remote: ../
+ specs:
+ gettext_i18n_rails (1.3.2)
+ fast_gettext (>= 0.9.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.2.5)
+ actionpack (= 4.2.5)
+ actionview (= 4.2.5)
+ activejob (= 4.2.5)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.5)
+ actionview (= 4.2.5)
+ activesupport (= 4.2.5)
+ rack (~> 1.6)
+ rack-test (~> 0.6.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.5)
+ activesupport (= 4.2.5)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.5)
+ activesupport (= 4.2.5)
+ globalid (>= 0.3.0)
+ activemodel (4.2.5)
+ activesupport (= 4.2.5)
+ builder (~> 3.1)
+ activerecord (4.2.5)
+ activemodel (= 4.2.5)
+ activesupport (= 4.2.5)
+ arel (~> 6.0)
+ activesupport (4.2.5)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ arel (6.0.3)
+ builder (3.2.2)
+ bump (0.5.3)
+ concurrent-ruby (1.0.0)
+ diff-lcs (1.2.5)
+ erubis (2.7.0)
+ fast_gettext (1.0.0)
+ gettext (3.2.0)
+ locale (>= 2.0.5)
+ text (>= 1.3.0)
+ globalid (0.3.6)
+ activesupport (>= 4.1.0)
+ haml (4.0.7)
+ tilt
+ i18n (0.7.0)
+ json (1.8.3)
+ locale (2.1.2)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
+ mail (2.6.3)
+ mime-types (>= 1.16, < 3)
+ mime-types (2.99)
+ mini_portile2 (2.0.0)
+ minitest (5.8.3)
+ nokogiri (1.6.7.1)
+ mini_portile2 (~> 2.0.0.rc2)
+ rack (1.6.4)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (4.2.5)
+ actionmailer (= 4.2.5)
+ actionpack (= 4.2.5)
+ actionview (= 4.2.5)
+ activejob (= 4.2.5)
+ activemodel (= 4.2.5)
+ activerecord (= 4.2.5)
+ activesupport (= 4.2.5)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.2.5)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.7)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.2)
+ loofah (~> 2.0)
+ railties (4.2.5)
+ actionpack (= 4.2.5)
+ activesupport (= 4.2.5)
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (10.5.0)
+ rspec (3.4.0)
+ rspec-core (~> 3.4.0)
+ rspec-expectations (~> 3.4.0)
+ rspec-mocks (~> 3.4.0)
+ rspec-core (3.4.1)
+ rspec-support (~> 3.4.0)
+ rspec-expectations (3.4.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.4.0)
+ rspec-mocks (3.4.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.4.0)
+ rspec-support (3.4.1)
+ ruby_parser (3.7.2)
+ sexp_processor (~> 4.1)
+ sexp_processor (4.6.0)
+ slim (3.0.6)
+ temple (~> 0.7.3)
+ tilt (>= 1.3.3, < 2.1)
+ sprockets (3.5.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.0.0)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.3.11)
+ temple (0.7.6)
+ text (1.3.1)
+ thor (0.19.1)
+ thread_safe (0.3.5)
+ tilt (2.0.2)
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ wwtd (1.3.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bump
+ gettext (>= 3.0.2)
+ gettext_i18n_rails!
+ haml
+ rails (~> 4.2.0)
+ rake
+ rspec
+ ruby_parser (>= 3.7.1)
+ sexp_processor
+ slim
+ sqlite3
+ wwtd
+
+BUNDLED WITH
+ 1.11.2
diff --git a/gemfiles/rails50.gemfile b/gemfiles/rails50.gemfile
new file mode 100644
index 0000000..0a6f591
--- /dev/null
+++ b/gemfiles/rails50.gemfile
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gemspec :path => "../"
+
+gem "rails", "~> 5.0.0.beta1"
diff --git a/gemfiles/rails50.gemfile.lock b/gemfiles/rails50.gemfile.lock
new file mode 100644
index 0000000..16fa60f
--- /dev/null
+++ b/gemfiles/rails50.gemfile.lock
@@ -0,0 +1,206 @@
+PATH
+ remote: ../
+ specs:
+ gettext_i18n_rails (1.3.2)
+ fast_gettext (>= 0.9.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (5.0.0.beta1)
+ actionpack (= 5.0.0.beta1)
+ celluloid (~> 0.17.2)
+ coffee-rails (~> 4.1.0)
+ em-hiredis (~> 0.3.0)
+ faye-websocket (~> 0.10.0)
+ redis (~> 3.0)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.0.0.beta1)
+ actionpack (= 5.0.0.beta1)
+ actionview (= 5.0.0.beta1)
+ activejob (= 5.0.0.beta1)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (5.0.0.beta1)
+ actionview (= 5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ rack (~> 2.x)
+ rack-test (~> 0.6.3)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ globalid (>= 0.3.6)
+ activemodel (5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ builder (~> 3.1)
+ activerecord (5.0.0.beta1)
+ activemodel (= 5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ arel (~> 7.0)
+ activesupport (5.0.0.beta1)
+ concurrent-ruby (~> 1.0)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ method_source
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ arel (7.0.0)
+ builder (3.2.2)
+ bump (0.5.3)
+ celluloid (0.17.2)
+ celluloid-essentials
+ celluloid-extras
+ celluloid-fsm
+ celluloid-pool
+ celluloid-supervision
+ timers (>= 4.1.1)
+ celluloid-essentials (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-extras (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-fsm (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-pool (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-supervision (0.20.5)
+ timers (>= 4.1.1)
+ coffee-rails (4.1.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.1.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.10.0)
+ concurrent-ruby (1.0.0)
+ diff-lcs (1.2.5)
+ em-hiredis (0.3.0)
+ eventmachine (~> 1.0)
+ hiredis (~> 0.5.0)
+ erubis (2.7.0)
+ eventmachine (1.0.9.1)
+ execjs (2.6.0)
+ fast_gettext (1.0.0)
+ faye-websocket (0.10.2)
+ eventmachine (>= 0.12.0)
+ websocket-driver (>= 0.5.1)
+ gettext (3.2.0)
+ locale (>= 2.0.5)
+ text (>= 1.3.0)
+ globalid (0.3.6)
+ activesupport (>= 4.1.0)
+ haml (4.0.7)
+ tilt
+ hiredis (0.5.2)
+ hitimes (1.2.3)
+ i18n (0.7.0)
+ json (1.8.3)
+ locale (2.1.2)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
+ mail (2.6.3)
+ mime-types (>= 1.16, < 3)
+ method_source (0.8.2)
+ mime-types (2.99)
+ mini_portile2 (2.0.0)
+ minitest (5.8.3)
+ nokogiri (1.6.7.1)
+ mini_portile2 (~> 2.0.0.rc2)
+ rack (2.0.0.alpha)
+ json
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (5.0.0.beta1)
+ actioncable (= 5.0.0.beta1)
+ actionmailer (= 5.0.0.beta1)
+ actionpack (= 5.0.0.beta1)
+ actionview (= 5.0.0.beta1)
+ activejob (= 5.0.0.beta1)
+ activemodel (= 5.0.0.beta1)
+ activerecord (= 5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 5.0.0.beta1)
+ sprockets-rails (>= 2.0.0)
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.7)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.2)
+ loofah (~> 2.0)
+ railties (5.0.0.beta1)
+ actionpack (= 5.0.0.beta1)
+ activesupport (= 5.0.0.beta1)
+ method_source
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (10.5.0)
+ redis (3.2.2)
+ rspec (3.4.0)
+ rspec-core (~> 3.4.0)
+ rspec-expectations (~> 3.4.0)
+ rspec-mocks (~> 3.4.0)
+ rspec-core (3.4.1)
+ rspec-support (~> 3.4.0)
+ rspec-expectations (3.4.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.4.0)
+ rspec-mocks (3.4.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.4.0)
+ rspec-support (3.4.1)
+ ruby_parser (3.7.2)
+ sexp_processor (~> 4.1)
+ sexp_processor (4.6.0)
+ slim (3.0.6)
+ temple (~> 0.7.3)
+ tilt (>= 1.3.3, < 2.1)
+ sprockets (3.5.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.0.0)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.3.11)
+ temple (0.7.6)
+ text (1.3.1)
+ thor (0.19.1)
+ thread_safe (0.3.5)
+ tilt (2.0.2)
+ timers (4.1.1)
+ hitimes
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ websocket-driver (0.6.3)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.2)
+ wwtd (1.3.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bump
+ gettext (>= 3.0.2)
+ gettext_i18n_rails!
+ haml
+ rails (~> 5.0.0.beta1)
+ rake
+ rspec
+ ruby_parser (>= 3.7.1)
+ sexp_processor
+ slim
+ sqlite3
+ wwtd
+
+BUNDLED WITH
+ 1.11.2
diff --git a/lib/gettext_i18n_rails/active_model/translation.rb b/lib/gettext_i18n_rails/active_model/translation.rb
index bdd4673..08704f3 100644
--- a/lib/gettext_i18n_rails/active_model/translation.rb
+++ b/lib/gettext_i18n_rails/active_model/translation.rb
@@ -17,7 +17,15 @@ module ActiveModel
def inheritance_tree_root(aclass)
return aclass unless aclass.respond_to?(:base_class)
base = aclass.base_class
- base.superclass.abstract_class? ? base.superclass : base
+ if base.superclass.abstract_class?
+ if defined?(::ApplicationRecord) && base.superclass == ApplicationRecord
+ base
+ else
+ base.superclass
+ end
+ else
+ base
+ end
end
def humanize_class_name(name=nil)
diff --git a/lib/gettext_i18n_rails/model_attributes_finder.rb b/lib/gettext_i18n_rails/model_attributes_finder.rb
index 3f3474c..f45f08e 100644
--- a/lib/gettext_i18n_rails/model_attributes_finder.rb
+++ b/lib/gettext_i18n_rails/model_attributes_finder.rb
@@ -42,15 +42,16 @@ module GettextI18nRails
end
def initialize
- @existing_tables = ActiveRecord::Base.connection.tables
+ connection = ::ActiveRecord::Base.connection
+ @existing_tables = (Rails::VERSION::MAJOR >= 5 ? connection.data_sources : connection.tables)
end
- # Rails < 3.0 doesn't have DescendantsTracker.
+ # Rails < 3.0 doesn't have DescendantsTracker.
# Instead of iterating over ObjectSpace (slow) the decision was made NOT to support
# class hierarchies with abstract base classes in Rails 2.x
def model_attributes(model, ignored_tables, ignored_cols)
return [] if model.abstract_class? && Rails::VERSION::MAJOR < 3
-
+
if model.abstract_class?
model.direct_descendants.reject {|m| ignored?(m.table_name, ignored_tables)}.inject([]) do |attrs, m|
attrs.push(model_attributes(m, ignored_tables, ignored_cols)).flatten.uniq
@@ -63,9 +64,17 @@ module GettextI18nRails
end
def models
- if Rails::VERSION::MAJOR > 2
+ if Rails::VERSION::MAJOR >= 3
Rails.application.eager_load! # make sure that all models are loaded so that direct_descendants works
- ::ActiveRecord::Base.direct_descendants
+ descendants = ::ActiveRecord::Base.direct_descendants
+
+ # In rails 5+ user models are supposed to inherit from ApplicationRecord
+ if defined?(::ApplicationRecord)
+ descendants += ApplicationRecord.direct_descendants
+ descendants.delete ApplicationRecord
+ end
+
+ descendants
else
::ActiveRecord::Base.connection.tables \
.map { |t| table_name_to_namespaced_model(t) } \
diff --git a/lib/gettext_i18n_rails/railtie.rb b/lib/gettext_i18n_rails/railtie.rb
index 88f7510..1a238de 100644
--- a/lib/gettext_i18n_rails/railtie.rb
+++ b/lib/gettext_i18n_rails/railtie.rb
@@ -2,6 +2,7 @@ module GettextI18nRails
class Railtie < ::Rails::Railtie
config.gettext_i18n_rails = ActiveSupport::OrderedOptions.new
config.gettext_i18n_rails.msgmerge = nil
+ config.gettext_i18n_rails.msgcat = nil
config.gettext_i18n_rails.xgettext = nil
config.gettext_i18n_rails.use_for_active_record_attributes = true
diff --git a/lib/gettext_i18n_rails/tasks.rb b/lib/gettext_i18n_rails/tasks.rb
index 7030366..d28386f 100644
--- a/lib/gettext_i18n_rails/tasks.rb
+++ b/lib/gettext_i18n_rails/tasks.rb
@@ -27,6 +27,11 @@ namespace :gettext do
config || gettext_default_options
end
+ def gettext_msgcat_options
+ config = (Rails.application.config.gettext_i18n_rails.msgcat if defined?(Rails.application))
+ config || gettext_default_options
+ end
+
def gettext_xgettext_options
config = (Rails.application.config.gettext_i18n_rails.xgettext if defined?(Rails.application))
config || gettext_default_options
@@ -45,6 +50,7 @@ namespace :gettext do
task.files = files_to_translate
task.enable_description = false
task.msgmerge_options = gettext_msgmerge_options
+ task.msgcat_options = gettext_msgcat_options
task.xgettext_options = gettext_xgettext_options
end
end
diff --git a/lib/gettext_i18n_rails/version.rb b/lib/gettext_i18n_rails/version.rb
index 10bf3b6..fc86353 100644
--- a/lib/gettext_i18n_rails/version.rb
+++ b/lib/gettext_i18n_rails/version.rb
@@ -1,3 +1,3 @@
module GettextI18nRails
- Version = VERSION = '1.3.1'
+ Version = VERSION = '1.5.0'
end
diff --git a/spec/gettext_i18n_rails/model_attributes_finder_spec.rb b/spec/gettext_i18n_rails/model_attributes_finder_spec.rb
index 9752a98..7bd7554 100644
--- a/spec/gettext_i18n_rails/model_attributes_finder_spec.rb
+++ b/spec/gettext_i18n_rails/model_attributes_finder_spec.rb
@@ -19,7 +19,7 @@ describe GettextI18nRails::ModelAttributesFinder do
# Rails < 3.0 doesn't have DescendantsTracker.
# Instead of iterating over ObjectSpace (slow) the decision was made NOT to support
# class hierarchies with abstract base classes in Rails 2.x
- describe :find do
+ describe "#find" do
it "returns all AR models" do
keys = finder.find({}).keys
expected = [CarSeat, Part, StiParent]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-gettext-i18n-rails.git
More information about the Pkg-ruby-extras-commits
mailing list