Skip to content

Commit

Permalink
Merge pull request #201 from Locale/feature/drop-i18n_0.3-support
Browse files Browse the repository at this point in the history
Drop support for i18n 0.3 and rails 2
  • Loading branch information
michaelbaudino committed Aug 23, 2016
2 parents 5000c22 + 586430f commit 0ec6df5
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 77 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# master

* Drop i18n 0.3.x and rails 2.x support
* Remove rack dependency

# Version 1.0.2
Expand Down
13 changes: 2 additions & 11 deletions README.md
Expand Up @@ -29,17 +29,8 @@ This will check everything looks good and create `config/initializers/localeapp.

### Rails 2.3

Define localeapp in `config/environment.rb`:

config.gem 'localeapp'

Install the gem:

rake gems:install

Create a project on localeapp.com and get the api key. Then run:

localeapp install <YOUR_API_KEY>
Rails 2.3 support has been discontinued after 1.0.2. Please use this
version at your own risk if you really want to.

### Non rails projects

Expand Down
25 changes: 2 additions & 23 deletions lib/localeapp.rb
@@ -1,26 +1,5 @@
# AUDIT: Find a better way of doing this
begin
require 'i18n'
rescue LoadError
# we're in 2.3 and we need to load rails to get the vendored i18n
require 'thread' # for rubygems > 1.6.0 support
require 'active_support'
# This ugliness so we can load AS in the travis env
@loaded_active_support = true
end

begin
require 'i18n/core_ext/hash'
rescue LoadError
# This ugliness so we can load AS in the travis env
# Assume that we're in rails 2.3 and AS supplies deep_merge
# Load AS if we need to
unless @loaded_active_support
# we're in 2.3 and we need to load rails to get the vendored i18n
require 'thread' # for rubygems > 1.6.0 support
require 'active_support'
end
end
require 'i18n'
require 'i18n/core_ext/hash'

require 'localeapp/i18n_shim'
require 'localeapp/version'
Expand Down
2 changes: 1 addition & 1 deletion lib/localeapp/cli/install.rb
Expand Up @@ -65,7 +65,7 @@ def check_default_locale
localeapp_default_code = project_data['default_locale']['code']
@output.puts "Default Locale: #{localeapp_default_code} (#{project_data['default_locale']['name']})"
if I18n.default_locale.to_s != localeapp_default_code
@output.puts "WARNING: I18n.default_locale is #{I18n.default_locale}, change in config/environment.rb (Rails 2) or config/application.rb (Rails 3)"
@output.puts "WARNING: I18n.default_locale is #{I18n.default_locale}, change in config/application.rb (Rails 3+)"
end
end

Expand Down
4 changes: 0 additions & 4 deletions lib/localeapp/rails.rb
Expand Up @@ -6,10 +6,6 @@ def self.initialize

ActionController::Base.send(:include, Localeapp::Rails::Controller)

if rails_version_matches? '~> 2.3' # TODO: Check previous rails versions if required
require 'localeapp/rails/2_3_translation_helper_monkeypatch'
end

# match all versions between https://github.com/rails/rails/commit/d57ce232a885b21e1d6d1f9fbf60bc5908ad880d and https://github.com/rails/rails/commit/4dbce79e95e3f56a9b48992dea4531493a5008cc on all branches
if rails_version_matches_all?('~> 4.0.10.rc1') |
rails_version_matches_all?('~> 4.1.0.rc1', '< 4.1.10.rc1') |
Expand Down
36 changes: 0 additions & 36 deletions lib/localeapp/rails/2_3_translation_helper_monkeypatch.rb

This file was deleted.

2 changes: 1 addition & 1 deletion localeapp.gemspec
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_dependency('mime-types', '~> 2.6')
s.add_dependency('i18n')
s.add_dependency('i18n', '~> 0.4')
s.add_dependency('json', '~> 1.8')
s.add_dependency('rest-client', '~> 1.8')
s.add_dependency('ya2yaml')
Expand Down
2 changes: 1 addition & 1 deletion spec/localeapp/cli/install_spec.rb
Expand Up @@ -127,7 +127,7 @@
allow(I18n).to receive(:default_locale).and_return(:es)
installer.check_default_locale
expect(output.string)
.to match(%r{WARNING: I18n\.default_locale is es, change in config/environment\.rb \(Rails 2\) or config/application\.rb \(Rails 3\)})
.to match(%r{WARNING: I18n\.default_locale is es, change in config/application\.rb \(Rails 3\+\)})
end
end

Expand Down

0 comments on commit 0ec6df5

Please sign in to comment.