localeapp 0.6.14 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +14 -2
- data/CHANGELOG.md +7 -0
- data/Gemfile.i18n_037 +5 -1
- data/bin/localeapp +1 -1
- data/lib/localeapp/api_caller.rb +2 -0
- data/lib/localeapp/rails/force_exception_handler_in_translation_helper.rb +23 -0
- data/lib/localeapp/rails/mimic_rails_missing_translation_display.rb +24 -0
- data/lib/localeapp/rails.rb +8 -0
- data/lib/localeapp/version.rb +1 -1
- data/localeapp.gemspec +5 -5
- data/spec/localeapp/api_caller_spec.rb +14 -7
- data/spec/localeapp/cli/add_spec.rb +2 -2
- data/spec/localeapp/cli/daemon_spec.rb +1 -1
- data/spec/localeapp/cli/install_spec.rb +22 -22
- data/spec/localeapp/cli/pull_spec.rb +2 -2
- data/spec/localeapp/cli/push_spec.rb +3 -3
- data/spec/localeapp/default_value_handler_spec.rb +1 -1
- data/spec/localeapp/poller_spec.rb +2 -2
- data/spec/localeapp/rails/controller_spec.rb +6 -5
- metadata +162 -225
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 185a91f911bbe92f9de552cda40d8966c5fe35f2
|
4
|
+
data.tar.gz: 334574858b89efda5619a82ef6dc33e3afcc0181
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bc8cd5424cb62111a36cfc5cb550632551c5e614bd3535a3c4f48021d97bd917e80c7bb08e762384853426c555afc8f737423638b4154f188b920a9856e8a5b5
|
7
|
+
data.tar.gz: feadfc9fb3da6d9fa4f34c841fcbf3e1b9031627d3e9b050b5346f6d4451fa73c15edb68147ce5036b5503e84520f5baba467bee92a286f40208ee5a916b53f2
|
data/.travis.yml
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
rvm:
|
2
|
-
- 1.8.7
|
3
2
|
- 1.9.2
|
4
3
|
- 1.9.3
|
5
|
-
-
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.0
|
6
6
|
- jruby-19mode
|
7
|
+
- jruby-20mode
|
8
|
+
- jruby-21mode
|
7
9
|
gemfile:
|
8
10
|
- Gemfile.i18n_037
|
9
11
|
- Gemfile.i18n_050
|
10
12
|
- Gemfile.i18n_060
|
13
|
+
matrix:
|
14
|
+
exclude:
|
15
|
+
- rvm: 2.0.0
|
16
|
+
gemfile: Gemfile.i18n_037
|
17
|
+
- rvm: 2.1.0
|
18
|
+
gemfile: Gemfile.i18n_037
|
19
|
+
- rvm: jruby-20mode
|
20
|
+
gemfile: Gemfile.i18n_037
|
21
|
+
- rvm: jruby-21mode
|
22
|
+
gemfile: Gemfile.i18n_037
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
# Version 0.7.0
|
4
|
+
|
5
|
+
* Drop support for Ruby 1.8 (both MRI and JRuby)
|
6
|
+
* Add support for Ruby 2.0 and 2.1 (both MRI and JRuby)
|
7
|
+
* Mimic new Rails `translate` helper behaviour, which is to wrap missing translations messages in <span> elements
|
8
|
+
* Fix missing translations sending with Rails >= 3.2.16 and >= 4.0.2
|
9
|
+
|
3
10
|
# Version 0.6.14
|
4
11
|
|
5
12
|
* Fix a bug where the last poll and last refresh date could be nil
|
data/Gemfile.i18n_037
CHANGED
data/bin/localeapp
CHANGED
@@ -57,7 +57,7 @@ command :install do |c|
|
|
57
57
|
c.desc "create configuration when using localeapp via a heroku addon (PRE ALPHA)"
|
58
58
|
c.switch [:h, 'heroku']
|
59
59
|
|
60
|
-
c.desc "install a skeleton project suitable for Github"
|
60
|
+
c.desc "install a skeleton project suitable for Github (warning: README.md will be overwritten)"
|
61
61
|
c.switch [:g, 'github']
|
62
62
|
|
63
63
|
c.action do |global_options, options, args|
|
data/lib/localeapp/api_caller.rb
CHANGED
@@ -72,6 +72,8 @@ module Localeapp
|
|
72
72
|
RestClient::ServiceUnavailable,
|
73
73
|
RestClient::GatewayTimeout => error
|
74
74
|
return error.response
|
75
|
+
rescue RestClient::ServerBrokeConnection => error
|
76
|
+
return NonHTTPResponse.new(-1)
|
75
77
|
rescue Errno::ECONNREFUSED => error
|
76
78
|
Localeapp.debug("ERROR: Connection Refused")
|
77
79
|
return NonHTTPResponse.new(-1)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Rails 3.2.16 and 4.0.2 introduced a fix for CVE-2013-4491 :
|
2
|
+
# https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a
|
3
|
+
#
|
4
|
+
# This fix introduces a :raise option to the :translate helper, which
|
5
|
+
# defines wether an exception shall be raised (:raise => true) or delegated
|
6
|
+
# to I18n.exception_handler (:raise => false).
|
7
|
+
#
|
8
|
+
# This monkey patch forces :raise to `false`, to force use of Localeapp::ExceptionHandler
|
9
|
+
#
|
10
|
+
# NB: the CVE-2013-4491 fix also introduced a regression which is fixed in:
|
11
|
+
# https://github.com/rails/rails/commit/31a485fa5a843a766c4b889ee88a6c590a3a6ebb
|
12
|
+
|
13
|
+
|
14
|
+
module Localeapp
|
15
|
+
module ForceExceptionHandlerInTranslationHelper
|
16
|
+
def translate(key, options = {})
|
17
|
+
super(key, {:raise => false}.merge(options))
|
18
|
+
end
|
19
|
+
alias :t :translate
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
ActionView::Base.send(:include, ::Localeapp::ForceExceptionHandlerInTranslationHelper)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Rails 3.2.16 and 4.0.2 introduced a new way of displaying missing translation :
|
2
|
+
# they now wrap them in a <span> element with useful class and title
|
3
|
+
#
|
4
|
+
# https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a
|
5
|
+
|
6
|
+
module Localeapp
|
7
|
+
module MimicRailsMissingTranslationDisplay
|
8
|
+
|
9
|
+
def self.included(o)
|
10
|
+
o.instance_eval do
|
11
|
+
|
12
|
+
alias :old_rails_call :call
|
13
|
+
def call(exception, locale, key, options)
|
14
|
+
locale, key = old_rails_call(exception, locale, key, options).split(', ')
|
15
|
+
"<span class=\"translation_missing\" title=\"translation missing: #{key}\">#{locale}, #{key}</span>".html_safe
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Localeapp::ExceptionHandler.send(:include, ::Localeapp::MimicRailsMissingTranslationDisplay)
|
data/lib/localeapp/rails.rb
CHANGED
@@ -27,6 +27,14 @@ module Localeapp
|
|
27
27
|
require 'localeapp/rails/2_3_translation_helper_monkeypatch'
|
28
28
|
end
|
29
29
|
|
30
|
+
# Rails >= 4.0.2 || Rails >= 3.2.16
|
31
|
+
# ie: after CVE-2013-4491 patch (https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a)
|
32
|
+
if (::Rails::VERSION::MAJOR == 4 && (::Rails::VERSION::MINOR > 0 or (::Rails::VERSION::MINOR == 0 && ::Rails::VERSION::TINY >= 2))) or
|
33
|
+
(::Rails::VERSION::MAJOR == 3 && (::Rails::VERSION::MINOR > 2 or (::Rails::VERSION::MINOR == 2 && ::Rails::VERSION::TINY >= 16)))
|
34
|
+
require 'localeapp/rails/force_exception_handler_in_translation_helper'
|
35
|
+
require 'localeapp/rails/mimic_rails_missing_translation_display'
|
36
|
+
end
|
37
|
+
|
30
38
|
Localeapp.configure do |config|
|
31
39
|
config.logger = rails_logger
|
32
40
|
config.environment_name = rails_env
|
data/lib/localeapp/version.rb
CHANGED
data/localeapp.gemspec
CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_dependency('gli')
|
29
29
|
|
30
30
|
s.add_development_dependency('rake')
|
31
|
-
s.add_development_dependency('rspec'
|
32
|
-
s.add_development_dependency('yard'
|
33
|
-
s.add_development_dependency('RedCloth'
|
34
|
-
s.add_development_dependency('aruba'
|
35
|
-
s.add_development_dependency('fakeweb'
|
31
|
+
s.add_development_dependency('rspec')
|
32
|
+
s.add_development_dependency('yard')
|
33
|
+
s.add_development_dependency('RedCloth')
|
34
|
+
s.add_development_dependency('aruba')
|
35
|
+
s.add_development_dependency('fakeweb')
|
36
36
|
end
|
@@ -14,20 +14,20 @@ describe Localeapp::ApiCaller, "#call(object)" do
|
|
14
14
|
@api_caller = Localeapp::ApiCaller.new(:test)
|
15
15
|
end
|
16
16
|
@url = 'https://example.com/test'
|
17
|
-
@api_caller.stub
|
18
|
-
@api_caller.stub
|
17
|
+
@api_caller.stub(:test_endpoint).and_return([:get, @url])
|
18
|
+
@api_caller.stub(:sleep_if_retrying)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "gets the method and url for the endpoint" do
|
22
22
|
@api_caller.should_receive(:test_endpoint).with({}).and_return([:get, @url])
|
23
|
-
RestClient::Request.stub
|
23
|
+
RestClient::Request.stub(:execute).and_return(double('response', :code => 200))
|
24
24
|
@api_caller.call(self)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "passes through any url options" do
|
28
28
|
@api_caller.should_receive(:test_endpoint).with({:foo => :bar}).and_return([:get, @url])
|
29
29
|
@api_caller.options[:url_options] = { :foo => :bar }
|
30
|
-
RestClient::Request.stub
|
30
|
+
RestClient::Request.stub(:execute).and_return(double('response', :code => 200))
|
31
31
|
@api_caller.call(self)
|
32
32
|
end
|
33
33
|
|
@@ -43,7 +43,7 @@ describe Localeapp::ApiCaller, "#call(object)" do
|
|
43
43
|
|
44
44
|
it "sets the response encoding based on the response charset" do
|
45
45
|
response = "string"
|
46
|
-
response.stub
|
46
|
+
response.stub(:code).and_return(200)
|
47
47
|
response.force_encoding('US-ASCII')
|
48
48
|
response.stub_chain(:net_http_res, :type_params).and_return('charset' => 'utf-8')
|
49
49
|
RestClient::Request.stub(:execute).and_return(response)
|
@@ -54,7 +54,7 @@ describe Localeapp::ApiCaller, "#call(object)" do
|
|
54
54
|
|
55
55
|
context "Proxy" do
|
56
56
|
before do
|
57
|
-
RestClient::Request.stub
|
57
|
+
RestClient::Request.stub(:execute).and_return(double('response', :code => 200))
|
58
58
|
end
|
59
59
|
|
60
60
|
it "sets the proxy if configured" do
|
@@ -120,7 +120,7 @@ describe Localeapp::ApiCaller, "#call(object)" do
|
|
120
120
|
|
121
121
|
context " a POST request" do
|
122
122
|
before do
|
123
|
-
@api_caller.stub
|
123
|
+
@api_caller.stub(:test_endpoint).and_return([:post, @url])
|
124
124
|
@api_caller.options[:payload] = "test data"
|
125
125
|
end
|
126
126
|
|
@@ -229,6 +229,13 @@ describe Localeapp::ApiCaller, "#call(object)" do
|
|
229
229
|
@api_caller.call(@object)
|
230
230
|
end
|
231
231
|
|
232
|
+
it "handles RestClient::ServerBrokeConnection" do
|
233
|
+
RestClient::Request.stub(:execute).and_raise(RestClient::ServerBrokeConnection)
|
234
|
+
@api_caller.options[:failure] = :fail
|
235
|
+
@object.should_receive(:fail)
|
236
|
+
@api_caller.call(@object)
|
237
|
+
end
|
238
|
+
|
232
239
|
it "handles SocketError" do
|
233
240
|
RestClient::Request.stub(:execute).and_raise(SocketError)
|
234
241
|
@api_caller.options[:failure] = :fail
|
@@ -13,7 +13,7 @@ describe Localeapp::CLI::Add, "#execute(key, *translations)" do
|
|
13
13
|
|
14
14
|
it "adds the translations to missing_translations" do
|
15
15
|
with_configuration do
|
16
|
-
Localeapp.sender.stub
|
16
|
+
Localeapp.sender.stub(:post_missing_translations)
|
17
17
|
do_action
|
18
18
|
end
|
19
19
|
en_missing = Localeapp.missing_translations['en']
|
@@ -28,7 +28,7 @@ describe Localeapp::CLI::Add, "#execute(key, *translations)" do
|
|
28
28
|
|
29
29
|
it "ignores badly formed arguments" do
|
30
30
|
with_configuration do
|
31
|
-
Localeapp.sender.stub
|
31
|
+
Localeapp.sender.stub(:post_missing_translations)
|
32
32
|
do_action('test.key', ["en:this is fine", "esbad"])
|
33
33
|
end
|
34
34
|
Localeapp.missing_translations['en'].size.should == 1
|
@@ -30,7 +30,7 @@ describe Localeapp::CLI::Daemon, "#do_update" do
|
|
30
30
|
let(:command) { Localeapp::CLI::Daemon.new(:output => output) }
|
31
31
|
|
32
32
|
it "creates and executes and Updater" do
|
33
|
-
stub =
|
33
|
+
stub = double(:updater)
|
34
34
|
stub.should_receive(:execute)
|
35
35
|
Localeapp::CLI::Update.should_receive(:new).and_return(stub)
|
36
36
|
command.do_update
|
@@ -8,14 +8,14 @@ describe Localeapp::CLI::Install, '.execute(key = nil)' do
|
|
8
8
|
|
9
9
|
it "creates the installer based on the config type" do
|
10
10
|
command.config_type = :heroku
|
11
|
-
command.should_receive(:installer).with("HerokuInstaller").and_return(
|
11
|
+
command.should_receive(:installer).with("HerokuInstaller").and_return(double.as_null_object)
|
12
12
|
command.execute(key)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "executes the installer with the given key" do
|
16
|
-
installer =
|
16
|
+
installer = double(:installer)
|
17
17
|
installer.should_receive(:execute).with(key)
|
18
|
-
command.stub
|
18
|
+
command.stub(:installer).and_return(installer)
|
19
19
|
command.execute(key)
|
20
20
|
end
|
21
21
|
end
|
@@ -26,8 +26,8 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#execute(key = nil)' do
|
|
26
26
|
let(:installer) { Localeapp::CLI::Install::DefaultInstaller.new(output) }
|
27
27
|
|
28
28
|
before do
|
29
|
-
installer.stub
|
30
|
-
installer.stub
|
29
|
+
installer.stub(:print_header)
|
30
|
+
installer.stub(:validate_key).and_return(false)
|
31
31
|
end
|
32
32
|
|
33
33
|
it "prints the header" do
|
@@ -49,11 +49,11 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#execute(key = nil)' do
|
|
49
49
|
|
50
50
|
context "When key validation is successful" do
|
51
51
|
before do
|
52
|
-
installer.stub
|
53
|
-
installer.stub
|
54
|
-
installer.stub
|
55
|
-
installer.stub
|
56
|
-
installer.stub
|
52
|
+
installer.stub(:validate_key).and_return(true)
|
53
|
+
installer.stub(:check_default_locale)
|
54
|
+
installer.stub(:set_config_paths)
|
55
|
+
installer.stub(:write_config_file)
|
56
|
+
installer.stub(:check_data_directory_exists)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "checks the default locale" do
|
@@ -98,13 +98,13 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#validate_key(key)' do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
it "displays error if the key is there but isn't valid on localeapp.com" do
|
101
|
-
installer.stub
|
101
|
+
installer.stub(:check_key).and_return([false, {}])
|
102
102
|
installer.validate_key
|
103
103
|
output.string.should match(/Project not found/)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "displays project name if the key is there and valid on localeapp.com" do
|
107
|
-
installer.stub
|
107
|
+
installer.stub(:check_key).and_return([true, valid_project_data])
|
108
108
|
installer.validate_key
|
109
109
|
output.string.should match(/Test Project/)
|
110
110
|
end
|
@@ -115,7 +115,7 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#check_default_locale' do
|
|
115
115
|
let(:installer) { Localeapp::CLI::Install::DefaultInstaller.new(output) }
|
116
116
|
|
117
117
|
before do
|
118
|
-
installer.stub
|
118
|
+
installer.stub(:project_data).and_return(valid_project_data)
|
119
119
|
end
|
120
120
|
|
121
121
|
it "displays project base locale" do
|
@@ -156,7 +156,7 @@ describe Localeapp::CLI::Install::DefaultInstaller, '#write_config_file' do
|
|
156
156
|
it "creates a configuration file containing just the api key" do
|
157
157
|
installer.key = key
|
158
158
|
installer.config_file_path = config_file_path
|
159
|
-
file =
|
159
|
+
file = double('file')
|
160
160
|
file.should_receive(:write).with <<-CONTENT
|
161
161
|
require 'localeapp/rails'
|
162
162
|
|
@@ -200,7 +200,7 @@ describe Localeapp::CLI::Install::HerokuInstaller, '#write_config_file' do
|
|
200
200
|
it "creates a configuration file setup for staging / production on heroku" do
|
201
201
|
installer.key = key
|
202
202
|
installer.config_file_path = config_file_path
|
203
|
-
file =
|
203
|
+
file = double('file')
|
204
204
|
file.should_receive(:write).with <<-CONTENT
|
205
205
|
require 'localeapp/rails'
|
206
206
|
|
@@ -256,11 +256,11 @@ describe Localeapp::CLI::Install::StandaloneInstaller, '#write_config_file' do
|
|
256
256
|
let(:installer) { Localeapp::CLI::Install::StandaloneInstaller.new(output) }
|
257
257
|
|
258
258
|
it "creates a configuration file containing the dot file configuration at the given config_file_path" do
|
259
|
-
installer.stub
|
259
|
+
installer.stub(:create_config_dir).and_return(File.dirname(config_file_path))
|
260
260
|
installer.key = key
|
261
261
|
installer.config_file_path = config_file_path
|
262
262
|
installer.data_directory = data_directory
|
263
|
-
file =
|
263
|
+
file = double('file')
|
264
264
|
file.should_receive(:write).with <<-CONTENT
|
265
265
|
Localeapp.configure do |config|
|
266
266
|
config.api_key = 'APIKEY'
|
@@ -285,11 +285,11 @@ describe Localeapp::CLI::Install::GithubInstaller, '#write_config_file' do
|
|
285
285
|
installer.key = key
|
286
286
|
installer.config_file_path = config_file_path
|
287
287
|
installer.data_directory = data_directory
|
288
|
-
installer.stub
|
289
|
-
installer.stub
|
290
|
-
installer.stub
|
291
|
-
installer.stub
|
292
|
-
installer.stub
|
288
|
+
installer.stub(:create_config_dir).and_return(File.dirname(config_file_path))
|
289
|
+
installer.stub(:write_standalone_config)
|
290
|
+
installer.stub(:create_data_directory)
|
291
|
+
installer.stub(:create_gitignore)
|
292
|
+
installer.stub(:create_readme)
|
293
293
|
end
|
294
294
|
|
295
295
|
it "creates a standalone configuration file" do
|
@@ -29,7 +29,7 @@ describe Localeapp::CLI::Pull, "#update_backend(response)" do
|
|
29
29
|
|
30
30
|
it "calls the updater" do
|
31
31
|
with_configuration do
|
32
|
-
Localeapp.poller.stub
|
32
|
+
Localeapp.poller.stub(:write_synchronization_data!)
|
33
33
|
Localeapp.updater.should_receive(:dump).with(['test data'])
|
34
34
|
@puller.update_backend(@test_data)
|
35
35
|
end
|
@@ -37,7 +37,7 @@ describe Localeapp::CLI::Pull, "#update_backend(response)" do
|
|
37
37
|
|
38
38
|
it "writes the synchronization data" do
|
39
39
|
with_configuration do
|
40
|
-
Localeapp.updater.stub
|
40
|
+
Localeapp.updater.stub(:dump)
|
41
41
|
Localeapp.poller.should_receive(:write_synchronization_data!)
|
42
42
|
@puller.update_backend(@test_data)
|
43
43
|
end
|
@@ -10,7 +10,7 @@ describe Localeapp::CLI::Push, "#execute(path)" do
|
|
10
10
|
directory = double('directory')
|
11
11
|
path = 'test_path'
|
12
12
|
yaml_files = %w(en.yml es.yml)
|
13
|
-
pusher.stub
|
13
|
+
pusher.stub(:path_is_directory?).and_return(true)
|
14
14
|
pusher.should_receive(:yaml_files_in_directory).with(path).and_return(yaml_files)
|
15
15
|
pusher.should_receive(:push_file).with('en.yml')
|
16
16
|
pusher.should_receive(:push_file).with('es.yml')
|
@@ -39,7 +39,7 @@ describe Localeapp::CLI::Push, "#push_file(file_path)" do
|
|
39
39
|
with_configuration do
|
40
40
|
file = double('file')
|
41
41
|
file_path = 'test_path'
|
42
|
-
pusher.stub
|
42
|
+
pusher.stub(:sanitize_file).and_return(file)
|
43
43
|
pusher.should_receive(:api_call).with(
|
44
44
|
:import,
|
45
45
|
:payload => { :file => file },
|
@@ -52,7 +52,7 @@ describe Localeapp::CLI::Push, "#push_file(file_path)" do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "doesn't make the api call when the file doesn't exist" do
|
55
|
-
pusher.stub
|
55
|
+
pusher.stub(:sanitize_file).and_return(nil)
|
56
56
|
pusher.should_not_receive(:api_call)
|
57
57
|
pusher.push_file('foo')
|
58
58
|
end
|
@@ -55,7 +55,7 @@ describe I18n::Backend::Base, '#default' do
|
|
55
55
|
it "doesn't send anything to Locale" do
|
56
56
|
allow_sending do
|
57
57
|
Localeapp.missing_translations.should_not_receive(:add)
|
58
|
-
I18n.stub
|
58
|
+
I18n.stub(:translate) do |subject, _|
|
59
59
|
subject == :not_missing ? "not missing" : nil
|
60
60
|
end
|
61
61
|
klass.default(:en, 'foo', [:missing, :not_missing], :baz => 'bam')
|
@@ -75,7 +75,7 @@ describe Localeapp::Poller do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "updates the polled_at but not the updated_at synchronization data" do
|
78
|
-
@poller.stub
|
78
|
+
@poller.stub(:current_time).and_return(polled_at_time)
|
79
79
|
@poller.should_receive(:write_synchronization_data!).with(polled_at_time, @updated_at)
|
80
80
|
@poller.poll!
|
81
81
|
end
|
@@ -116,7 +116,7 @@ describe Localeapp::Poller do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it "updates the polled_at and the updated_at synchronization data" do
|
119
|
-
@poller.stub
|
119
|
+
@poller.stub(:current_time).and_return(polled_at_time)
|
120
120
|
@poller.should_receive(:write_synchronization_data!).with(polled_at_time, updated_at_time)
|
121
121
|
@poller.poll!
|
122
122
|
end
|
@@ -19,6 +19,7 @@ describe Localeapp::Rails::Controller, '#handle_translation_updates' do
|
|
19
19
|
with_configuration(configuration) do
|
20
20
|
@controller = TestController.new
|
21
21
|
end
|
22
|
+
now = Time.now; Time.stub(:now).and_return(now)
|
22
23
|
end
|
23
24
|
|
24
25
|
after do
|
@@ -29,7 +30,7 @@ describe Localeapp::Rails::Controller, '#handle_translation_updates' do
|
|
29
30
|
before do
|
30
31
|
Localeapp.configuration.environment_name = 'development'
|
31
32
|
end
|
32
|
-
|
33
|
+
|
33
34
|
it "calls poller.poll! when the synchronization file's polled_at has changed" do
|
34
35
|
Localeapp.poller.write_synchronization_data!(01234, 56789)
|
35
36
|
Localeapp.poller.should_receive(:poll!)
|
@@ -58,13 +59,13 @@ describe Localeapp::Rails::Controller, '#handle_translation_updates' do
|
|
58
59
|
@controller.handle_translation_updates
|
59
60
|
end
|
60
61
|
end
|
61
|
-
|
62
|
+
|
62
63
|
context "when reloading is enabled" do
|
63
64
|
before do
|
64
65
|
Localeapp.configuration.environment_name = 'development'
|
65
|
-
Localeapp.poller.stub
|
66
|
+
Localeapp.poller.stub(:poll!)
|
66
67
|
end
|
67
|
-
|
68
|
+
|
68
69
|
it "calls I18n.reload! when the synchronization file's updated_at has changed" do
|
69
70
|
Localeapp.poller.write_synchronization_data!(01234, 56789)
|
70
71
|
I18n.should_receive(:reload!)
|
@@ -76,7 +77,7 @@ describe Localeapp::Rails::Controller, '#handle_translation_updates' do
|
|
76
77
|
@controller.handle_translation_updates
|
77
78
|
end
|
78
79
|
end
|
79
|
-
|
80
|
+
|
80
81
|
context "when reloading is disabled" do
|
81
82
|
before do
|
82
83
|
Localeapp.configuration.environment_name = 'production'
|
metadata
CHANGED
@@ -1,212 +1,194 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: localeapp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
- 14
|
10
|
-
version: 0.6.14
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Christopher Dell
|
14
8
|
- Chris McGrath
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: i18n
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
34
|
-
requirement: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
36
29
|
name: json
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
37
35
|
type: :runtime
|
38
36
|
prerelease: false
|
39
|
-
version_requirements:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
48
|
-
requirement: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
50
43
|
name: rest-client
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
51
49
|
type: :runtime
|
52
50
|
prerelease: false
|
53
|
-
version_requirements:
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
62
|
-
requirement: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
64
57
|
name: rack
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
65
63
|
type: :runtime
|
66
64
|
prerelease: false
|
67
|
-
version_requirements:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
|
-
requirement: *id004
|
77
|
-
- !ruby/object:Gem::Dependency
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
78
71
|
name: ya2yaml
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
79
77
|
type: :runtime
|
80
78
|
prerelease: false
|
81
|
-
version_requirements:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
90
|
-
requirement: *id005
|
91
|
-
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
92
85
|
name: gli
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
93
91
|
type: :runtime
|
94
92
|
prerelease: false
|
95
|
-
version_requirements:
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
segments:
|
102
|
-
- 0
|
103
|
-
version: "0"
|
104
|
-
requirement: *id006
|
105
|
-
- !ruby/object:Gem::Dependency
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
106
99
|
name: rake
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
107
105
|
type: :development
|
108
106
|
prerelease: false
|
109
|
-
version_requirements:
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
118
|
-
requirement: *id007
|
119
|
-
- !ruby/object:Gem::Dependency
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
120
113
|
name: rspec
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
121
119
|
type: :development
|
122
120
|
prerelease: false
|
123
|
-
version_requirements:
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
segments:
|
130
|
-
- 2
|
131
|
-
- 11
|
132
|
-
- 0
|
133
|
-
version: 2.11.0
|
134
|
-
requirement: *id008
|
135
|
-
- !ruby/object:Gem::Dependency
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
136
127
|
name: yard
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
137
133
|
type: :development
|
138
134
|
prerelease: false
|
139
|
-
version_requirements:
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
segments:
|
146
|
-
- 0
|
147
|
-
- 6
|
148
|
-
- 7
|
149
|
-
version: 0.6.7
|
150
|
-
requirement: *id009
|
151
|
-
- !ruby/object:Gem::Dependency
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
152
141
|
name: RedCloth
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
153
147
|
type: :development
|
154
148
|
prerelease: false
|
155
|
-
version_requirements:
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
segments:
|
162
|
-
- 4
|
163
|
-
- 2
|
164
|
-
- 9
|
165
|
-
version: 4.2.9
|
166
|
-
requirement: *id010
|
167
|
-
- !ruby/object:Gem::Dependency
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
168
155
|
name: aruba
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
169
161
|
type: :development
|
170
162
|
prerelease: false
|
171
|
-
version_requirements:
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
segments:
|
178
|
-
- 0
|
179
|
-
- 5
|
180
|
-
- 1
|
181
|
-
version: 0.5.1
|
182
|
-
requirement: *id011
|
183
|
-
- !ruby/object:Gem::Dependency
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
184
169
|
name: fakeweb
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
185
175
|
type: :development
|
186
176
|
prerelease: false
|
187
|
-
version_requirements:
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
- 3
|
196
|
-
- 0
|
197
|
-
version: 1.3.0
|
198
|
-
requirement: *id012
|
199
|
-
description: Synchronizes i18n translation keys and content with localeapp.com so you don't have to manage translations by hand.
|
200
|
-
email:
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
description: Synchronizes i18n translation keys and content with localeapp.com so
|
183
|
+
you don't have to manage translations by hand.
|
184
|
+
email:
|
201
185
|
- chris@tigrish.com
|
202
186
|
- chris@octopod.info
|
203
|
-
executables:
|
187
|
+
executables:
|
204
188
|
- localeapp
|
205
189
|
extensions: []
|
206
|
-
|
207
190
|
extra_rdoc_files: []
|
208
|
-
|
209
|
-
files:
|
191
|
+
files:
|
210
192
|
- .autotest
|
211
193
|
- .gitignore
|
212
194
|
- .rspec
|
@@ -258,6 +240,8 @@ files:
|
|
258
240
|
- lib/localeapp/rails/2_3_translation_helper_monkeypatch.rb
|
259
241
|
- lib/localeapp/rails/controller.rb
|
260
242
|
- lib/localeapp/rails/flatten.rb
|
243
|
+
- lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
|
244
|
+
- lib/localeapp/rails/mimic_rails_missing_translation_display.rb
|
261
245
|
- lib/localeapp/routes.rb
|
262
246
|
- lib/localeapp/sender.rb
|
263
247
|
- lib/localeapp/tasks/localeapp.rake
|
@@ -292,75 +276,28 @@ files:
|
|
292
276
|
- spec/support/localeapp_integration_data.rb
|
293
277
|
- spec/support/localeapp_synchronization_data.rb
|
294
278
|
homepage: http://www.localeapp.com
|
295
|
-
licenses:
|
279
|
+
licenses:
|
296
280
|
- MIT
|
281
|
+
metadata: {}
|
297
282
|
post_install_message:
|
298
283
|
rdoc_options: []
|
299
|
-
|
300
|
-
require_paths:
|
284
|
+
require_paths:
|
301
285
|
- lib
|
302
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
none: false
|
313
|
-
requirements:
|
314
|
-
- - ">="
|
315
|
-
- !ruby/object:Gem::Version
|
316
|
-
hash: 3
|
317
|
-
segments:
|
318
|
-
- 0
|
319
|
-
version: "0"
|
286
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
287
|
+
requirements:
|
288
|
+
- - '>='
|
289
|
+
- !ruby/object:Gem::Version
|
290
|
+
version: '0'
|
291
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
|
+
requirements:
|
293
|
+
- - '>='
|
294
|
+
- !ruby/object:Gem::Version
|
295
|
+
version: '0'
|
320
296
|
requirements: []
|
321
|
-
|
322
297
|
rubyforge_project: localeapp
|
323
|
-
rubygems_version:
|
298
|
+
rubygems_version: 2.2.1
|
324
299
|
signing_key:
|
325
|
-
specification_version:
|
300
|
+
specification_version: 4
|
326
301
|
summary: Easy i18n translation management with localeapp.com
|
327
|
-
test_files:
|
328
|
-
|
329
|
-
- features/bad_command.feature
|
330
|
-
- features/help.feature
|
331
|
-
- features/install.feature
|
332
|
-
- features/mv.feature
|
333
|
-
- features/pull.feature
|
334
|
-
- features/push.feature
|
335
|
-
- features/rm.feature
|
336
|
-
- features/step_definitions/cli_steps.rb
|
337
|
-
- features/support/env.rb
|
338
|
-
- features/support/hooks.rb
|
339
|
-
- features/update.feature
|
340
|
-
- spec/fixtures/empty_log.yml
|
341
|
-
- spec/fixtures/en.yml
|
342
|
-
- spec/fixtures/es.yml
|
343
|
-
- spec/localeapp/api_call_spec.rb
|
344
|
-
- spec/localeapp/api_caller_spec.rb
|
345
|
-
- spec/localeapp/cli/add_spec.rb
|
346
|
-
- spec/localeapp/cli/daemon_spec.rb
|
347
|
-
- spec/localeapp/cli/install_spec.rb
|
348
|
-
- spec/localeapp/cli/pull_spec.rb
|
349
|
-
- spec/localeapp/cli/push_spec.rb
|
350
|
-
- spec/localeapp/cli/rename_spec.rb
|
351
|
-
- spec/localeapp/cli/update_spec.rb
|
352
|
-
- spec/localeapp/configuration_spec.rb
|
353
|
-
- spec/localeapp/default_value_handler_spec.rb
|
354
|
-
- spec/localeapp/exception_handler_spec.rb
|
355
|
-
- spec/localeapp/key_checker_spec.rb
|
356
|
-
- spec/localeapp/missing_translations_spec.rb
|
357
|
-
- spec/localeapp/poller_spec.rb
|
358
|
-
- spec/localeapp/rails/controller_spec.rb
|
359
|
-
- spec/localeapp/routes_spec.rb
|
360
|
-
- spec/localeapp/sender_spec.rb
|
361
|
-
- spec/localeapp/updater_spec.rb
|
362
|
-
- spec/localeapp_spec.rb
|
363
|
-
- spec/spec_helper.rb
|
364
|
-
- spec/support/i18n/missing_translation.rb
|
365
|
-
- spec/support/localeapp_integration_data.rb
|
366
|
-
- spec/support/localeapp_synchronization_data.rb
|
302
|
+
test_files: []
|
303
|
+
has_rdoc:
|