japr 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -6
- data/lib/japr.rb +8 -6
- data/lib/japr/asset.rb +2 -0
- data/lib/japr/compressor.rb +2 -0
- data/lib/japr/converter.rb +2 -0
- data/lib/japr/extensions/jekyll/site.rb +2 -0
- data/lib/japr/extensions/jekyll/site_extensions.rb +2 -0
- data/lib/japr/extensions/liquid/asset_tag.rb +2 -0
- data/lib/japr/extensions/liquid/asset_tags/css_asset_tag.rb +2 -0
- data/lib/japr/extensions/liquid/asset_tags/javascript_asset_tag.rb +2 -0
- data/lib/japr/extensions/liquid/liquid_block_extensions.rb +2 -0
- data/lib/japr/extensions/ruby/subclass_tracking.rb +2 -0
- data/lib/japr/pipeline.rb +26 -23
- data/lib/japr/template.rb +2 -0
- data/lib/japr/templates/css_tag_template.rb +2 -0
- data/lib/japr/templates/javascript_tag_template.rb +2 -0
- data/lib/japr/templates/template_helper.rb +2 -0
- data/lib/japr/version.rb +3 -1
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2c502f6bf09019cda965a99c63ba1436a2c0f28c31cdf9576f976758d35776f0
|
4
|
+
data.tar.gz: 1c09cf0c0a536592d0f7420287f748da4dadcee4ad8889c2cbb9f9649388cbf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69fbc2ebbc9a87fa6c509c29b28d05419ff1fc15cb7c0698db2a18a17c8518067346cee838041e5a6288a9ae5a6dd4fcef9a72b24d5fec3bbbae651411e9d06d
|
7
|
+
data.tar.gz: 1ca3cefe238a48490d435da247338a9d5993860ac37853c26eff723b17cc4192d2fec7f67c16f2361a6b9f26e432e31430029449057eac91a47dbd35dcd1c56f
|
data/README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
# JAPR (Jekyll Asset Pipeline Reborn)
|
2
2
|
|
3
|
-
[![Gem Version](https://
|
4
|
-
[![Build Status](https://
|
5
|
-
[![
|
6
|
-
[![Dependency Status](https://gemnasium.com/janosrusiczki/japr.png)](https://gemnasium.com/janosrusiczki/japr)
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/japr.svg)](https://rubygems.org/gems/japr)
|
4
|
+
[![Build Status](https://img.shields.io/travis/janosrusiczki/japr/master.svg)](https://travis-ci.org/janosrusiczki/japr)
|
5
|
+
[![Coveralls Status](https://img.shields.io/coveralls/github/janosrusiczki/japr/master.svg)](https://coveralls.io/r/janosrusiczki/japr?branch=master)
|
7
6
|
|
8
|
-
|
7
|
+
**Update** On December 20, 2017 JAPR has been merged back into [Jekyll Asset Pipeline](https://github.com/matthodan/jekyll-asset-pipeline). As my time permits I'll try to maintain both repositories.
|
9
8
|
|
10
|
-
|
9
|
+
JAPR is a powerful asset pipeline that automatically collects, converts and compresses / minifies your site's JavaScript and CSS assets when you compile your [Jekyll](http://jekyllrb.com/) site.
|
11
10
|
|
12
11
|
## Table of Contents
|
13
12
|
|
@@ -360,6 +359,10 @@ You can contribute to the JAPR by submitting a pull request [via GitHub](https:/
|
|
360
359
|
|
361
360
|
If you have any ideas or you would like to see anything else improved please use the [issues section](https://github.com/janosrusiczki/japr/issues).
|
362
361
|
|
362
|
+
## Changelog
|
363
|
+
|
364
|
+
See [the changelog](CHANGELOG.md).
|
365
|
+
|
363
366
|
## Community
|
364
367
|
|
365
368
|
- Here is [GitHub's list of projects that use the gem](https://github.com/janosrusiczki/japr/network/dependents).
|
data/lib/japr.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Stdlib dependencies
|
2
4
|
require 'digest/md5'
|
3
5
|
require 'fileutils'
|
@@ -45,11 +47,11 @@ module JAPR
|
|
45
47
|
# 'gzip' true = Create gzip versions,
|
46
48
|
# false = Do not create gzip versions
|
47
49
|
DEFAULTS = {
|
48
|
-
'output_path'
|
49
|
-
'display_path'
|
50
|
-
'staging_path'
|
51
|
-
'bundle'
|
52
|
-
'compress'
|
53
|
-
'gzip'
|
50
|
+
'output_path' => 'assets',
|
51
|
+
'display_path' => nil,
|
52
|
+
'staging_path' => '.asset_pipeline',
|
53
|
+
'bundle' => true,
|
54
|
+
'compress' => true,
|
55
|
+
'gzip' => false
|
54
56
|
}.freeze
|
55
57
|
end
|
data/lib/japr/asset.rb
CHANGED
data/lib/japr/compressor.rb
CHANGED
data/lib/japr/converter.rb
CHANGED
data/lib/japr/pipeline.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module JAPR
|
2
4
|
# The pipeline itself, the run method is where it all happens
|
3
|
-
# rubocop:disable ClassLength
|
5
|
+
# rubocop:disable Metrics/ClassLength
|
4
6
|
class Pipeline
|
7
|
+
# rubocop:enable Metrics/ClassLength
|
5
8
|
class << self
|
6
9
|
# Generate hash based on manifest
|
7
10
|
def hash(source, manifest, options = {})
|
@@ -10,9 +13,9 @@ module JAPR
|
|
10
13
|
Digest::MD5.hexdigest(YAML.safe_load(manifest).map! do |path|
|
11
14
|
"#{path}#{File.mtime(File.join(source, path)).to_i}"
|
12
15
|
end.join.concat(options.to_s))
|
13
|
-
rescue StandardError =>
|
14
|
-
puts "Failed to generate hash from provided manifest: #{
|
15
|
-
raise
|
16
|
+
rescue StandardError => e
|
17
|
+
puts "Failed to generate hash from provided manifest: #{e.message}"
|
18
|
+
raise e
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -20,9 +23,9 @@ module JAPR
|
|
20
23
|
# This is called from JAPR::LiquidBlockExtensions.render or,
|
21
24
|
# to be more precise, from JAPR::CssAssetTag.render and
|
22
25
|
# JAPR::JavaScriptAssetTag.render
|
23
|
-
# rubocop:disable ParameterLists
|
26
|
+
# rubocop:disable Metrics/ParameterLists
|
24
27
|
def run(manifest, prefix, source, destination, tag, type, config)
|
25
|
-
# rubocop:enable ParameterLists
|
28
|
+
# rubocop:enable Metrics/ParameterLists
|
26
29
|
# Get hash for pipeline
|
27
30
|
hash = hash(source, manifest, config)
|
28
31
|
|
@@ -33,12 +36,12 @@ module JAPR
|
|
33
36
|
puts "Processing '#{tag}' manifest '#{prefix}'"
|
34
37
|
pipeline = new(manifest, prefix, source, destination, type, config)
|
35
38
|
process_pipeline(hash, pipeline)
|
36
|
-
rescue StandardError =>
|
39
|
+
rescue StandardError => e
|
37
40
|
# Add exception to cache
|
38
|
-
cache[hash] =
|
41
|
+
cache[hash] = e
|
39
42
|
|
40
43
|
# Re-raise the exception
|
41
|
-
raise
|
44
|
+
raise e
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
@@ -81,9 +84,9 @@ module JAPR
|
|
81
84
|
end
|
82
85
|
|
83
86
|
# Initialize new pipeline
|
84
|
-
# rubocop:disable ParameterLists
|
87
|
+
# rubocop:disable Metrics/ParameterLists
|
85
88
|
def initialize(manifest, prefix, source, destination, type, options = {})
|
86
|
-
# rubocop:enable ParameterLists
|
89
|
+
# rubocop:enable Metrics/ParameterLists
|
87
90
|
@manifest = manifest
|
88
91
|
@prefix = prefix
|
89
92
|
@source = source
|
@@ -118,10 +121,10 @@ module JAPR
|
|
118
121
|
File.dirname(full_path))
|
119
122
|
end
|
120
123
|
end
|
121
|
-
rescue StandardError =>
|
124
|
+
rescue StandardError => e
|
122
125
|
puts 'Asset Pipeline: Failed to load assets from provided ' \
|
123
|
-
"manifest: #{
|
124
|
-
raise
|
126
|
+
"manifest: #{e.message}"
|
127
|
+
raise e
|
125
128
|
end
|
126
129
|
|
127
130
|
# Convert assets based on the file extension if converter is defined
|
@@ -156,10 +159,10 @@ module JAPR
|
|
156
159
|
if File.extname(asset.filename) == ''
|
157
160
|
asset.filename = "#{asset.filename}#{@type}"
|
158
161
|
end
|
159
|
-
rescue StandardError =>
|
162
|
+
rescue StandardError => e
|
160
163
|
puts "Asset Pipeline: Failed to convert '#{asset.filename}' " \
|
161
|
-
"with '#{klass}': #{
|
162
|
-
raise
|
164
|
+
"with '#{klass}': #{e.message}"
|
165
|
+
raise e
|
163
166
|
end
|
164
167
|
|
165
168
|
# Bundle multiple assets into a single asset
|
@@ -182,10 +185,10 @@ module JAPR
|
|
182
185
|
|
183
186
|
begin
|
184
187
|
asset.content = klass.new(asset.content).compressed
|
185
|
-
rescue StandardError =>
|
188
|
+
rescue StandardError => e
|
186
189
|
puts "Asset Pipeline: Failed to compress '#{asset.filename}' " \
|
187
|
-
"with '#{klass}': #{
|
188
|
-
raise
|
190
|
+
"with '#{klass}': #{e.message}"
|
191
|
+
raise e
|
189
192
|
end
|
190
193
|
end
|
191
194
|
end
|
@@ -223,10 +226,10 @@ module JAPR
|
|
223
226
|
File.open(File.join(directory, asset.filename), 'w') do |file|
|
224
227
|
file.write(asset.content)
|
225
228
|
end
|
226
|
-
rescue StandardError =>
|
229
|
+
rescue StandardError => e
|
227
230
|
puts "Asset Pipeline: Failed to save '#{asset.filename}' to " \
|
228
|
-
"disk: #{
|
229
|
-
raise
|
231
|
+
"disk: #{e.message}"
|
232
|
+
raise e
|
230
233
|
end
|
231
234
|
end
|
232
235
|
|
data/lib/japr/template.rb
CHANGED
data/lib/japr/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: japr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Hodan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.5'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '3.5'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: liquid
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
113
|
requirements:
|
108
114
|
- - ">="
|
109
115
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
116
|
+
version: 2.3.0
|
111
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
118
|
requirements:
|
113
119
|
- - ">="
|
@@ -115,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
121
|
version: '0'
|
116
122
|
requirements: []
|
117
123
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.7.8
|
119
125
|
signing_key:
|
120
126
|
specification_version: 4
|
121
127
|
summary: A powerful asset pipeline for Jekyll that bundles, converts, and minifies
|