i18n-assets 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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTMzNDI4MjY4M2ZmZjgyMTZlZDk3NzMzYWQwYTlkMjMyNjQ3YjFhMw==
4
+ NmViNjBlODE1MzZiNjZlYzllN2ViYTZlMTJlYzdhNGVjMWI0OTk5OQ==
5
5
  data.tar.gz: !binary |-
6
- YjI0NGY4ZDk2ZDczYWRhYTM0ZGRlMTY1YzEyZTYwMjkwZWQ0MWY3Yw==
6
+ ZWIwODk5ZjU1M2RkMmIxNjNmZWEzNzk5Y2ViMmVlODcyMmE2MDdlOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjMwMmRkZWI1NjY2YzZhZjM5MWI2ZDljZTNhMGEyYTg3Njg2NzFkZjJhOWM3
10
- YjRiMDA1MWYwMTdkNTNkMGQ3OWJmNmZiMmExOWJhMTJjNTliYTM1MmQ3MGI5
11
- OTllMTYyMThjZWY1MjI4N2E1MjQ4ODdhMzhkMzA3ZmM0OGRkMDc=
9
+ NTEyNDdhMWVmOTQ3ZWRmMTEwZjgyMGViMTJhZTFjZWEyN2NjNjE2ZmZhZDUx
10
+ MzE5Y2ZlOGViZWZkMzFkOTNhNDRjZjY2YjU3ODQwOThjYmFmMjRjNTVkNTBl
11
+ ZThkOTNlYzE0YTYzMzdkN2Y1NjEzMDI2OGY1MjRmNmQzYTc0ZmM=
12
12
  data.tar.gz: !binary |-
13
- MzI5ZTlhNTBkMTdkYWNiYzVkYmUwODY5M2I4OWMyMTkzODg2MzEyYzI5NTI3
14
- Y2Q4NTQ1Njg5NDUzZGVmY2I0ZDZjMjZiMTdlNmJmYjY0NGI1NDlmMDUyYWZj
15
- ZWUxNTQ1N2ZhNWI3NDlkOWE3OWU2NjgzZmFlZDA0ZDNkYzdmMTc=
13
+ ODlkM2ZlZDEwMzA0YzAyNjBkNTZiOTI2YWFlZTU4MDdjNGEyODM5ZmJiZDNj
14
+ MjMwOWE5YTJiNWM5N2U3ZWQ4ZWM3NGU1N2ZiODgxMzcyYTA3M2U0ZTRkMzQ0
15
+ ZDUyYmUxYjgyYmU2ZWFmOTg5NmMyZTRkZjUxMTRkN2NiZjlhMDg=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- i18n-assets (0.0.4)
4
+ i18n-assets (0.0.5)
5
5
  actionpack (~> 3.2.18)
6
6
  sprockets (~> 2.2.2)
7
7
 
@@ -5,6 +5,7 @@ unless defined?(Sprockets::LOCALIZABLE_ASSETS_REGEX)
5
5
  LOCALIZABLE_ASSETS_EXT = %w( js css )
6
6
  LOCALIZABLE_ASSETS_REGEX = Regexp.new("\\.(?:#{ LOCALIZABLE_ASSETS_EXT * '|' })")
7
7
  LOCALIZABLE_COMPILABLE_ASSETS_REGEX = Regexp.new("\\.(?:#{ LOCALIZABLE_ASSETS_EXT * '|' })\\..+$")
8
+ GLOBAL_ASSET_REGEX = /^(https?)?:\/\//
8
9
 
9
10
  module Helpers
10
11
  module RailsHelper
@@ -117,7 +118,7 @@ unless defined?(Sprockets::LOCALIZABLE_ASSETS_REGEX)
117
118
  alias_method :compute_public_path_without_locale, :compute_public_path
118
119
 
119
120
  def compute_public_path(source, dir, options = nil)
120
- source = prepend_locale(source) if file_localizable?(source, options) && !file_already_localized?(source)
121
+ source = prepend_locale(source) if local_resource?(source) && file_localizable?(source, options) && !file_already_localized?(source)
121
122
  compute_public_path_without_locale(source, dir, options)
122
123
  end
123
124
 
@@ -127,6 +128,10 @@ unless defined?(Sprockets::LOCALIZABLE_ASSETS_REGEX)
127
128
  "#{ I18n.locale }/#{ source }"
128
129
  end
129
130
 
131
+ def local_resource?(source)
132
+ source !~ Sprockets::GLOBAL_ASSET_REGEX
133
+ end
134
+
130
135
  def file_localizable?(source, options)
131
136
  source =~ Sprockets::LOCALIZABLE_ASSETS_REGEX || Sprockets::LOCALIZABLE_ASSETS_EXT.include?(options.try(:[], :ext))
132
137
  end
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Assets
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Gladkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler