i18n-js-assets 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -1
  3. data/Rakefile +1 -1
  4. data/i18n-js-assets.gemspec +1 -4
  5. data/lib/i18n-js-assets.rb +5 -5
  6. data/lib/i18n-js-assets/railtie.rb +12 -25
  7. data/lib/i18n-js-assets/transformer.rb +66 -0
  8. data/lib/i18n-js-assets/version.rb +1 -1
  9. data/lib/i18n-js-assets/versioning.rb +0 -12
  10. data/spec/public/assets/manifest-68a410d3a5a03cfa0d005ad402cc2b2fa882c3fed819f8c16c1c9d764ebd2d70.js +3 -0
  11. data/spec/public/assets/manifest-68a410d3a5a03cfa0d005ad402cc2b2fa882c3fed819f8c16c1c9d764ebd2d70.js.gz +0 -0
  12. data/spec/public/assets/translations/precompilable-en-fae6bbf0494f8deb67a50f0b5204a012e842f6416ff15acad11004c348e53841.js +2 -0
  13. data/spec/public/assets/translations/precompilable-en-fae6bbf0494f8deb67a50f0b5204a012e842f6416ff15acad11004c348e53841.js.gz +0 -0
  14. data/spec/public/assets/translations/precompilable-es-cba1bab30b88a6554da68bff125cdd4073ec6a7529a25732afb3850cbc307005.js +2 -0
  15. data/spec/public/assets/translations/precompilable-es-cba1bab30b88a6554da68bff125cdd4073ec6a7529a25732afb3850cbc307005.js.gz +0 -0
  16. data/spec/spec_helper.rb +1 -1
  17. data/spec/tmp/cache/assets/sprockets/v4.0/1SDQIQhED2byWZvSa6AeYKVPSJ-mdz_JEDY7pBm_ZzI.cache +1 -0
  18. data/spec/tmp/cache/assets/sprockets/v4.0/2tbxV5AUnVkRwT6eRFGS3hW2RdruaesgBYixFWuJUoI.cache +2 -0
  19. data/spec/tmp/cache/assets/sprockets/v4.0/5aqFWxRGSrWsBT0SSrvNXDevT7L9fdRxPrw39aocBes.cache +0 -0
  20. data/spec/tmp/cache/assets/sprockets/v4.0/5dOGbMjZOu3MTGdjlvIRU6ih-aSh0kqvrK2e9uj63sM.cache +3 -0
  21. data/spec/tmp/cache/assets/sprockets/v4.0/6SdkV7Dt8Cwo6VNGpQ8KV2WoKrEs55vJFoIdPH9JOdE.cache +3 -0
  22. data/spec/tmp/cache/assets/sprockets/v4.0/9E6VuRR__yGyIFlgjrjLxBeoR6cqZNJgPstY5KXPaFA.cache +0 -0
  23. data/spec/tmp/cache/assets/sprockets/v4.0/AOEc3me3ZXkDjiGrtLqkjWuq9VPreWo9mszqn_aOnaM.cache +0 -0
  24. data/spec/tmp/cache/assets/sprockets/v4.0/B83SLy4L82OQbBOGrxDQzmA3oWoPw143tMDXWXCVxrU.cache +3 -0
  25. data/spec/tmp/cache/assets/sprockets/v4.0/CbonGaQzCZNPpO7v3iSqCnDXerU89Cxaqkh2JJ-Ze-Y.cache +3 -0
  26. data/spec/tmp/cache/assets/sprockets/v4.0/DNg-2Ul4PYLhmkdj9mgGearPCXjNT809_R7V53qD2HE.cache +0 -0
  27. data/spec/tmp/cache/assets/sprockets/v4.0/DobpGxO3crUb-zrMjXsl3Wnv7xPkSUT-uwbgSIeEMso.cache +1 -0
  28. data/spec/tmp/cache/assets/sprockets/v4.0/Ouq5xqJJWNNCjunjwA7luluJvW91iTgnneP9UysQTno.cache +0 -0
  29. data/spec/tmp/cache/assets/sprockets/v4.0/SPqPSfOB-NOB_thUv6KhrBHTh0UQzCexF5EWYE09miU.cache +1 -0
  30. data/spec/tmp/cache/assets/sprockets/v4.0/T26iayzsnISAo_2iEpHOCaAfuHN93Tb_2EDx1kHRKJg.cache +1 -0
  31. data/spec/tmp/cache/assets/sprockets/v4.0/V1sSmTvDskWdDMh6nGQh5-d4Wkb_L1pQ0iSqIPRAEQQ.cache +1 -0
  32. data/spec/tmp/cache/assets/sprockets/v4.0/WuyjArU0CSrtZEmy8lsbS69ntCsY6Sq4Dao622Dt9fA.cache +1 -0
  33. data/spec/tmp/cache/assets/sprockets/v4.0/ZTGnDmBFMNdHn7VjIOkFm9Sk0F4bATd2QSOX6scgCyE.cache +1 -0
  34. data/spec/tmp/cache/assets/sprockets/v4.0/_q0-g1GCOh1Gcakry0QSvObw3raYMB5qoVf8RQhFMtA.cache +1 -0
  35. data/spec/tmp/cache/assets/sprockets/v4.0/g6GVwheH6OPS1PU_Y3lhW5m64sBqRf1ZCprpx5dMAEc.cache +3 -0
  36. data/spec/tmp/cache/assets/sprockets/v4.0/h2LRwpJ3QnXQVBgpHq906Noj_bmTkybfaM5YOsHHIEM.cache +0 -0
  37. data/spec/tmp/cache/assets/sprockets/v4.0/lzl0tzfmpAoVlfKT3cv7wu4aYD0U4fdvzlP6wDXkeD4.cache +3 -0
  38. data/spec/tmp/cache/assets/sprockets/v4.0/mC3Q5h9GORDmDRMMliPZXjZ74HdlKkjgv5gXLkbGL6M.cache +3 -0
  39. data/spec/tmp/cache/assets/sprockets/v4.0/nfiNGvvalGdYHk7YCi86xBut-A4xAjXPSWN4F3RSlHc.cache +1 -0
  40. data/spec/tmp/cache/assets/sprockets/v4.0/np_lokrnYrcb__gYX2KuBHh8CIaF-OEYTKUh0yQIwJg.cache +2 -0
  41. data/spec/tmp/cache/assets/sprockets/v4.0/q3Wi-dMbjBO3bPG9D1ZTovpF61Kw-9jG7B8f_MmWwIc.cache +1 -0
  42. data/spec/tmp/cache/assets/sprockets/v4.0/qs087m9fdmSy3x9qOCSOlrtQfMKvKk2xKSjNTZC2bbA.cache +0 -0
  43. data/spec/tmp/cache/assets/sprockets/v4.0/reIwGCVu3xKhgE8f8xUGUgbK0miVUzGAew-99jvqQ6s.cache +2 -0
  44. data/spec/tmp/cache/assets/sprockets/v4.0/sxg4aL2KRzvmK8wKPnQq-6ZXsiIRrWQpolu9PwijqKA.cache +1 -0
  45. data/spec/tmp/cache/assets/sprockets/v4.0/u4WQmZ9F1ljEgtbgnpTXo-BjMdsYc-RtjAVlTDw8_X4.cache +3 -0
  46. data/spec/tmp/cache/assets/sprockets/v4.0/yLVaD_6Y39Pb9SCT6UJz0274qVlwMLCNbRM_ezjr8Bs.cache +0 -0
  47. metadata +42 -67
  48. data/lib/i18n-js-assets/processor.rb +0 -52
  49. data/spec/public/assets/application-d6fa28795ec5c7b3b893737abd6ca2cf.js +0 -3
  50. data/spec/public/assets/application-d6fa28795ec5c7b3b893737abd6ca2cf.js.gz +0 -0
  51. data/spec/public/assets/application.js +0 -3
  52. data/spec/public/assets/application.js.gz +0 -0
  53. data/spec/public/assets/manifest.yml +0 -7
  54. data/spec/public/assets/translations/precompilable-en-39935f3d64ebd30557b853eb3f26cc83.js +0 -2
  55. data/spec/public/assets/translations/precompilable-en-39935f3d64ebd30557b853eb3f26cc83.js.gz +0 -0
  56. data/spec/public/assets/translations/precompilable-en.js +0 -2
  57. data/spec/public/assets/translations/precompilable-en.js.gz +0 -0
  58. data/spec/public/assets/translations/precompilable-es-3ec410e0a5e1c63b2bec7a9202561344.js +0 -2
  59. data/spec/public/assets/translations/precompilable-es-3ec410e0a5e1c63b2bec7a9202561344.js.gz +0 -0
  60. data/spec/public/assets/translations/precompilable-es.js +0 -2
  61. data/spec/public/assets/translations/precompilable-es.js.gz +0 -0
  62. data/spec/tmp/cache/assets/C7E/4A0/sprockets%2F92acc8cc8471c420b7792611b2675912 +0 -0
  63. data/spec/tmp/cache/assets/CAD/860/sprockets%2Fa85a44d6641c409d31d7502b6992c17d +0 -0
  64. data/spec/tmp/cache/assets/D09/910/sprockets%2Fec4e05546bf2217191d17fc347bb8f22 +0 -0
  65. data/spec/tmp/cache/assets/D39/D70/sprockets%2F7181ba68a415fc0b1979d25b72cd3d5b +0 -0
  66. data/spec/tmp/cache/assets/DC4/F40/sprockets%2Ffbe076c1b419c7511d6f21abbc88f2db +0 -0
  67. data/spec/tmp/cache/assets/DF8/170/sprockets%2F42bee52fb5fcf2bf595cbdec329a2215 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75bcb84e4910f5ce4a265e36faff7e7ab2c8fe6d
