jekyll-tasks 0.3.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30f43274444ff755c93a38ff085384a0c924c4106eb281fb52de490f9c378e1f
4
- data.tar.gz: b29c4d4abfe88a7e53b8dba06637a60b6806bb1d9b5db25388fa2e681deca9b4
3
+ metadata.gz: 18c9298d13d35ccc67fff367c6e51a2aeb49cf0f7490057359b8b7efaeefabe0
4
+ data.tar.gz: f7832fa85f0b2635c48ca7ed588022aa8e06749d902af63a09f315c8b7d40f18
5
5
  SHA512:
6
- metadata.gz: fcd79960a18e88fb90babb45a9ac5ab9556548602726a4953729bad456aa176ed441a88e634d721219f1475f31367836496ecf72463edf17f2828ab7eaf62fd5
7
- data.tar.gz: 0e263a7d776f02b2c4667d75dc3f16b3c218a385ea7cbdd1e3a0d81f107420907ef71ef9137a56b451d716c20eb8b74bb4e0fa810c40d30d87b2a3ad95f80c89
6
+ metadata.gz: 9f3812b8b6b18591480235b0d7aea334ba77d6f642b907c29cd93627c2e62d284a4e4673b460be19ddbbd5fa3e274d0995b4e6a2c13278869128c3b984de2ce4
7
+ data.tar.gz: 14192f2d0d27ffadbab31a181f20a7b86d94a794d362bad5250e296d118137d687be2759927d4906dea0db8a242b9c714d1d8759f66a696a94942e81b7b42286
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.5', require: false
8
- gem 'minitest', '~> 5.14'
7
+ gem 'codecov', '~> 0.6', require: false
8
+ gem 'minitest', '~> 5.15'
9
9
  gem 'rake', '~> 13.0'
10
- gem 'rubocop', '~> 1.12'
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.3.0)
4
+ jekyll-tasks (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
- codecov (0.5.2)
10
+ codecov (0.6.0)
11
11
  simplecov (>= 0.15, < 0.22)
12
- docile (1.3.5)
13
- minitest (5.14.4)
14
- parallel (1.20.1)
15
- parser (3.0.1.0)
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.0.0)
17
+ rainbow (3.1.1)
18
18
  rake (13.0.6)
19
- regexp_parser (2.1.1)
19
+ regexp_parser (2.3.0)
20
20
  rexml (3.2.5)
21
- rubocop (1.12.1)
21
+ rubocop (1.27.0)
22
22
  parallel (~> 1.10)
23
- parser (>= 3.0.0.0)
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.2.0, < 2.0)
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.4.1)
31
- parser (>= 2.7.1.5)
30
+ rubocop-ast (1.17.0)
31
+ parser (>= 3.1.1.0)
32
32
  ruby-progressbar (1.11.0)
33
- simplecov (0.18.5)
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
- unicode-display_width (2.0.0)
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.5)
45
+ codecov (~> 0.6)
44
46
  jekyll-tasks!
45
- minitest (~> 5.14)
47
+ minitest (~> 5.15)
46
48
  rake (~> 13.0)
47
- rubocop (~> 1.12)
49
+ rubocop (~> 1.27)
48
50
 
49
51
  BUNDLED WITH
50
52
  2.1.4
@@ -1,3 +1,5 @@
1
1
  ---
2
+ layout: grid
2
3
  menu-name: menu-1
4
+ permalink: /collection1/
3
5
  ---
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: grid
3
+ title: Menu without father
4
+ menu-name: submenu-1
5
+ ---
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: Menu without name
3
+ layout: grid
4
+ menu-father: menu-1
5
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ title: model1
3
+ ---
@@ -1,3 +1,5 @@
1
1
  ---
2
+ layout: grid
2
3
  menu-name: menu-2
4
+ permalink: /collection2/
3
5
  ---
data/jekyll-tasks.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
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) }
@@ -6,14 +6,15 @@ module Jekyll
6
6
  module Menus
7
7
  extend self
8
8
 
9
- def print_conflicts
10
- conflicts = search_conflicts
11
- puts conflicts
12
- conflicts.empty?
9
+ def search_conflicts
10
+ conflicts = []
11
+ conflicts << (search_conflicts_with_properties | search_conflicts_without_properties)
12
+ conflicts.flatten!
13
13
  end
14
14
 
15
- def search_conflicts
15
+ def search_conflicts_with_properties
16
16
  conflicts = []
17
+
17
18
  per_collection(%w[name father]).each do |el|
18
19
  properties = el['properties']
19
20
 
@@ -23,8 +24,20 @@ module Jekyll
23
24
  index = search_hash(properties, 'father')
24
25
  father = index.nil? ? '' : properties[index]['father']
25
26
 
26
- analyze_conflicts el['collection'], conflicts, name, father if name != father
27
+ conflicts << analyze_conflicts(el['collection'], name, father) if name != father
27
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
+
28
41
  conflicts
29
42
  end
30
43
 
@@ -38,8 +51,19 @@ module Jekyll
38
51
  result
39
52
  end
40
53
 
41
- def search_properties(collection, properties)
42
- result = []
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 = [])
43
67
  files = markdown_files collection
44
68
  files.each do |file|
45
69
  data = YAML.load_file(file)
@@ -52,7 +76,22 @@ module Jekyll
52
76
 
53
77
  private
54
78
 
55
- def analyze_conflicts(collection, conflicts, name, father)
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 = [])
56
95
  array = name - father
57
96
  conflicts << "There are some unused menus at #{collection} collection: #{array}" unless array.empty?
58
97
 
@@ -67,12 +106,9 @@ module Jekyll
67
106
  def search_property(result, data, property)
68
107
  value = data["menu-#{property}"]
69
108
  index = search_hash(result, property)
70
- if index
71
- result[index][property] << value unless value.nil?
72
- else
73
- hash = { property => value.nil? ? [] : [value] }
74
- result << hash
75
- end
109
+
110
+ (result[index][property] << value unless value.nil?) if index
111
+ (result << { property => value.nil? ? [] : [value] }) unless index
76
112
  end
77
113
 
78
114
  def order_properties(result, properties)
@@ -26,6 +26,10 @@ module Jekyll
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
35
  def path_list
@@ -8,14 +8,26 @@ 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
- api = api_data
14
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 errors << "Doesn't have related products: #{product}"
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
+ errors << "'#{key}' has duplicate related products" if related.length != related.uniq.length
29
+ related.each do |product|
30
+ errors << "Related '#{product}' (declared @ '#{key}') doesn't exist" unless products.include? product
19
31
  end
20
32
  end
21
33
  errors.empty? ? 'OK' : errors
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Tasks
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
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.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Tinajero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-21 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -28,8 +28,11 @@ files:
28
28
  - README.md
29
29
  - Rakefile
30
30
  - _collection1/collection1.md
31
- - _collection1/subfolder/product-lost.md
32
- - _collection1/subfolder/subfolder1.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
33
36
  - _collection2/collection2.md
34
37
  - _collection2/subfolder/subfolder2.md
35
38
  - jekyll-tasks.gemspec
@@ -47,6 +50,7 @@ metadata:
47
50
  homepage_uri: https://github.com/grupopv/jekyll-tasks/
48
51
  source_code_uri: https://github.com/grupopv/jekyll-tasks/
49
52
  changelog_uri: https://github.com/grupopv/jekyll-tasks/blob/master/CHANGELOG.md
53
+ rubygems_mfa_required: 'true'
50
54
  post_install_message:
51
55
  rdoc_options: []
52
56
  require_paths: