asset_pipeline_i18n 3.2.13.2 → 4.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 38bc9d286834fb71ea0644d8b31a6fa1c08605ab
4
+ data.tar.gz: 1f0f8ca5d45929b326a0ec8aa43d658fc65d538a
5
+ SHA512:
6
+ metadata.gz: ef68badd20699c1e43ee8cef7f4bd73c5bab2f56c1797b7744ede611898597ae5d9499ec6255c31436f2a295f8ff5b6cbf8ade1bb7375a8f83416a1702b27a17
7
+ data.tar.gz: 2e4039f008c1f99405a4e435aaa9e854c17e7110948c0bd961b798220e60325a9a11e894928c0ce59c60775d5528354508d1167a908a0a31e2604ec18cc48f8a
data/Gemfile.lock CHANGED
@@ -1,88 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asset_pipeline_i18n (3.2.13.2)
5
- rails (~> 3.2.13)
4
+ asset_pipeline_i18n (4.0.1.0)
5
+ rails (~> 4.0.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.14)
11
- actionpack (= 3.2.14)
10
+ actionmailer (4.0.1)
11
+ actionpack (= 4.0.1)
12
12
  mail (~> 2.5.4)
13
- actionpack (3.2.14)
14
- activemodel (= 3.2.14)
15
- activesupport (= 3.2.14)
16
- builder (~> 3.0.0)
13
+ actionpack (4.0.1)
14
+ activesupport (= 4.0.1)
15
+ builder (~> 3.1.0)
17
16
  erubis (~> 2.7.0)
18
- journey (~> 1.0.4)
19
- rack (~> 1.4.5)
20
- rack-cache (~> 1.2)
21
- rack-test (~> 0.6.1)
22
- sprockets (~> 2.2.1)
23
- activemodel (3.2.14)
24
- activesupport (= 3.2.14)
25
- builder (~> 3.0.0)
26
- activerecord (3.2.14)
27
- activemodel (= 3.2.14)
28
- activesupport (= 3.2.14)
29
- arel (~> 3.0.2)
30
- tzinfo (~> 0.3.29)
31
- activeresource (3.2.14)
32
- activemodel (= 3.2.14)
33
- activesupport (= 3.2.14)
34
- activesupport (3.2.14)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ activemodel (4.0.1)
20
+ activesupport (= 4.0.1)
21
+ builder (~> 3.1.0)
22
+ activerecord (4.0.1)
23
+ activemodel (= 4.0.1)
24
+ activerecord-deprecated_finders (~> 1.0.2)
25
+ activesupport (= 4.0.1)
26
+ arel (~> 4.0.0)
27
+ activerecord-deprecated_finders (1.0.3)
28
+ activesupport (4.0.1)
35
29
  i18n (~> 0.6, >= 0.6.4)
36
- multi_json (~> 1.0)
37
- arel (3.0.2)
38
- builder (3.0.4)
30
+ minitest (~> 4.2)
31
+ multi_json (~> 1.3)
32
+ thread_safe (~> 0.1)
33
+ tzinfo (~> 0.3.37)
34
+ arel (4.0.1)
35
+ atomic (1.1.14)
36
+ builder (3.1.4)
39
37
  erubis (2.7.0)
40
38
  hike (1.2.3)
41
39
  i18n (0.6.5)
42
- journey (1.0.4)
43
- json (1.8.0)
44
40
  mail (2.5.4)
45
41
  mime-types (~> 1.16)
46
42
  treetop (~> 1.4.8)
47
43
  mime-types (1.25)
48
- multi_json (1.7.9)
44
+ minitest (4.7.5)
45
+ multi_json (1.8.2)
49
46
  polyglot (0.3.3)
50
- rack (1.4.5)
51
- rack-cache (1.2)
52
- rack (>= 0.4)
53
- rack-ssl (1.3.3)
54
- rack
47
+ rack (1.5.2)
55
48
  rack-test (0.6.2)
56
49
  rack (>= 1.0)
57
- rails (3.2.14)
58
- actionmailer (= 3.2.14)
59
- actionpack (= 3.2.14)
60
- activerecord (= 3.2.14)
61
- activeresource (= 3.2.14)
62
- activesupport (= 3.2.14)
63
- bundler (~> 1.0)
64
- railties (= 3.2.14)
65
- railties (3.2.14)
66
- actionpack (= 3.2.14)
67
- activesupport (= 3.2.14)
68
- rack-ssl (~> 1.3.2)
50
+ rails (4.0.1)
51
+ actionmailer (= 4.0.1)
52
+ actionpack (= 4.0.1)
53
+ activerecord (= 4.0.1)
54
+ activesupport (= 4.0.1)
55
+ bundler (>= 1.3.0, < 2.0)
56
+ railties (= 4.0.1)
57
+ sprockets-rails (~> 2.0.0)
58
+ railties (4.0.1)
59
+ actionpack (= 4.0.1)
60
+ activesupport (= 4.0.1)
69
61
  rake (>= 0.8.7)
