rails-asset-localization 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba52b55a831d891d709aa9238c0d322868deeb17
4
- data.tar.gz: e520fdf6b7137c872e8e4534875e0134e941e8ec
3
+ metadata.gz: 2596c4024cb801acefb19ec103f4218d82f77098
4
+ data.tar.gz: c94fb6cef75dbb839b550bd1059636a90c5bf53c
5
5
  SHA512:
6
- metadata.gz: c14e62612a36a7bc0d678a4cbbe72c31f564dfeca11fd65c2dbcab2bbab1741f886c24fd105bf3b90fed487f6ea3f16b306b6719e7d80b28ac4002dec8ecd692
7
- data.tar.gz: 8174d231aaefe0e6a7562b7f5b7b6b8cab827a5307b1035a2afe840bb790e6c5dbd7cbe5df51bc26b23b4d890bf88ea0e1b46fb72b6d44e4db3292f3a0537781
6
+ metadata.gz: 9225725b3f3608df4b8b84bfcb951e911eb7faa5166fc7fc4ba7d97131967962cba70819176c96c1ca645afaafa0b45ba6a3f210456cbe7bb6f13ccfeb9bc8eb
7
+ data.tar.gz: 4b653cd9346a95224cf0caa0265e60faaa58064bb2569ccb558c2deec3b4c76c6150db208e13123daa280fdf7e847846a79de1666146531f22712e4b80ef082c
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # RailsAssetLocalization
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rails-asset-localization.png)](http://badge.fury.io/rb/rails-asset-localization)
4
+ [![Build Status](https://travis-ci.org/nicolai86/rails-asset-localization.png)](https://travis-ci.org/nicolai86/rails-asset-localization)
5
+
4
6
 
5
7
  A Rails Engine that allows you to use i18next with the asset pipeline. Locales are served dynamically to allow easy integration with services like [CopyCopter][1].
6
8
 
data/Rakefile CHANGED
@@ -1,31 +1,10 @@
1
1
  #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
14
-
15
- RDoc::Task.new(:rdoc) do |rdoc|
16
- rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'JqueryLocalizationEngine'
18
- rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
20
- rdoc.rdoc_files.include('lib/**/*.rb')
21
- end
22
-
23
-
24
2
 
3
+ require 'bundler/setup'
4
+ require "bundler/gem_tasks"
25
5
  Bundler::GemHelper.install_tasks
26
6
 
27
7
  require 'rake/testtask'
28
-
29
8
  Rake::TestTask.new(:test) do |t|
30
9
  t.libs << 'lib'
31
10
  t.libs << 'test'
@@ -33,5 +12,8 @@ Rake::TestTask.new(:test) do |t|
33
12
  t.verbose = false
34
13
  end
35
14
 
36
-
37
15
  task :default => :test
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
@@ -1,3 +1,3 @@
1
1
  module RailsAssetLocalization
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -319,5 +319,104 @@ Completed 200 OK in 4ms (Views: 2.0ms | ActiveRecord: 0.0ms)
319
319
   (0.0ms) begin transaction
320
320
  ---------------------------------------------------
321
321
  RailsLocalizationEngineTest: test_module_is_defined
322
+ ---------------------------------------------------
323
+  (0.0ms) rollback transaction
324
+  (0.2ms) begin transaction
325
+ ------------------------------------------------------
326
+ LocalesControllerTest: test_returns_assets_via_request
327
+ ------------------------------------------------------
328
+ Started GET "/locales/de.json" for 127.0.0.1 at 2013-11-08 20:31:16 +0100
329
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
330
+ Parameters: {"locale"=>"de"}
331
+ Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 0.0ms)
332
+ Started GET "/locales/en.json" for 127.0.0.1 at 2013-11-08 20:31:16 +0100
333
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
334
+ Parameters: {"locale"=>"en"}
335
+ Completed 200 OK in 4ms (Views: 2.0ms | ActiveRecord: 0.0ms)
336
+  (0.0ms) rollback transaction
337
+  (0.0ms) begin transaction
338
+ ------------------------------------------------------------------
339
+ LocalesControllerTest: test_returns_empty_hash_for_unknown_locales
340
+ ------------------------------------------------------------------
341
+ Started GET "/locales/fr.json" for 127.0.0.1 at 2013-11-08 20:31:16 +0100
342
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
343
+ Parameters: {"locale"=>"fr"}
344
+ Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 0.0ms)
345
+  (0.0ms) rollback transaction
346
+  (0.0ms) begin transaction
347
+ ---------------------------------------------------
348
+ RailsLocalizationEngineTest: test_module_is_defined
349
+ ---------------------------------------------------
350
+  (0.1ms) rollback transaction
351
+  (0.2ms) begin transaction
352
+ ------------------------------------------------------
353
+ LocalesControllerTest: test_returns_assets_via_request
354
+ ------------------------------------------------------
355
+ Started GET "/locales/de.json" for 127.0.0.1 at 2013-11-08 20:32:38 +0100
356
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
357
+ Parameters: {"locale"=>"de"}
358
+ Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.0ms)
359
+ Started GET "/locales/en.json" for 127.0.0.1 at 2013-11-08 20:32:38 +0100
360
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
361
+ Parameters: {"locale"=>"en"}
362
+ Completed 200 OK in 5ms (Views: 2.1ms | ActiveRecord: 0.0ms)
363
+  (0.1ms) rollback transaction
364
+  (0.1ms) begin transaction
365
+ ------------------------------------------------------------------
366
+ LocalesControllerTest: test_returns_empty_hash_for_unknown_locales
367
+ ------------------------------------------------------------------
368
+ Started GET "/locales/fr.json" for 127.0.0.1 at 2013-11-08 20:32:38 +0100
369
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
370
+ Parameters: {"locale"=>"fr"}
371
+ Completed 200 OK in 3ms (Views: 0.0ms | ActiveRecord: 0.0ms)
372
+  (0.0ms) rollback transaction
373
+  (0.0ms) begin transaction
374
+ -----------------------------------------------------------
375
+ LocalesControllerTest: test_works_for_country_codes_as_well
376
+ -----------------------------------------------------------
377
+ Started GET "/locales/de-DE.json" for 127.0.0.1 at 2013-11-08 20:32:38 +0100
378
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
379
+ Parameters: {"locale"=>"de-DE"}
380
+ Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 0.0ms)
381
+  (0.0ms) rollback transaction
382
+  (0.0ms) begin transaction
383
+ ---------------------------------------------------
384
+ RailsLocalizationEngineTest: test_module_is_defined
385
+ ---------------------------------------------------
386
+  (0.0ms) rollback transaction
387
+  (0.2ms) begin transaction
388
+ ------------------------------------------------------
389
+ LocalesControllerTest: test_returns_assets_via_request
390
+ ------------------------------------------------------
391
+ Started GET "/locales/de.json" for 127.0.0.1 at 2013-11-10 00:08:58 +0100
392
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
393
+ Parameters: {"locale"=>"de"}
394
+ Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 0.0ms)
395
+ Started GET "/locales/en.json" for 127.0.0.1 at 2013-11-10 00:08:58 +0100
396
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
397
+ Parameters: {"locale"=>"en"}
398
+ Completed 200 OK in 4ms (Views: 1.9ms | ActiveRecord: 0.0ms)
399
+  (0.1ms) rollback transaction
400
+  (0.0ms) begin transaction
401
+ ------------------------------------------------------------------
402
+ LocalesControllerTest: test_returns_empty_hash_for_unknown_locales
403
+ ------------------------------------------------------------------
404
+ Started GET "/locales/fr.json" for 127.0.0.1 at 2013-11-10 00:08:58 +0100
405
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
406
+ Parameters: {"locale"=>"fr"}
407
+ Completed 200 OK in 2ms (Views: 0.0ms | ActiveRecord: 0.0ms)
408
+  (0.0ms) rollback transaction
409
+  (0.0ms) begin transaction
410
+ -----------------------------------------------------------
411
+ LocalesControllerTest: test_works_for_country_codes_as_well
412
+ -----------------------------------------------------------
413
+ Started GET "/locales/de-DE.json" for 127.0.0.1 at 2013-11-10 00:08:58 +0100
414
+ Processing by RailsAssetLocalization::LocalesController#locale as JSON
415
+ Parameters: {"locale"=>"de-DE"}
416
+ Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms)
417
+  (0.0ms) rollback transaction
418
+  (0.0ms) begin transaction
419
+ ---------------------------------------------------
420
+ RailsLocalizationEngineTest: test_module_is_defined
322
421
  ---------------------------------------------------
