awesome_translations 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/awesome_translations.rb +5 -1
- data/lib/awesome_translations/erb_inspector.rb +13 -3
- data/lib/awesome_translations/handlers/erb_handler.rb +11 -5
- data/lib/awesome_translations/handlers/library_handler.rb +37 -0
- data/lib/awesome_translations/handlers/validations_handler.rb +1 -1
- data/lib/awesome_translations/model_inspector.rb +9 -3
- data/lib/awesome_translations/object_extensions.rb +31 -6
- data/lib/awesome_translations/version.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +2 -0
- data/spec/dummy/app/models/role.rb +7 -0
- data/spec/dummy/config/locales/awesome_translations/models/role/da.yml +6 -0
- data/spec/dummy/config/locales/awesome_translations/models/role/de.yml +6 -0
- data/spec/dummy/config/locales/awesome_translations/models/role/en.yml +6 -0
- data/spec/dummy/config/locales/awesome_translations/models/user/da.yml +6 -0
- data/spec/dummy/config/locales/awesome_translations/models/user/de.yml +6 -0
- data/spec/dummy/config/locales/awesome_translations/models/user/en.yml +6 -0
- data/spec/dummy/log/test.log +3227 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1b2a7d537faf315ae13485445854a5ef +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3a98370f571a26666587622ab8526b31 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/91406f9a3422285f8475d13d5093271b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c1092209770ff950c5697ec886327353 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c2fda0b675f9f971e9328c76254e44b6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c6de7a48a0cb4668cc20ebe89d235b10 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d748e38dac6a003cac60f346aaaf324f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dcd0b2d0aaa104a4e915d7d4a046436d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/handlers/library_handler_spec.rb +13 -0
- data/spec/lib/erb_inspector_spec.rb +1 -1
- data/spec/lib/model_inspector_spec.rb +3 -1
- data/spec/lib/object_extensions_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- metadata +35 -2
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe AwesomeTranslations::Handlers::LibraryHandler do
|
4
|
+
let(:handler) { AwesomeTranslations::Handlers::LibraryHandler.new }
|
5
|
+
let(:group) { handler.groups.select { |group| group.name == "app/models/role.rb" }.first }
|
6
|
+
let(:admin_translation) { group.translations.select { |translation| translation.key == "models.role.administrator" }.first }
|
7
|
+
|
8
|
+
it "finds translations made with the t method" do
|
9
|
+
admin_translation.should_not eq nil
|
10
|
+
admin_translation.key.should eq "models.role.administrator"
|
11
|
+
admin_translation.dir.should end_with "spec/dummy/config/locales/awesome_translations/app/models"
|
12
|
+
end
|
13
|
+
end
|
@@ -5,11 +5,13 @@ describe AwesomeTranslations::ModelInspector do
|
|
5
5
|
let(:model_classes) { AwesomeTranslations::ModelInspector.model_classes.map(&:clazz) }
|
6
6
|
|
7
7
|
it "#model_classes" do
|
8
|
+
require "jquery-rails"
|
9
|
+
|
8
10
|
model_classes.to_a.sort { |class1, class2| class1.name <=> class2.name }.should eq [Role, User]
|
9
11
|
end
|
10
12
|
|
11
13
|
it "#engines" do
|
12
|
-
AwesomeTranslations::ModelInspector.engines.map(&:class).should eq [AwesomeTranslations::Engine, Jquery::Rails::Engine]
|
14
|
+
AwesomeTranslations::ModelInspector.engines.map(&:class).sort { |class1, class2| class1.name <=> class2.name }.should eq [AwesomeTranslations::Engine, Jquery::Rails::Engine]
|
13
15
|
end
|
14
16
|
|
15
17
|
it "#class_key" do
|
data/spec/spec_helper.rb
CHANGED
@@ -19,6 +19,8 @@ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
|
19
19
|
FactoryGirl.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
|
20
20
|
FactoryGirl.find_definitions
|
21
21
|
|
22
|
+
AwesomeTranslations.load_object_extensions
|
23
|
+
|
22
24
|
RSpec.configure do |config|
|
23
25
|
include ActionDispatch::TestProcess
|
24
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_translations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -216,6 +216,7 @@ files:
|
|
216
216
|
- lib/awesome_translations/handlers/base_handler.rb
|
217
217
|
- lib/awesome_translations/handlers/erb_handler.rb
|
218
218
|
- lib/awesome_translations/handlers/global_handler.rb
|
219
|
+
- lib/awesome_translations/handlers/library_handler.rb
|
219
220
|
- lib/awesome_translations/handlers/model_handler.rb
|
220
221
|
- lib/awesome_translations/handlers/validations_handler.rb
|
221
222
|
- lib/awesome_translations/model_inspector.rb
|
@@ -258,6 +259,12 @@ files:
|
|
258
259
|
- spec/dummy/config/initializers/secret_token.rb
|
259
260
|
- spec/dummy/config/initializers/session_store.rb
|
260
261
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
262
|
+
- spec/dummy/config/locales/awesome_translations/models/role/da.yml
|
263
|
+
- spec/dummy/config/locales/awesome_translations/models/role/de.yml
|
264
|
+
- spec/dummy/config/locales/awesome_translations/models/role/en.yml
|
265
|
+
- spec/dummy/config/locales/awesome_translations/models/user/da.yml
|
266
|
+
- spec/dummy/config/locales/awesome_translations/models/user/de.yml
|
267
|
+
- spec/dummy/config/locales/awesome_translations/models/user/en.yml
|
261
268
|
- spec/dummy/config/locales/en.yml
|
262
269
|
- spec/dummy/config/locales/translations.yml
|
263
270
|
- spec/dummy/config/routes.rb
|
@@ -306,9 +313,11 @@ files:
|
|
306
313
|
- spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/groups.css.scssc
|
307
314
|
- spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/layout.css.scssc
|
308
315
|
- spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
316
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/1b2a7d537faf315ae13485445854a5ef
|
309
317
|
- spec/dummy/tmp/cache/assets/test/sprockets/2128d293dc8ef13115c1f5d64b5acfc9
|
310
318
|
- spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
311
319
|
- spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
320
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/3a98370f571a26666587622ab8526b31
|
312
321
|
- spec/dummy/tmp/cache/assets/test/sprockets/50b9bcf05a8718d9cb5b99276f154ea9
|
313
322
|
- spec/dummy/tmp/cache/assets/test/sprockets/5316fc0620afefc2ba81b690c8e2c34d
|
314
323
|
- spec/dummy/tmp/cache/assets/test/sprockets/538966109f3bbd58bfb717ad57a37096
|
@@ -319,18 +328,25 @@ files:
|
|
319
328
|
- spec/dummy/tmp/cache/assets/test/sprockets/81ab882fef1228d654a7c697f2324309
|
320
329
|
- spec/dummy/tmp/cache/assets/test/sprockets/908bf508cc68079cab720d6b9c36cb95
|
321
330
|
- spec/dummy/tmp/cache/assets/test/sprockets/91090eda0f104056144ac17a4fcae91c
|
331
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/91406f9a3422285f8475d13d5093271b
|
322
332
|
- spec/dummy/tmp/cache/assets/test/sprockets/a3c8104e5830cd7047c6a3a1c1e2ba32
|
323
333
|
- spec/dummy/tmp/cache/assets/test/sprockets/b512f2b016bd3aef8c28fa661e01308c
|
324
334
|
- spec/dummy/tmp/cache/assets/test/sprockets/bd49bb0a6f5dfd284a750fb9cab40d85
|
335
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/c1092209770ff950c5697ec886327353
|
336
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/c2fda0b675f9f971e9328c76254e44b6
|
325
337
|
- spec/dummy/tmp/cache/assets/test/sprockets/c39fce5fa19b758734af29527d4185ca
|
338
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/c6de7a48a0cb4668cc20ebe89d235b10
|
326
339
|
- spec/dummy/tmp/cache/assets/test/sprockets/cb595904fcf7acdedf2b95571442fc59
|
327
340
|
- spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
341
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/d748e38dac6a003cac60f346aaaf324f
|
328
342
|
- spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
343
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/dcd0b2d0aaa104a4e915d7d4a046436d
|
329
344
|
- spec/dummy/tmp/cache/assets/test/sprockets/eb9ed717a7ef467bf260b11dfc8451eb
|
330
345
|
- spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
331
346
|
- spec/factories/user.rb
|
332
347
|
- spec/handlers/erb_handler_spec.rb
|
333
348
|
- spec/handlers/global_handler_spec.rb
|
349
|
+
- spec/handlers/library_handler_spec.rb
|
334
350
|
- spec/handlers/model_handler_spec.rb
|
335
351
|
- spec/handlers/validations_handler_spec.rb
|
336
352
|
- spec/handlers_spec.rb
|
@@ -339,6 +355,7 @@ files:
|
|
339
355
|
- spec/lib/erb_inspector_spec.rb
|
340
356
|
- spec/lib/model_inspector/attribute_spec.rb
|
341
357
|
- spec/lib/model_inspector_spec.rb
|
358
|
+
- spec/lib/object_extensions_spec.rb
|
342
359
|
- spec/models/awesome_translations/handler_spec.rb
|
343
360
|
- spec/models/awesome_translations/translated_value_spec.rb
|
344
361
|
- spec/spec_helper.rb
|
@@ -367,6 +384,7 @@ specification_version: 4
|
|
367
384
|
summary: Semi-automatic maintenance of most translations in a Rails app.
|
368
385
|
test_files:
|
369
386
|
- spec/lib/model_inspector/attribute_spec.rb
|
387
|
+
- spec/lib/object_extensions_spec.rb
|
370
388
|
- spec/lib/model_inspector_spec.rb
|
371
389
|
- spec/lib/erb_inspector/file_inspector_spec.rb
|
372
390
|
- spec/lib/erb_inspector/translation_inspector_spec.rb
|
@@ -379,6 +397,7 @@ test_files:
|
|
379
397
|
- spec/handlers/erb_handler_spec.rb
|
380
398
|
- spec/handlers/validations_handler_spec.rb
|
381
399
|
- spec/handlers/global_handler_spec.rb
|
400
|
+
- spec/handlers/library_handler_spec.rb
|
382
401
|
- spec/models/awesome_translations/translated_value_spec.rb
|
383
402
|
- spec/models/awesome_translations/handler_spec.rb
|
384
403
|
- spec/factories/user.rb
|
@@ -406,25 +425,33 @@ test_files:
|
|
406
425
|
- spec/dummy/tmp/cache/assets/test/sprockets/eb9ed717a7ef467bf260b11dfc8451eb
|
407
426
|
- spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
408
427
|
- spec/dummy/tmp/cache/assets/test/sprockets/6db8498274efddac6691248cc9afe855
|
428
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/c1092209770ff950c5697ec886327353
|
429
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/3a98370f571a26666587622ab8526b31
|
409
430
|
- spec/dummy/tmp/cache/assets/test/sprockets/58b9ed99ad62ba462ca6a9272b96bef3
|
410
431
|
- spec/dummy/tmp/cache/assets/test/sprockets/538966109f3bbd58bfb717ad57a37096
|
411
432
|
- spec/dummy/tmp/cache/assets/test/sprockets/5316fc0620afefc2ba81b690c8e2c34d
|
412
433
|
- spec/dummy/tmp/cache/assets/test/sprockets/81ab882fef1228d654a7c697f2324309
|
413
434
|
- spec/dummy/tmp/cache/assets/test/sprockets/697d977cf9fc7e54534f5e29b0832836
|
435
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/c6de7a48a0cb4668cc20ebe89d235b10
|
414
436
|
- spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
415
437
|
- spec/dummy/tmp/cache/assets/test/sprockets/bd49bb0a6f5dfd284a750fb9cab40d85
|
416
438
|
- spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
417
439
|
- spec/dummy/tmp/cache/assets/test/sprockets/91090eda0f104056144ac17a4fcae91c
|
418
440
|
- spec/dummy/tmp/cache/assets/test/sprockets/b512f2b016bd3aef8c28fa661e01308c
|
441
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/dcd0b2d0aaa104a4e915d7d4a046436d
|
442
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/91406f9a3422285f8475d13d5093271b
|
443
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/d748e38dac6a003cac60f346aaaf324f
|
419
444
|
- spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
420
445
|
- spec/dummy/tmp/cache/assets/test/sprockets/50b9bcf05a8718d9cb5b99276f154ea9
|
421
446
|
- spec/dummy/tmp/cache/assets/test/sprockets/cb595904fcf7acdedf2b95571442fc59
|
422
447
|
- spec/dummy/tmp/cache/assets/test/sprockets/a3c8104e5830cd7047c6a3a1c1e2ba32
|
423
448
|
- spec/dummy/tmp/cache/assets/test/sprockets/908bf508cc68079cab720d6b9c36cb95
|
424
449
|
- spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
450
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/1b2a7d537faf315ae13485445854a5ef
|
425
451
|
- spec/dummy/tmp/cache/assets/test/sprockets/2128d293dc8ef13115c1f5d64b5acfc9
|
426
452
|
- spec/dummy/tmp/cache/assets/test/sprockets/c39fce5fa19b758734af29527d4185ca
|
427
453
|
- spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
454
|
+
- spec/dummy/tmp/cache/assets/test/sprockets/c2fda0b675f9f971e9328c76254e44b6
|
428
455
|
- spec/dummy/tmp/cache/assets/development/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/application.css.scssc
|
429
456
|
- spec/dummy/tmp/cache/assets/development/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/layout.css.scssc
|
430
457
|
- spec/dummy/tmp/cache/assets/development/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/groups.css.scssc
|
@@ -481,6 +508,12 @@ test_files:
|
|
481
508
|
- spec/dummy/config/environment.rb
|
482
509
|
- spec/dummy/config/boot.rb
|
483
510
|
- spec/dummy/config/locales/translations.yml
|
511
|
+
- spec/dummy/config/locales/awesome_translations/models/role/da.yml
|
512
|
+
- spec/dummy/config/locales/awesome_translations/models/role/de.yml
|
513
|
+
- spec/dummy/config/locales/awesome_translations/models/role/en.yml
|
514
|
+
- spec/dummy/config/locales/awesome_translations/models/user/da.yml
|
515
|
+
- spec/dummy/config/locales/awesome_translations/models/user/de.yml
|
516
|
+
- spec/dummy/config/locales/awesome_translations/models/user/en.yml
|
484
517
|
- spec/dummy/config/locales/en.yml
|
485
518
|
- spec/dummy/config/database.yml
|
486
519
|
- spec/dummy/config/routes.rb
|