70
- rdoc (~> 3.4)
71
- thor (>= 0.14.6, < 2.0)
62
+ thor (>= 0.18.1, < 2.0)
72
63
  rake (10.1.0)
73
- rdoc (3.12.2)
74
- json (~> 1.4)
75
- sprockets (2.2.2)
64
+ sprockets (2.10.0)
76
65
  hike (~> 1.2)
77
66
  multi_json (~> 1.0)
78
67
  rack (~> 1.0)
79
68
  tilt (~> 1.1, != 1.3.0)
69
+ sprockets-rails (2.0.1)
70
+ actionpack (>= 3.0)
71
+ activesupport (>= 3.0)
72
+ sprockets (~> 2.8)
80
73
  thor (0.18.1)
74
+ thread_safe (0.1.3)
75
+ atomic
81
76
  tilt (1.4.1)
82
77
  treetop (1.4.15)
83
78
  polyglot
84
79
  polyglot (>= 0.3.1)
85
- tzinfo (0.3.37)
80
+ tzinfo (0.3.38)
86
81
 
87
82
  PLATFORMS
88
83
  ruby
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- s.add_runtime_dependency "rails", "~> 3.2.13"
22
+ s.add_runtime_dependency "rails", "~> 4.0.1"
23
23
  end
@@ -1,5 +1,2 @@
1
1
  require 'asset_pipeline_i18n/version'
2
-
3
- module AssetPipelineI18n
4
- require 'asset_pipeline_i18n/railtie' if defined?(Rails)
5
- end
2
+ require 'asset_pipeline_i18n/railtie'
@@ -1,11 +1,52 @@
1
- require 'asset_pipeline_i18n'
2
1
  require 'rails'
2
+ require 'sprockets/rails/task'
3
+
3
4
  module AssetPipelineI18n
4
5
  class Railtie < Rails::Railtie
5
- railtie_name :asset_pipeline_i18n
6
+ initializer "asset_pipeline_i18n.initialization" do
7
+ Sprockets::Rails::Task.new(Rails.application) do |t|
8
+ #
9
+ # predefined methods we need to customize
10
+ #
11
+
12
+ def t.assets
13
+ Rails.configuration.localized_assets.map{ |name| name % {:locale => I18n.locale} }
14
+ end
15
+
16
+ def t.define
17
+ # This implementation gets called in addition to the original implementation
18
+ # when executing the rake task
19
+ namespace :assets do
20
+ desc "Compile all the assets named in config.assets.precompile"
21
+ task :precompile => :environment do
22
+ I18n.available_locales.each do |locale|
23
+ Rails.logger.info "Compiling assets for locale #{locale}..."
24
+ I18n.locale = locale
25
+ with_logger do
26
+ clean_cache
27
+ manifest.compile(assets)
28
+ end
29
+ end
30
+
31
+ I18n.locale = I18n.default_locale
32
+ Rails.logger.info "Reset locale to default of #{I18n.locale}..."
33
+ end
34
+ end
35
+ end
36
+
37
+ #
38
+ # new methods for better code structure on our side
39
+ #
6
40
 
7
- rake_tasks do
8
- load "tasks/assets_i18n.rake"
41
+ def t.clean_cache
42
+ env = manifest.environment
43
+ def env.expire_index!
44
+ @assets.clear
45
+ end
46
+ manifest.environment.send(:expire_index!)
47
+ rm_rf(cache_path)
48
+ end
49
+ end
9
50
  end
10
51
  end
11
52
  end
@@ -1,3 +1,3 @@
1
1
  module AssetPipelineI18n
2
- VERSION = "3.2.13.2"
2
+ VERSION = "4.0.1.0"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_pipeline_i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.13.2
5
- prerelease:
4
+ version: 4.0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nicola Piccinini
@@ -10,24 +9,22 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-09-03 00:00:00.000000000 Z
12
+ date: 2013-11-16 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
22
- version: 3.2.13
20
+ version: 4.0.1
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
30
- version: 3.2.13
27
+ version: 4.0.1
31
28
  description: Localized precompiled assets for Rails
32
29
  email:
33
30
  - nicola.piccinini@simplificator.com
@@ -47,29 +44,27 @@ files:
47
44
  - lib/asset_pipeline_i18n.rb
48
45
  - lib/asset_pipeline_i18n/railtie.rb
49
46
  - lib/asset_pipeline_i18n/version.rb
50
- - lib/tasks/assets_i18n.rake
51
47
  homepage: https://github.com/simplificator/asset_pipeline_i18n
52
48
  licenses: []
49
+ metadata: {}
53
50
  post_install_message:
54
51
  rdoc_options: []
55
52
  require_paths:
56
53
  - lib