4
- data.tar.gz: 4a2c1d11a649c11c5266cbd18ab2182721cf57b3
3
+ metadata.gz: db07535d597f84854b7e7b8df2ce69130b0617b8
4
+ data.tar.gz: 5a4514d91dc7ee69dbc84283b94a1ca2d3845f89
5
5
  SHA512:
6
- metadata.gz: 71f35e8dd89a240550ed2c7c0a581ccaf440f293ba4dc27b3c92aa799aa085739469bdec85a6255aa5075bcaf7c50d96ba9a3f45a7bc1dc493a0292c543b410e
7
- data.tar.gz: 2efb3270eb0d3838eddead2dbdbee9198ed10cdcbcbef8fe34676f9c7d18767962840daed60ed17cc75826c48d547f35c8f3dd7b921ad626625e187b7786f11e
6
+ metadata.gz: a385ea1d76c4787a92086c3619f486696480fd0238a5f7d5534da02c1343c91c098aed72072992887b5f5a39171adef0683857f322f0d0467455f1ba9a4f286d
7
+ data.tar.gz: 5f3edd2d2bd186eb836e23c93f81667b789d946a8a726f6171450f2758cc1b425f59ff4786a1f7e116a25a4294b8b8b5f873a3e509d5e176e0c8b985e677e5e2
data/Gemfile CHANGED
@@ -4,10 +4,13 @@ gemspec
4
4
 
