webpack-pipeline 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/webpack-pipeline.rb +2 -0
- data/lib/webpack/asset_url_helper.rb +3 -1
- data/lib/webpack/configuration.rb +1 -1
- data/lib/webpack/manifest.rb +18 -19
- data/webpack-pipeline.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9d934bc3b24c9909d1a4c11d581fa0b280cdc7
|
4
|
+
data.tar.gz: 409e58f14a152fa0a3ddb299ee424dfd10a6fb96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50436240cd6e55635e07ec3b17ab11761053468b85eee577a043644f8e1397f4f634a6c8146caf5d73f4e65bd2f7f9519499fe564a712949cb5b24f99b31863a
|
7
|
+
data.tar.gz: 45934c42c1eb1790d157a9c21a646f0b298c5b67a6416cc383350e837b618d51c23e306cfcf8a0dd4d05d5dc0078412cb478b34dbbd2af3ec4d575099ed9e325
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/webpack-pipeline.rb
CHANGED
@@ -4,9 +4,11 @@ module Webpack
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
def compute_asset_path(source, options = {})
|
7
|
-
webpack.asset_url(source) ||
|
7
|
+
webpack.asset_url(source) || fail(ArgumentError, "can't find #{source}")
|
8
8
|
end
|
9
9
|
|
10
|
+
protected
|
11
|
+
|
10
12
|
def webpack
|
11
13
|
@webpack ||= Manifest.instance
|
12
14
|
end
|
data/lib/webpack/manifest.rb
CHANGED
@@ -3,7 +3,7 @@ require 'webpack/configuration'
|
|
3
3
|
module Webpack
|
4
4
|
class Manifest
|
5
5
|
include Singleton
|
6
|
-
|
6
|
+
|
7
7
|
cattr_reader :configuration do
|
8
8
|
@configuration ||= Configuration.new
|
9
9
|
end
|
@@ -12,14 +12,8 @@ module Webpack
|
|
12
12
|
yield configuration
|
13
13
|
end
|
14
14
|
|
15
|
-
def asset_url(
|
16
|
-
|
17
|
-
ext = filename.split('.').last
|
18
|
-
chunk = [*data['assetsByChunkName'][name]]
|
19
|
-
|
20
|
-
asset_name = chunk.find { |asset|
|
21
|
-
asset.end_with? ext
|
22
|
-
}
|
15
|
+
def asset_url(source)
|
16
|
+
asset_name = asset_in_chunks(source) || asset_images(source)
|
23
17
|
"#{host}#{asset_name}" if asset_name
|
24
18
|
end
|
25
19
|
|
@@ -29,18 +23,23 @@ module Webpack
|
|
29
23
|
|
30
24
|
protected
|
31
25
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
26
|
+
def asset_in_chunks(source)
|
27
|
+
name = source.split('.').first
|
28
|
+
ext = source.split('.').last
|
29
|
+
chunk = [*data['assetsByChunkName'][name]]
|
30
|
+
|
31
|
+
chunk.find { |asset| asset.end_with? ext }
|
32
|
+
end
|
33
|
+
|
34
|
+
def asset_images(source)
|
35
|
+
data['assets'][source]
|
40
36
|
end
|
41
37
|
|
42
|
-
def
|
43
|
-
|
38
|
+
def data
|
39
|
+
new_timestamp = File.ctime(configuration.path)
|
40
|
+
return @data if new_timestamp == @updated_at
|
41
|
+
@updated_at = new_timestamp
|
42
|
+
@data = JSON.parse(File.read(configuration.path))
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
data/webpack-pipeline.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: webpack-pipeline 0.
|
5
|
+
# stub: webpack-pipeline 0.3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "webpack-pipeline"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.3.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Stanislav German"]
|
14
|
-
s.date = "2015-05-
|
14
|
+
s.date = "2015-05-19"
|
15
15
|
s.description = "it adds wiew helpers to integrate webpack with rails"
|
16
16
|
s.email = "s.german@rambler-co.ru"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpack-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav German
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|