57
54
  required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
55
  requirements:
60
- - - ! '>='
56
+ - - '>='
61
57
  - !ruby/object:Gem::Version
62
58
  version: '0'
63
59
  required_rubygems_version: !ruby/object:Gem::Requirement
64
- none: false
65
60
  requirements:
66
- - - ! '>='
61
+ - - '>='
67
62
  - !ruby/object:Gem::Version
68
63
  version: '0'
69
64
  requirements: []
70
65
  rubyforge_project: asset_pipeline_i18n
71
- rubygems_version: 1.8.25
66
+ rubygems_version: 2.1.11
72
67
  signing_key:
73
- specification_version: 3
68
+ specification_version: 4
74
69
  summary: Localized precompiled assets for Rails
75
70
  test_files: []
@@ -1,99 +0,0 @@
1
- # https://github.com/rails/rails/blob/v3.2.14/actionpack/lib/sprockets/assets.rake
2
- namespace :assets do
3
- namespace :precompile do
4
- def internal_precompile(digest = nil)
5
- # we have to reinvoke the rask task as we need a clean sprockets env
6
- # this sucks, but well, cannot be changed due to design flaws in rails/ sprockets...
7
- i18n_assets_grouped_by_locale.keys.each do |locale|
8
- ENV['DIGEST'] = digest.nil? ? "true" : "false"
9
- ENV['LOCALE'] = locale
10
- ruby_rake_task "assets:precompile:localized"
11
- end
12
-
13
- # merge manifests on second (last) precompile run
14
- merge_precompiled_assets if digest == false
15
- end
16
-
17
- def internal_precompile_i18n(assets, locale, digest = nil)
18
- puts "Precompiling assets with locale #{locale}..."
19
- I18n.locale = locale
20
-
21
- unless Rails.application.config.assets.enabled
22
- warn "Cannot precompile assets if sprockets is disabled. Please set config.assets.enabled to true"
23
- exit
24
- end
25
-
26
- # Ensure that action view is loaded and the appropriate
27
- # sprockets hooks get executed
28
- _ = ActionView::Base
29
-
30
- config = Rails.application.config
31
- config.assets.compile = true
32
- config.assets.digest = digest unless digest.nil?
33
- config.assets.digests = {}
34
-
35
- env = Rails.application.assets
36
- target = File.join(tmp_path, locale)
37
- Sprockets::StaticCompiler.new(env, target, assets, :manifest_path => config.assets.manifest, :digest => config.assets.digest, :manifest => digest.nil?).compile
38
- end
39
-
40
- def i18n_assets_grouped_by_locale
41
- Rails.application.config.assets.localized_precompile.map{ |name| {:name => name, :locale => name.match(/-([a-z]+)\./)[1]} }.group_by{ |v| v[:locale] }.each_value{ |g| g.map!{ |i| i[:name] } }
42
- end
43
-
44
- def precompile_assets(locale, digest)
45
- assets = i18n_assets_grouped_by_locale[locale]
46
- assets.concat(Rails.application.config.assets.precompile) if I18n.default_locale.to_s == locale
47
- internal_precompile_i18n(assets, locale, digest)
48
- end
49
-
50
- def manifest_filename
51
- Rails.application.config.assets.manifest || "manifest.yml"
52
- end
53
-
54
- def real_path
55
- File.join(Rails.public_path, Rails.application.config.assets.prefix)
56
- end
57
-
58
- def tmp_path
59
- File.join(real_path, "tmp")
60
- end
61
-
62
- def merge_precompiled_assets
63
- puts "Building manifest..."
64
- manifest = {}
65
-
66
- i18n_assets_grouped_by_locale.keys.each do |locale|
67
- root_path = File.join(tmp_path, locale)
68
- Dir[File.join(root_path, *(["/**"]*10))].each do |src_path|
69
- dst_path = File.join(real_path, src_path[(root_path.length + 1)..-1])
70
-
71
- name = File.basename(src_path)
72
- folder = File.dirname(src_path)
73
- if name == manifest_filename
74
- File.open(src_path, "rb") do |f|
75
- manifest.merge!(YAML::load(f))
76
- end
77
- next
78
- end
79
-
80
- if File.directory?(src_path)
81
- FileUtils.mkdir(dst_path) unless File.exists?(dst_path)
82
- else
83
- FileUtils.cp(src_path, dst_path)
84
- end
85
- end
86
- end
87
-
88
- File.open(File.join(real_path, manifest_filename), "wb") do |f|
89
- YAML.dump(manifest, f)
90
- end
91
-
92
- FileUtils.rm_r(tmp_path)
93
- end
94
-
95
- task :localized => ["assets:environment", "tmp:cache:clear"] do
96
- precompile_assets(ENV['LOCALE'], (ENV['DIGEST'] == "true") ? nil : false)
97
- end
98
- end
99
- end