5
5
  if ENV['SPROCKETS_VERSION'].to_f == 4
6
6
  gem 'sprockets', '4.0.0.beta2'
7
+ else
8
+ gem 'sprockets', "~> #{ENV['SPROCKETS_VERSION'] || '3.0'}"
7
9
  end
8
10
 
9
11
  group :development, :test do
10
- gem 'pry-nav'
11
12
  gem 'rake'
12
13
  gem 'rspec'
14
+ gem 'pry-byebug'
15
+ gem 'wwtd'
13
16
  end
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ $:.unshift File.join(File.dirname(__FILE__), 'lib')
5
5
  require 'rubygems' unless ENV['NO_RUBYGEMS']
6
6
 
7
7
  require 'bundler'
8
- require 'pry-nav'
8
+ require 'pry-byebug'
9
9
  require 'rspec/core/rake_task'
10
10
  require 'rubygems/package_task'
11
11
 
@@ -16,14 +16,11 @@ Gem::Specification.new do |s|
16
16
  if ENV['RAILS_VERSION']
17
17
  s.add_dependency 'railties', "~> #{ENV['RAILS_VERSION']}"
18
18
  else
19
- s.add_dependency 'railties', '>= 3.2.0', '< 5'
19
+ s.add_dependency 'railties', '>= 4.0', '< 5'
20
20
  end
21
21
 
22
22
  s.add_dependency 'generated-assets', '~> 1.0'
23
23
  s.add_dependency 'i18n-js'
24
- s.add_dependency 'sprockets-rails'
25
- s.add_dependency 'tilt'
26
- s.add_dependency 'tzinfo'
27
24
 
28
25
  s.require_path = 'lib'
29
26
  s.files = Dir["{lib,spec}/**/*", "Gemfile", "README.md", "Rakefile", "i18n-js-assets.gemspec"]
@@ -1,11 +1,11 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module I18nJsAssets
4
- autoload :Entry, 'i18n-js-assets/entry'
5
- autoload :I18nJsFile, 'i18n-js-assets/i18njs_file'
6
- autoload :Manifest, 'i18n-js-assets/manifest'
7
- autoload :Processor, 'i18n-js-assets/processor'
8
- autoload :Versioning, 'i18n-js-assets/versioning'
4
+ autoload :Entry, 'i18n-js-assets/entry'
5
+ autoload :I18nJsFile, 'i18n-js-assets/i18njs_file'
6
+ autoload :Manifest, 'i18n-js-assets/manifest'
7
+ autoload :Transformer, 'i18n-js-assets/transformer'
8
+ autoload :Versioning, 'i18n-js-assets/versioning'
9
9
  end
10
10
 
11
11
  require 'generated-assets'
@@ -16,35 +16,22 @@ module I18nJsAssets
16
16
  end
17
17
  end
18
18
 
