jekyll-tasks 0.2.0 → 0.4.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/.rubocop.yml +4 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +21 -19
- data/_collection1/collection1.md +5 -0
- data/_collection1/subfolder-without-father/menu-without-father.md +5 -0
- data/_collection1/subfolder-without-name/menu-without-name.md +5 -0
- data/_collection1/subfolder1/product-lost.md +3 -0
- data/_collection1/subfolder1/product-without-father.md +3 -0
- data/_collection1/subfolder1/subfolder1.md +4 -0
- data/_collection2/collection2.md +5 -0
- data/_collection2/subfolder/subfolder2.md +4 -0
- data/jekyll-tasks.gemspec +3 -2
- data/lib/jekyll/tasks/collections.rb +24 -0
- data/lib/jekyll/tasks/menus.rb +134 -0
- data/lib/jekyll/tasks/products.rb +9 -5
- data/lib/jekyll/tasks/related.rb +16 -5
- data/lib/jekyll/tasks/version.rb +1 -1
- data/lib/jekyll/tasks.rb +3 -0
- metadata +15 -8
- data/.github/dependabot.yml +0 -15
- data/_data/api/hana/products/product-1.yml +0 -1
- data/_data/api/hana/products/product-2.yml +0 -1
- data/_data/api/hana/products/product-3.yml +0 -1
- data/_data/api/yaml/related/products.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6de70aa2433ec78c596c2d1c0dfec0816f1f271ea62a6fc3506bfe6297d30db7
|
4
|
+
data.tar.gz: dcb2d5a1d25e49887861b0a47f1f2d4b102356c68548065943f6b5b2dd8fbe98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4479af3e618eae169ee36fdc6da20e86a29da11de438d0dc1d3a3d1fa539c33ad6607ef6830be46c5ba0f08b59e336dd69b5cf6252ffee7db4c6d91016938266
|
7
|
+
data.tar.gz: cf42960599dc7f86a320a857452c8d0af222b450f075abadb64a761943ae64b9e1d84408fba8d2e0f3194a46337b60f316208fa7de6d9bda4a2252144c4eec2e
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
@@ -4,8 +4,8 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem 'codecov', '~> 0.
|
8
|
-
gem 'minitest', '~> 5.
|
7
|
+
gem 'codecov', '~> 0.6', require: false
|
8
|
+
gem 'minitest', '~> 5.15'
|
9
9
|
gem 'rake', '~> 13.0'
|
10
|
-
gem 'rubocop', '~> 1.
|
10
|
+
gem 'rubocop', '~> 1.27'
|
11
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,50 +1,52 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-tasks (0.
|
4
|
+
jekyll-tasks (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.2)
|
10
|
-
codecov (0.
|
10
|
+
codecov (0.6.0)
|
11
11
|
simplecov (>= 0.15, < 0.22)
|
12
|
-
docile (1.
|
13
|
-
minitest (5.
|
14
|
-
parallel (1.
|
15
|
-
parser (3.
|
12
|
+
docile (1.4.0)
|
13
|
+
minitest (5.15.0)
|
14
|
+
parallel (1.22.1)
|
15
|
+
parser (3.1.1.0)
|
16
16
|
ast (~> 2.4.1)
|
17
|
-
rainbow (3.
|
18
|
-
rake (13.0.
|
19
|
-
regexp_parser (2.
|
17
|
+
rainbow (3.1.1)
|
18
|
+
rake (13.0.6)
|
19
|
+
regexp_parser (2.3.0)
|
20
20
|
rexml (3.2.5)
|
21
|
-
rubocop (1.
|
21
|
+
rubocop (1.27.0)
|
22
22
|
parallel (~> 1.10)
|
23
|
-
parser (>= 3.
|
23
|
+
parser (>= 3.1.0.0)
|
24
24
|
rainbow (>= 2.2.2, < 4.0)
|
25
25
|
regexp_parser (>= 1.8, < 3.0)
|
26
26
|
rexml
|
27
|
-
rubocop-ast (>= 1.
|
27
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
28
28
|
ruby-progressbar (~> 1.7)
|
29
29
|
unicode-display_width (>= 1.4.0, < 3.0)
|
30
|
-
rubocop-ast (1.
|
31
|
-
parser (>=
|
30
|
+
rubocop-ast (1.17.0)
|
31
|
+
parser (>= 3.1.1.0)
|
32
32
|
ruby-progressbar (1.11.0)
|
33
|
-
simplecov (0.
|
33
|
+
simplecov (0.21.2)
|
34
34
|
docile (~> 1.1)
|
35
35
|
simplecov-html (~> 0.11)
|
36
|
+
simplecov_json_formatter (~> 0.1)
|
36
37
|
simplecov-html (0.12.3)
|
37
|
-
|
38
|
+
simplecov_json_formatter (0.1.3)
|
39
|
+
unicode-display_width (2.1.0)
|
38
40
|
|
39
41
|
PLATFORMS
|
40
42
|
ruby
|
41
43
|
|
42
44
|
DEPENDENCIES
|
43
|
-
codecov (~> 0.
|
45
|
+
codecov (~> 0.6)
|
44
46
|
jekyll-tasks!
|
45
|
-
minitest (~> 5.
|
47
|
+
minitest (~> 5.15)
|
46
48
|
rake (~> 13.0)
|
47
|
-
rubocop (~> 1.
|
49
|
+
rubocop (~> 1.27)
|
48
50
|
|
49
51
|
BUNDLED WITH
|
50
52
|
2.1.4
|
data/jekyll-tasks.gemspec
CHANGED
@@ -11,11 +11,12 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = 'A set of rake tasks to help you on your Jekyll sites.'
|
12
12
|
spec.homepage = 'https://github.com/grupopv/jekyll-tasks/'
|
13
13
|
spec.license = 'MIT'
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
15
15
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
17
17
|
spec.metadata['source_code_uri'] = 'https://github.com/grupopv/jekyll-tasks/'
|
18
18
|
spec.metadata['changelog_uri'] = 'https://github.com/grupopv/jekyll-tasks/blob/master/CHANGELOG.md'
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
19
20
|
|
20
21
|
spec.bindir = 'exe'
|
21
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -24,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
24
25
|
all_files = `git ls-files -z`.split("\x0")
|
25
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
27
|
all_files.reject do |f|
|
27
|
-
excluded_files = %r{^(bin|
|
28
|
+
excluded_files = %r{^(_data|.github|bin|test|spec|features)/}
|
28
29
|
f.match(excluded_files)
|
29
30
|
end
|
30
31
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Tasks
|
5
|
+
# Obtain collections information
|
6
|
+
module Collections
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def get
|
10
|
+
collections = []
|
11
|
+
folders_starting_with_underscore.each do |collection|
|
12
|
+
collections << collection[3..]
|
13
|
+
end
|
14
|
+
collections
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def folders_starting_with_underscore
|
20
|
+
Dir.glob('./_*').to_a.sort
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Tasks
|
5
|
+
# Obtain menus information
|
6
|
+
module Menus
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def search_conflicts
|
10
|
+
conflicts = []
|
11
|
+
conflicts << (search_conflicts_with_properties | search_conflicts_without_properties)
|
12
|
+
conflicts.flatten!
|
13
|
+
end
|
14
|
+
|
15
|
+
def search_conflicts_with_properties
|
16
|
+
conflicts = []
|
17
|
+
|
18
|
+
per_collection(%w[name father]).each do |el|
|
19
|
+
properties = el['properties']
|
20
|
+
|
21
|
+
index = search_hash(properties, 'name')
|
22
|
+
name = index.nil? ? '' : properties[index]['name']
|
23
|
+
|
24
|
+
index = search_hash(properties, 'father')
|
25
|
+
father = index.nil? ? '' : properties[index]['father']
|
26
|
+
|
27
|
+
conflicts << analyze_conflicts(el['collection'], name, father) if name != father
|
28
|
+
end
|
29
|
+
|
30
|
+
conflicts
|
31
|
+
end
|
32
|
+
|
33
|
+
def search_conflicts_without_properties
|
34
|
+
conflicts = []
|
35
|
+
|
36
|
+
Collections.get.each do |collection|
|
37
|
+
data = search_without_properties(collection) unless collection == 'pages'
|
38
|
+
conflicts << data unless data.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
conflicts
|
42
|
+
end
|
43
|
+
|
44
|
+
def per_collection(properties = ['name'])
|
45
|
+
result = []
|
46
|
+
Collections.get.each do |collection|
|
47
|
+
data = search_properties(collection, properties)
|
48
|
+
hash = { 'collection' => collection, 'properties' => data }
|
49
|
+
result << hash unless data.empty?
|
50
|
+
end
|
51
|
+
result
|
52
|
+
end
|
53
|
+
|
54
|
+
def search_without_properties(collection)
|
55
|
+
conflicts = []
|
56
|
+
|
57
|
+
files = markdown_files collection
|
58
|
+
files.each do |file|
|
59
|
+
data = YAML.load_file(file)
|
60
|
+
conflicts << analyze_conflicts_without_properties(data)
|
61
|
+
end
|
62
|
+
|
63
|
+
conflicts
|
64
|
+
end
|
65
|
+
|
66
|
+
def search_properties(collection, properties, result = [])
|
67
|
+
files = markdown_files collection
|
68
|
+
files.each do |file|
|
69
|
+
data = YAML.load_file(file)
|
70
|
+
properties.each do |property|
|
71
|
+
search_property result, data, property
|
72
|
+
end
|
73
|
+
end
|
74
|
+
order_properties(result, properties)
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def analyze_conflicts_without_properties(data, conflicts = [])
|
80
|
+
conflicts << "Product without father: '#{data['title']}'" if Products.product_without_father data
|
81
|
+
conflicts << "Menu without name: '#{data['title']}'" if menu_without_name data
|
82
|
+
conflicts << "Menu without father: '#{data['title']}'" if menu_without_father data
|
83
|
+
conflicts
|
84
|
+
end
|
85
|
+
|
86
|
+
def menu_without_name(data)
|
87
|
+
data['layout'] == 'grid' && data['menu-name'].nil?
|
88
|
+
end
|
89
|
+
|
90
|
+
def menu_without_father(data)
|
91
|
+
data['layout'] == 'grid' && data['menu-father'].nil? && data['permalink'].nil?
|
92
|
+
end
|
93
|
+
|
94
|
+
def analyze_conflicts(collection, name, father, conflicts = [])
|
95
|
+
array = name - father
|
96
|
+
conflicts << "There are some unused menus at #{collection} collection: #{array}" unless array.empty?
|
97
|
+
|
98
|
+
array = father - name
|
99
|
+
unless array.empty?
|
100
|
+
conflicts << "There are some products pointed to non-existent menus at #{collection} collection: #{array}"
|
101
|
+
end
|
102
|
+
|
103
|
+
conflicts
|
104
|
+
end
|
105
|
+
|
106
|
+
def search_property(result, data, property)
|
107
|
+
value = data["menu-#{property}"]
|
108
|
+
index = search_hash(result, property)
|
109
|
+
|
110
|
+
(result[index][property] << value unless value.nil?) if index
|
111
|
+
(result << { property => value.nil? ? [] : [value] }) unless index
|
112
|
+
end
|
113
|
+
|
114
|
+
def order_properties(result, properties)
|
115
|
+
properties.each do |property|
|
116
|
+
index = search_hash(result, property)
|
117
|
+
result[index][property] = result[index][property].sort.uniq unless index.nil?
|
118
|
+
end
|
119
|
+
result
|
120
|
+
end
|
121
|
+
|
122
|
+
def search_hash(list, property)
|
123
|
+
list.each_with_index do |hash, index|
|
124
|
+
return index if hash[property]
|
125
|
+
end
|
126
|
+
nil
|
127
|
+
end
|
128
|
+
|
129
|
+
def markdown_files(colecction)
|
130
|
+
Dir.glob("./_#{colecction}/**/*.md").to_a.sort
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -6,9 +6,9 @@ module Jekyll
|
|
6
6
|
module Products
|
7
7
|
extend self
|
8
8
|
|
9
|
-
def
|
9
|
+
def filename_list
|
10
10
|
products = []
|
11
|
-
|
11
|
+
path_list.each do |product|
|
12
12
|
product = product
|
13
13
|
.gsub('./_data/api/hana/products/', '')
|
14
14
|
.gsub('.yml', '')
|
@@ -17,18 +17,22 @@ module Jekyll
|
|
17
17
|
products
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def model_list
|
21
21
|
products = []
|
22
|
-
|
22
|
+
path_list.each do |product|
|
23
23
|
data = YAML.load_file(product)
|
24
24
|
products << data['title']
|
25
25
|
end
|
26
26
|
products
|
27
27
|
end
|
28
28
|
|
29
|
+
def product_without_father(data)
|
30
|
+
data['layout'].nil? && data['menu-father'].nil?
|
31
|
+
end
|
32
|
+
|
29
33
|
private
|
30
34
|
|
31
|
-
def
|
35
|
+
def path_list
|
32
36
|
Dir.glob('./_data/api/hana/products/*.yml').to_a.sort
|
33
37
|
end
|
34
38
|
end
|
data/lib/jekyll/tasks/related.rb
CHANGED
@@ -8,14 +8,25 @@ module Jekyll
|
|
8
8
|
|
9
9
|
MINIMUM_RELATED_PRODUCTS = 5
|
10
10
|
|
11
|
-
def all_products_with_related
|
11
|
+
def all_products_with_related(api = api_data)
|
12
12
|
errors = []
|
13
|
-
|
14
|
-
Products.products_model_list.each do |product|
|
13
|
+
Products.model_list.each do |product|
|
15
14
|
if api[product]
|
16
15
|
count = api[product].count
|
17
16
|
errors << "Only has #{count} related products: #{product}" if count < MINIMUM_RELATED_PRODUCTS
|
18
|
-
else
|
17
|
+
else
|
18
|
+
errors << "Doesn't have related products: #{product}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
errors.empty? ? 'OK' : errors
|
22
|
+
end
|
23
|
+
|
24
|
+
def all_related_exist
|
25
|
+
errors = []
|
26
|
+
products = Products.filename_list
|
27
|
+
api_data.each do |key, related|
|
28
|
+
related.each do |product|
|
29
|
+
errors << "Related '#{product}' (declared @ '#{key}') doesn't exist" unless products.include? product
|
19
30
|
end
|
20
31
|
end
|
21
32
|
errors.empty? ? 'OK' : errors
|
@@ -23,7 +34,7 @@ module Jekyll
|
|
23
34
|
|
24
35
|
private
|
25
36
|
|
26
|
-
def
|
37
|
+
def api_data
|
27
38
|
YAML.load_file('./_data/api/yaml/related/products.yml')
|
28
39
|
end
|
29
40
|
end
|
data/lib/jekyll/tasks/version.rb
CHANGED
data/lib/jekyll/tasks.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgar Tinajero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,8 +17,8 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".github/dependabot.yml"
|
21
20
|
- ".gitignore"
|
21
|
+
- ".rubocop.yml"
|
22
22
|
- ".travis.yml"
|
23
23
|
- CODEOWNERS
|
24
24
|
- CODE_OF_CONDUCT.md
|
@@ -27,13 +27,19 @@ files:
|
|
27
27
|
- LICENSE.txt
|
28
28
|
- README.md
|
29
29
|
- Rakefile
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
30
|
+
- _collection1/collection1.md
|
31
|
+
- _collection1/subfolder-without-father/menu-without-father.md
|
32
|
+
- _collection1/subfolder-without-name/menu-without-name.md
|
33
|
+
- _collection1/subfolder1/product-lost.md
|
34
|
+
- _collection1/subfolder1/product-without-father.md
|
35
|
+
- _collection1/subfolder1/subfolder1.md
|
36
|
+
- _collection2/collection2.md
|
37
|
+
- _collection2/subfolder/subfolder2.md
|
34
38
|
- jekyll-tasks.gemspec
|
35
39
|
- lib/jekyll/tasks.rb
|
40
|
+
- lib/jekyll/tasks/collections.rb
|
36
41
|
- lib/jekyll/tasks/dates.rb
|
42
|
+
- lib/jekyll/tasks/menus.rb
|
37
43
|
- lib/jekyll/tasks/products.rb
|
38
44
|
- lib/jekyll/tasks/related.rb
|
39
45
|
- lib/jekyll/tasks/version.rb
|
@@ -44,6 +50,7 @@ metadata:
|
|
44
50
|
homepage_uri: https://github.com/grupopv/jekyll-tasks/
|
45
51
|
source_code_uri: https://github.com/grupopv/jekyll-tasks/
|
46
52
|
changelog_uri: https://github.com/grupopv/jekyll-tasks/blob/master/CHANGELOG.md
|
53
|
+
rubygems_mfa_required: 'true'
|
47
54
|
post_install_message:
|
48
55
|
rdoc_options: []
|
49
56
|
require_paths:
|
@@ -52,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
59
|
requirements:
|
53
60
|
- - ">="
|
54
61
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
62
|
+
version: 2.7.0
|
56
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
64
|
requirements:
|
58
65
|
- - ">="
|
data/.github/dependabot.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
updates:
|
4
|
-
- package-ecosystem: bundler
|
5
|
-
directory: "/"
|
6
|
-
schedule:
|
7
|
-
interval: weekly
|
8
|
-
day: thursday
|
9
|
-
time: "09:00"
|
10
|
-
timezone: "America/Chihuahua"
|
11
|
-
open-pull-requests-limit: 10
|
12
|
-
reviewers: ["mlopez-grupopv"]
|
13
|
-
labels:
|
14
|
-
- dependencies
|
15
|
-
- ruby
|
@@ -1 +0,0 @@
|
|
1
|
-
title: PRODUCT/1
|
@@ -1 +0,0 @@
|
|
1
|
-
title: PRODUCT/2
|
@@ -1 +0,0 @@
|
|
1
|
-
title: PRODUCT/3
|