323
422
   (0.0ms) rollback transaction
@@ -16,4 +16,19 @@ class LocalesControllerTest < ActionDispatch::IntegrationTest
16
16
  assert locales.keys.include?("hello")
17
17
  assert_equal "Hello world", locales["hello"]
18
18
  end
19
+
20
+ test "returns empty hash for unknown locales" do
21
+ get "/locales/fr.json"
22
+ assert_response :success
23
+
24
+ locales = JSON.parse response.body
25
+ assert locales.empty?
26
+ end
27
+
28
+ test "works for country codes as well" do
29
+ get "/locales/de-DE.json"
30
+ locales = JSON.parse response.body
31
+ assert_equal %w(hello), locales.keys
32
+ assert_equal "Hallo Welt", locales["hello"]
33
+ end
19
34
  end
metadata CHANGED
@@ -1,22 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-asset-localization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Randschau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2013-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>'
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.12
19
+ version: 3.2.16
20
20
  - - <
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.0'
@@ -24,9 +24,9 @@ dependencies:
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>'
27
+ - - '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.12
29
+ version: 3.2.16
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
@@ -73,6 +73,7 @@ files:
73
73
  - test/dummy/config/application.rb
74
74
  - test/dummy/config/boot.rb
75
75
  - test/dummy/config/database.yml
76
+ - test/dummy/config/database.yml.sample
76
77
  - test/dummy/config/environment.rb
77
78
  - test/dummy/config/environments/development.rb
78
79
  - test/dummy/config/environments/production.rb
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  version: '0'
120
121
  requirements: []
121
122
  rubyforge_project:
122
- rubygems_version: 2.1.10
123
+ rubygems_version: 2.1.11
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: I18next and dynamic localization for your Rails app
@@ -132,6 +133,7 @@ test_files:
132
133
  - test/dummy/config/application.rb
133
134
  - test/dummy/config/boot.rb
134
135
  - test/dummy/config/database.yml
136
+ - test/dummy/config/database.yml.sample
135
137
  - test/dummy/config/environment.rb
136
138
  - test/dummy/config/environments/development.rb
137
139
  - test/dummy/config/environments/production.rb