19
- # this is for certain versions of rails 3 and rails 4
20
- config.after_initialize do |app|
21
- begin
22
- app.assets.register_engine('.i18njs', I18nJsAssets::Processor)
23
- rescue
19
+ config.assets.configure do |env|
20
+ if env.respond_to?(:register_transformer)
21
+ env.register_mime_type 'text/i18njs', extensions: ['.i18njs', '.js.i18njs']
22
+ env.register_transformer 'text/i18njs', 'application/javascript', I18nJsAssets::Transformer
24
23
  end
25
- end
26
24
 
27
- # this is for rails 3/4, sprockets < 4
28
- if !sprockets4?
29
- initializer :i18n_js_assets, after: 'sprockets.environment' do |app|
30
- if app.assets
31
- app.assets.register_engine('.i18njs', I18nJsAssets::Processor)
32
- end
33
- end
34
- end
25
+ if env.respond_to?(:register_engine)
26
+ %w(.i18njs .js.i18njs).each do |extension|
27
+ args = [extension, I18nJsAssets::Transformer]
35
28
 
36
- # this is for rails 4, sprockets 4
37
- #
38
- # (in this case the 'sprockets.environment' hook won't fire)
39
- if sprockets4?
40
- config.assets.configure do |env|
41
- i18n_processor_adapter = proc do |params|
42
- processor = I18nJsAssets::Processor.new { params[:data] }
43
- { data: processor.render }
44
- end
29
+ if Sprockets::VERSION.start_with?('3')
30
+ args << { mime_type: 'text/i18njs', silence_deprecation: true }
31
+ end
45
32
 
46
- env.register_mime_type 'text/i18njs', extensions: ['.i18njs', '.js.i18njs']
47
- env.register_transformer 'text/i18njs', 'application/javascript', i18n_processor_adapter
33
+ env.register_engine(*args)
34
+ end
48
35
  end
49
36
  end
50
37
  end
@@ -0,0 +1,66 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'i18n-js'
4
+
5
+ module I18nJsAssets
6
+ class Transformer
7
+ class << self
8
+ def run(filename, source, context)
9
+ options = (YAML.load(source) || {}).with_indifferent_access
10
+ only = options.fetch(:only, '*')
11
+ exceptions = [options.fetch(:except, [])].flatten
12
+
13
+ # handle newer and older versions of i18n-js
14
+ translations = if i18n_js.method(:segment_for_scope).arity == 2
15
+ i18n_js.segment_for_scope(only, exceptions)
16
+ else
17
+ i18n_js.segment_for_scope(only)
18
+ end
19
+
20
+ locales = options.fetch(:locales, translations.keys).map(&:to_sym)
21
+ construct_javascript_from(locales, translations)
22
+ end
23
+
24
+ def call(input)
25
+ filename = input[:filename]
26
+ source = input[:data]
27
+ context = input[:environment].context_class.new(input)
28
+
29
+ result = run(filename, source, context)
30
+ context.metadata.merge(data: result)
31
+ end
32
+
33
+ private
34
+
35
+ def construct_javascript_from(locales, translations)
36
+ %(var I18n = I18n || {}; I18n.translations || (I18n.translations = {});\n).tap do |result|
37
+ translations.each_pair do |locale, locale_translations|
38
+ next unless locales.include?(locale)
39
+ result << construct_javascript_for_locale(locale, locale_translations)
40
+ end
41
+ end
42
+ end
43
+
44
+ def construct_javascript_for_locale(locale, translations)
45
+ %{I18n.translations["#{locale}"] = I18n.extend((I18n.translations["#{locale}"] || {}), #{translations.to_json});\n}
46
+ end
47
+
48
+ def i18n_js
49
+ if Kernel.const_defined?(:SimplesIdeias)
50
+ SimplesIdeias::I18n
51
+ else
52
+ I18n::JS
53
+ end
54
+ end
55
+ end
56
+
57
+ def initialize(filename, &block)
58
+ @filename = filename
59
+ @source = block.call
60
+ end
61
+
62
+ def render(context, empty_hash_wtf)
63
+ self.class.run(@filename, @source, context)
64
+ end
65
+ end
66
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module I18nJsAssets
4
- VERSION = '1.3.0'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -4,18 +4,6 @@ require 'sprockets/version'
4
4
 
5
5
  module I18nJsAssets
6
6
  module Versioning
7
- def rails3?
8
- defined?(Rails) &&
9
- Rails::VERSION::STRING.to_f >= 3 &&
10
- Rails::VERSION::STRING.to_f < 4
11
- end
12
-
13
- def rails4?
14
- defined?(Rails) &&
15
- Rails::VERSION::STRING.to_f >= 4 &&
16
- Rails::VERSION::STRING.to_f < 5
17
- end
18
-
19
7
  def sprockets4?
20
8
  defined?(Sprockets) &&
21
9
  Sprockets::VERSION.to_f >= 4 &&
@@ -0,0 +1,3 @@
1
+ // Sprockets 4 expects this file to exist
2
+ //
3
+ //= link_to application.js
@@ -0,0 +1,2 @@
1
+ var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
+ I18n.translations["en"] = I18n.extend((I18n.translations["en"] || {}), {"my_app":{"teapot":"I'm a little teapot"}});
@@ -0,0 +1,2 @@
1
+ var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
+ I18n.translations["es"] = I18n.extend((I18n.translations["es"] || {}), {"my_app":{"teapot":"Soy una tetera pequeña"}});
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'rake'
4
4
  require 'rspec'
5
5
  require 'fileutils'
6
- require 'pry-nav'
6
+ require 'pry-byebug'
7
7
 
8
8
  require 'rails'
9
9
  require 'sprockets/railtie'
@@ -0,0 +1 @@
1
+ I"�app/assets/config/manifest.js?type=application/javascript&pipeline=source&id=44e23c7d477b3801ffb334be2b892f88408ff5df9585ed03010be030af20994e:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Aprocessors:type=application/javascript&file_type=text/i18njs;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs;TTI"Oprocessors:type=application/javascript&file_type=text/i18njs&pipeline=self;TT
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Fprocessors:type=text/i18njs&file_type=text/i18njs&pipeline=source;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs;TT
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Oprocessors:type=application/javascript&file_type=text/i18njs&pipeline=self;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs;TT
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Fprocessors:type=text/i18njs&file_type=text/i18njs&pipeline=source;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs;TT
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Oprocessors:type=application/javascript&file_type=text/i18njs&pipeline=self;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs;TT
@@ -0,0 +1 @@
1
+ "%���n�����������uN��e���Ee����
@@ -0,0 +1 @@
1
+ "%�!?�w2Osl��q�3[i�[��7�sF�����
@@ -0,0 +1 @@
1
+ I"�app/assets/config/manifest.js?type=application/javascript&pipeline=self&id=bbc8db45681822a776f61a4c9a5f24b0abd5746efcacbdf308d094582ad17e22:ET
@@ -0,0 +1 @@
1
+ I"�/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs?type=text/i18njs&pipeline=source&id=d56aca214d3bf4d47a343f0e8be9efa956299eacf7661a93e19847a76e9e15aa:ET
@@ -0,0 +1 @@
1
+ I"}app/assets/config/manifest.js?type=application/javascript&id=945f81a378585d04ac841beb7b01ebb46eecfec6e43a823e4550e2b14be78bd4:ET
@@ -0,0 +1 @@
1
+ I"�/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs?type=application/javascript&id=75873e1992593ca1b4b8e1245b8c65944ca9cce87c62a035fb948dbc8b84cc8b:ET
@@ -0,0 +1 @@
1
+ I"�/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs?type=application/javascript&pipeline=self&id=406c97d9f442ebad303306e01d71952de0d991d0d7581035099c8df31eb3aeb2:ET
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"\processors:type=application/javascript&file_type=application/javascript&pipeline=source;TTI"0file-digest://app/assets/config/manifest.js;TT
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash{
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"0file-digest://app/assets/config/manifest.js;TT
@@ -0,0 +1,3 @@
1
+ {:uriI"�file:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs?type=text/i18njs&pipeline=source&id=dffdbcd3881abb62c972ffbe8fbac8a222ed653c49a8dbaedb10a74adab73a92:ET:load_pathI"S/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets;T:
2
+ @hash{
3
+ I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"Fprocessors:type=text/i18njs&file_type=text/i18njs&pipeline=source;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs;TT:dependencies_digest"%q^s�O/�>�����t���;]�:~����t:idI"Edffdbcd3881abb62c972ffbe8fbac8a222ed653c49a8dbaedb10a74adab73a92;F
@@ -0,0 +1 @@
1
+ I"�/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs?type=application/javascript&pipeline=self&id=a9b419fc89705e25027b93b8e047f8f99291dd53c467d4e6b0a496368abc9b4f:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"0file-digest://app/assets/config/manifest.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TT
@@ -0,0 +1 @@
1
+ I"�/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs?type=text/i18njs&pipeline=source&id=dffdbcd3881abb62c972ffbe8fbac8a222ed653c49a8dbaedb10a74adab73a92:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Aprocessors:type=application/javascript&file_type=text/i18njs;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs;TTI"Oprocessors:type=application/javascript&file_type=text/i18njs&pipeline=self;TT
@@ -0,0 +1 @@
1
+ I"�/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-en.js.i18njs?type=application/javascript&id=63f35e3a02d966be685159cc473431071c6949f3866593afe88e56ad735764f1:ET
@@ -0,0 +1,3 @@
1
+ {:uriI"�file:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs?type=text/i18njs&pipeline=source&id=d56aca214d3bf4d47a343f0e8be9efa956299eacf7661a93e19847a76e9e15aa:ET:load_pathI"S/var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets;T:
2
+ @hash{
3
+ I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"Fprocessors:type=text/i18njs&file_type=text/i18njs&pipeline=source;TTI"�file-digest:///var/folders/ls/3sjzmycd3h5dpsp_fs9_8zjr0000gp/T/generated-assets/I18nJsAssets/translations/precompilable-es.js.i18njs;TT:dependencies_digest"%Ϳq�d�%�.�L���Xz@�3Z�Ex��0|$W:idI"Ed56aca214d3bf4d47a343f0e8be9efa956299eacf7661a93e19847a76e9e15aa;F
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-js-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: '4.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.0
29
+ version: '4.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5'
@@ -58,48 +58,6 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
- - !ruby/object:Gem::Dependency
62
- name: sprockets-rails
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: tilt
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: tzinfo
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :runtime
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
61
  description: Compile your Javascript translations using the asset pipeline instead
104
62
  of rake tasks.
105
63
  email:
@@ -116,8 +74,8 @@ files:
116
74
  - lib/i18n-js-assets/entry.rb
117
75
  - lib/i18n-js-assets/i18njs_file.rb
118
76
  - lib/i18n-js-assets/manifest.rb
119
- - lib/i18n-js-assets/processor.rb
120
77
  - lib/i18n-js-assets/railtie.rb
78
+ - lib/i18n-js-assets/transformer.rb
121
79
  - lib/i18n-js-assets/version.rb
122
80
  - lib/i18n-js-assets/versioning.rb
123
81
  - spec/app/assets/config/manifest.js
@@ -137,26 +95,43 @@ files:
137
95
  - spec/log/test.log
138
96
  - spec/manifest_spec.rb
139
97
  - spec/precomp_spec.rb
140
- - spec/public/assets/application-d6fa28795ec5c7b3b893737abd6ca2cf.js
141
- - spec/public/assets/application-d6fa28795ec5c7b3b893737abd6ca2cf.js.gz
142
- - spec/public/assets/application.js
143
- - spec/public/assets/application.js.gz
144
- - spec/public/assets/manifest.yml
145
- - spec/public/assets/translations/precompilable-en-39935f3d64ebd30557b853eb3f26cc83.js
146
- - spec/public/assets/translations/precompilable-en-39935f3d64ebd30557b853eb3f26cc83.js.gz
147
- - spec/public/assets/translations/precompilable-en.js
148
- - spec/public/assets/translations/precompilable-en.js.gz
149
- - spec/public/assets/translations/precompilable-es-3ec410e0a5e1c63b2bec7a9202561344.js
150
- - spec/public/assets/translations/precompilable-es-3ec410e0a5e1c63b2bec7a9202561344.js.gz
151
- - spec/public/assets/translations/precompilable-es.js
152
- - spec/public/assets/translations/precompilable-es.js.gz
98
+ - spec/public/assets/manifest-68a410d3a5a03cfa0d005ad402cc2b2fa882c3fed819f8c16c1c9d764ebd2d70.js
99
+ - spec/public/assets/manifest-68a410d3a5a03cfa0d005ad402cc2b2fa882c3fed819f8c16c1c9d764ebd2d70.js.gz
100
+ - spec/public/assets/translations/precompilable-en-fae6bbf0494f8deb67a50f0b5204a012e842f6416ff15acad11004c348e53841.js
101
+ - spec/public/assets/translations/precompilable-en-fae6bbf0494f8deb67a50f0b5204a012e842f6416ff15acad11004c348e53841.js.gz
102
+ - spec/public/assets/translations/precompilable-es-cba1bab30b88a6554da68bff125cdd4073ec6a7529a25732afb3850cbc307005.js
103
+ - spec/public/assets/translations/precompilable-es-cba1bab30b88a6554da68bff125cdd4073ec6a7529a25732afb3850cbc307005.js.gz
153
104
  - spec/spec_helper.rb
154
- - spec/tmp/cache/assets/C7E/4A0/sprockets%2F92acc8cc8471c420b7792611b2675912
155
- - spec/tmp/cache/assets/CAD/860/sprockets%2Fa85a44d6641c409d31d7502b6992c17d
156
- - spec/tmp/cache/assets/D09/910/sprockets%2Fec4e05546bf2217191d17fc347bb8f22
157
- - spec/tmp/cache/assets/D39/D70/sprockets%2F7181ba68a415fc0b1979d25b72cd3d5b
158
- - spec/tmp/cache/assets/DC4/F40/sprockets%2Ffbe076c1b419c7511d6f21abbc88f2db
159
- - spec/tmp/cache/assets/DF8/170/sprockets%2F42bee52fb5fcf2bf595cbdec329a2215
105
+ - spec/tmp/cache/assets/sprockets/v4.0/1SDQIQhED2byWZvSa6AeYKVPSJ-mdz_JEDY7pBm_ZzI.cache
106
+ - spec/tmp/cache/assets/sprockets/v4.0/2tbxV5AUnVkRwT6eRFGS3hW2RdruaesgBYixFWuJUoI.cache
107
+ - spec/tmp/cache/assets/sprockets/v4.0/5aqFWxRGSrWsBT0SSrvNXDevT7L9fdRxPrw39aocBes.cache
108
+ - spec/tmp/cache/assets/sprockets/v4.0/5dOGbMjZOu3MTGdjlvIRU6ih-aSh0kqvrK2e9uj63sM.cache
109
+ - spec/tmp/cache/assets/sprockets/v4.0/6SdkV7Dt8Cwo6VNGpQ8KV2WoKrEs55vJFoIdPH9JOdE.cache
110
+ - spec/tmp/cache/assets/sprockets/v4.0/9E6VuRR__yGyIFlgjrjLxBeoR6cqZNJgPstY5KXPaFA.cache
111
+ - spec/tmp/cache/assets/sprockets/v4.0/AOEc3me3ZXkDjiGrtLqkjWuq9VPreWo9mszqn_aOnaM.cache
112
+ - spec/tmp/cache/assets/sprockets/v4.0/B83SLy4L82OQbBOGrxDQzmA3oWoPw143tMDXWXCVxrU.cache
113
+ - spec/tmp/cache/assets/sprockets/v4.0/CbonGaQzCZNPpO7v3iSqCnDXerU89Cxaqkh2JJ-Ze-Y.cache
114
+ - spec/tmp/cache/assets/sprockets/v4.0/DNg-2Ul4PYLhmkdj9mgGearPCXjNT809_R7V53qD2HE.cache
115
+ - spec/tmp/cache/assets/sprockets/v4.0/DobpGxO3crUb-zrMjXsl3Wnv7xPkSUT-uwbgSIeEMso.cache
116
+ - spec/tmp/cache/assets/sprockets/v4.0/Ouq5xqJJWNNCjunjwA7luluJvW91iTgnneP9UysQTno.cache
117
+ - spec/tmp/cache/assets/sprockets/v4.0/SPqPSfOB-NOB_thUv6KhrBHTh0UQzCexF5EWYE09miU.cache
118
+ - spec/tmp/cache/assets/sprockets/v4.0/T26iayzsnISAo_2iEpHOCaAfuHN93Tb_2EDx1kHRKJg.cache
119
+ - spec/tmp/cache/assets/sprockets/v4.0/V1sSmTvDskWdDMh6nGQh5-d4Wkb_L1pQ0iSqIPRAEQQ.cache
120
+ - spec/tmp/cache/assets/sprockets/v4.0/WuyjArU0CSrtZEmy8lsbS69ntCsY6Sq4Dao622Dt9fA.cache
121
+ - spec/tmp/cache/assets/sprockets/v4.0/ZTGnDmBFMNdHn7VjIOkFm9Sk0F4bATd2QSOX6scgCyE.cache
122
+ - spec/tmp/cache/assets/sprockets/v4.0/_q0-g1GCOh1Gcakry0QSvObw3raYMB5qoVf8RQhFMtA.cache
123
+ - spec/tmp/cache/assets/sprockets/v4.0/g6GVwheH6OPS1PU_Y3lhW5m64sBqRf1ZCprpx5dMAEc.cache
124
+ - spec/tmp/cache/assets/sprockets/v4.0/h2LRwpJ3QnXQVBgpHq906Noj_bmTkybfaM5YOsHHIEM.cache
125
+ - spec/tmp/cache/assets/sprockets/v4.0/lzl0tzfmpAoVlfKT3cv7wu4aYD0U4fdvzlP6wDXkeD4.cache
126
+ - spec/tmp/cache/assets/sprockets/v4.0/mC3Q5h9GORDmDRMMliPZXjZ74HdlKkjgv5gXLkbGL6M.cache
127
+ - spec/tmp/cache/assets/sprockets/v4.0/nfiNGvvalGdYHk7YCi86xBut-A4xAjXPSWN4F3RSlHc.cache
128
+ - spec/tmp/cache/assets/sprockets/v4.0/np_lokrnYrcb__gYX2KuBHh8CIaF-OEYTKUh0yQIwJg.cache
129
+ - spec/tmp/cache/assets/sprockets/v4.0/q3Wi-dMbjBO3bPG9D1ZTovpF61Kw-9jG7B8f_MmWwIc.cache
130
+ - spec/tmp/cache/assets/sprockets/v4.0/qs087m9fdmSy3x9qOCSOlrtQfMKvKk2xKSjNTZC2bbA.cache
131
+ - spec/tmp/cache/assets/sprockets/v4.0/reIwGCVu3xKhgE8f8xUGUgbK0miVUzGAew-99jvqQ6s.cache
132
+ - spec/tmp/cache/assets/sprockets/v4.0/sxg4aL2KRzvmK8wKPnQq-6ZXsiIRrWQpolu9PwijqKA.cache
133
+ - spec/tmp/cache/assets/sprockets/v4.0/u4WQmZ9F1ljEgtbgnpTXo-BjMdsYc-RtjAVlTDw8_X4.cache
134
+ - spec/tmp/cache/assets/sprockets/v4.0/yLVaD_6Y39Pb9SCT6UJz0274qVlwMLCNbRM_ezjr8Bs.cache
160
135
  homepage: http://github.com/camertron
161
136
  licenses: []
162
137
  metadata: {}
@@ -176,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
151
  version: '0'
177
152
  requirements: []
178
153
  rubyforge_project:
179
- rubygems_version: 2.2.3
154
+ rubygems_version: 2.6.6
180
155
  signing_key:
181
156
  specification_version: 4
182
157
  summary: Compile your Javascript translations using the asset pipeline instead of
@@ -1,52 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'tilt'
4
- require 'i18n-js'
5
-
6
- module I18nJsAssets
7
- class Processor < ::Tilt::Template
8
- def prepare
9
- # noop
10
- end
11
-
12
- def evaluate(scope, locals)
13
- options = (YAML.load(data) || {}).with_indifferent_access
14
- only = options.fetch(:only, '*')
15
- exceptions = [options.fetch(:except, [])].flatten
16
-
17
- # handle newer and older versions of i18n-js
18
- translations = if i18n_js.method(:segment_for_scope).arity == 2
19
- i18n_js.segment_for_scope(only, exceptions)
20
- else
21
- i18n_js.segment_for_scope(only)
22
- end
23
-
24
- locales = options.fetch(:locales, translations.keys).map(&:to_sym)
25
-
26
- construct_javascript_from(locales, translations)
27
- end
28
-
29
- private
30
-
31
- def construct_javascript_from(locales, translations)
32
- %(var I18n = I18n || {}; I18n.translations || (I18n.translations = {});\n).tap do |result|
33
- translations.each_pair do |locale, locale_translations|
34
- next unless locales.include?(locale)
35
- result << construct_javascript_for_locale(locale, locale_translations)
36
- end
37
- end
38
- end
39
-
40
- def construct_javascript_for_locale(locale, translations)
41
- %{I18n.translations["#{locale}"] = I18n.extend((I18n.translations["#{locale}"] || {}), #{translations.to_json});\n}
42
- end
43
-
44
- def i18n_js
45
- if Kernel.const_defined?(:SimplesIdeias)
46
- SimplesIdeias::I18n
47
- else
48
- I18n::JS
49
- end
50
- end
51
- end
52
- end
@@ -1,3 +0,0 @@
1
- var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
- I18n.translations["en"] = {"my_app":{"teapot":"I'm a little teapot"}};
3
- I18n.translations["es"] = {"my_app":{"teapot":"Soy una tetera peque\u00f1a"}};
@@ -1,3 +0,0 @@
1
- var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
- I18n.translations["en"] = {"my_app":{"teapot":"I'm a little teapot"}};
3
- I18n.translations["es"] = {"my_app":{"teapot":"Soy una tetera peque\u00f1a"}};
Binary file
@@ -1,7 +0,0 @@
1
- ---
2
- application.js: application-d6fa28795ec5c7b3b893737abd6ca2cf.js
3
- application/index.js: application-d6fa28795ec5c7b3b893737abd6ca2cf.js
4
- translations/precompilable-en.js: translations/precompilable-en-39935f3d64ebd30557b853eb3f26cc83.js
5
- translations/precompilable-en/index.js: translations/precompilable-en-39935f3d64ebd30557b853eb3f26cc83.js
6
- translations/precompilable-es.js: translations/precompilable-es-3ec410e0a5e1c63b2bec7a9202561344.js
7
- translations/precompilable-es/index.js: translations/precompilable-es-3ec410e0a5e1c63b2bec7a9202561344.js
@@ -1,2 +0,0 @@
1
- var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
- I18n.translations["en"] = {"my_app":{"teapot":"I'm a little teapot"}};
@@ -1,2 +0,0 @@
1
- var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
- I18n.translations["en"] = {"my_app":{"teapot":"I'm a little teapot"}};
@@ -1,2 +0,0 @@
1
- var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
- I18n.translations["es"] = {"my_app":{"teapot":"Soy una tetera peque\u00f1a"}};
@@ -1,2 +0,0 @@
1
- var I18n = I18n || {}; I18n.translations || (I18n.translations = {});
2
- I18n.translations["es"] = {"my_app":{"teapot":"Soy una tetera peque\u00f1a"}};