jekyll_patternbot 1.4.2 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1531ec29e2d2f7efc94dc21297d9a628b3e8f15ac2c159c6d1ced92c28db603f
4
- data.tar.gz: b8b2da871aea057cb4df68722c83cfdd9d04c0271f6dda90328fa213f263b997
3
+ metadata.gz: 884f2906dc4a4f8b9bb847ce46049501e583a5bca7e9c5b79b897c407a430b88
4
+ data.tar.gz: '0587e5339f5b5da4a73e3c6b509c3c60563ee21673ad656c74acc32da714537e'
5
5
  SHA512:
6
- metadata.gz: b1325fc8376a2e779fd776e3d5bb928ab4ce95d0a0dc0bc5293a35b6fe9719481b86ceec6b98589efb83cbf2085555c57e525259261d31a53c007fd445bef364
7
- data.tar.gz: 90f04b7f8dc5907b3978add05b5e52bff69edabda773b8dad4862736a028a15f3cb3d353b010841f5a0853edf0243a43935a7338e94c26fc10df6272d6d25bb8
6
+ metadata.gz: 0e1f3fbbfd9ed231b0453cfe81682c98e0c409671f03bf72b82dc56def73082a9339ee0e4157c97f5ea3016feaac56e91f9e38faefefa18bb8fc6d92b43aad92
7
+ data.tar.gz: 580a3bac4bd5d6634eddbf30815e7035c6e256f2efc82691fbd4b969c9e99b422e7eedb23d1cd9d8ad7640f121d98c964fc6899b728f194bb244c5739da87217
data/CHANGELOG.md CHANGED
@@ -5,7 +5,24 @@ Jekyll Patternbot adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ---
7
7
 
8
- ##[1.4.2] — 2019-02-11
8
+ ## [1.5.0] — 2020-01-04
9
+
10
+ ### Added
11
+
12
+ - The Patternbot configuration options automatically reloaded when saved.
13
+ - Show errors in the console when YAML cannot properly load.
14
+ - Raise an exception when the `name` entry of a field is missing or blank.
15
+ - Raise an exception when there’s a common syntax error in the font variables.
16
+ - Allow code blocks within layout documentation.
17
+ - Added the ability to describe includes within the `_config.yml` file.
18
+
19
+ ### Fixed
20
+
21
+ - Absorb the error when the `fields` attribute in pattern configs isn’t an array.
22
+
23
+ ---
24
+
25
+ ## [1.4.2] — 2019-02-11
9
26
 
10
27
  ### Fixed
11
28
 
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  ruby '2.5.3'
6
6
 
7
7
  gem 'jekyll', '~> 3.8'
8
+ gem 'listen', '~> 3.0'
8
9
  gem 'unicode', '~> 0.4'
9
10
  gem 'colorator', '~> 1'
10
11
  gem 'babosa', '~> 1'
@@ -167,6 +167,18 @@
167
167
  </a>
168
168
  </li>
169
169
  {% endunless %}
170
+ {% unless page._PatternbotData.includes == empty %}
171
+ <li role="presentation">
172
+ <a class="gutter pad-t-1-4 pad-b-1-4 block" role="tab" aria-controls="includes" href="#includes">
173
+ <div class="relative">
174
+ <span>Includes</span>
175
+ <i class="icon i-18 absolute pin-cr">
176
+ <svg><use xlink:href="#icon-active"></use></svg>
177
+ </i>
178
+ </div>
179
+ </a>
180
+ </li>
181
+ {% endunless %}
170
182
  {% unless page._PatternbotData.icons.spritesheets == empty %}
171
183
  <li role="presentation">
172
184
  <a class="gutter pad-t-1-4 pad-b-1-4 block" role="tab" aria-controls="icons" href="#icons">
@@ -0,0 +1,11 @@
1
+ _layout: "patternbot_pattern_internal"
2
+ _extra_css:
3
+ - 'utilities/utilities.min.css'
4
+
5
+ patterns:
6
+ includes:
7
+ title: "Includes"
8
+ description: "Below is a reference of all the includes available for pages within the website."
9
+ _popout_button: false
10
+ _resizable: false
11
+ _code: false
@@ -0,0 +1,20 @@
1
+ <div class="patternbot-font-primary text-left milli">
2
+ <div class="pattern-utilities-scrollable scrollable">
3
+ <table class="patternbot-utilities-table">
4
+ <thead>
5
+ <tr>
6
+ <th scope="col" colspan="6">Include</th>
7
+ <th scope="col" colspan="18">Description</th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ {% for include in page._PatternbotData.includes %}
12
+ <tr>
13
+ <th class="valign-middle" scope="row" colspan="6"><code class="ib valign-middle">{{include.name | escape}}</code></th>
14
+ <td class="valign-middle" scope="col" colspan="18"><span class="ib valign-middle">{{include.description | default: '—' | markdownify}}</span></td>
15
+ </tr>
16
+ {% endfor %}
17
+ </tbody>
18
+ </table>
19
+ </div>
20
+ </div>
@@ -11,7 +11,7 @@
11
11
  {% for layout in page._PatternbotData.layouts %}
12
12
  <tr>
13
13
  <th class="valign-middle" scope="row" colspan="6"><code class="ib valign-middle">{{layout.name | escape}}</code></th>
14
- <td class="valign-middle" scope="col" colspan="18"><span class="ib valign-middle">{{layout.description | default: '—' | escape}}</span></td>
14
+ <td class="valign-middle" scope="col" colspan="18"><span class="ib valign-middle">{{layout.description | default: '—' | markdownify}}</span></td>
15
15
  </tr>
16
16
  {% endfor %}
17
17
  </tbody>
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'listen'
3
4
  require 'open-uri'
4
5
  require 'babosa'
5
6
  require 'deep_merge'
@@ -35,6 +36,7 @@ module JekyllPatternbot
35
36
  require 'jekyll_patternbot/finders/logos'
36
37
  require 'jekyll_patternbot/finders/icons'
37
38
  require 'jekyll_patternbot/finders/layouts'
39
+ require 'jekyll_patternbot/finders/includes'
38
40
  require 'jekyll_patternbot/finders/patterns'
39
41
  require 'jekyll_patternbot/finders/sample_pages'
40
42
 
@@ -1,5 +1,6 @@
1
1
  module JekyllPatternbot
2
2
  Config = YAML.load_file File.expand_path('../../_config.yml', __dir__)
3
+ ConfigListener = nil
3
4
  class << self; attr_accessor :PatternbotLogger; end
4
5
  class << self; attr_accessor :PatternbotCache; end
5
6
  class << self; attr_accessor :PatternbotLocale; end
@@ -23,5 +24,23 @@ module JekyllPatternbot
23
24
  else
24
25
  PatternbotLocale = YAML.load_file File.expand_path("../../_data/locales/en-ca.yml", __dir__)
25
26
  end
27
+
28
+ # Does this leave a running process when Jekyll shuts down?
29
+ ConfigListener = Listen.to(site.source, only: /\_config\.yml/) do |modified, added, removed|
30
+ begin
31
+ new_config = YAML.load_file File.expand_path(site.source + '/_config.yml')
32
+ rescue Exception => err
33
+ log = PatternbotConsoleLogger.new
34
+ log.fatal(err.message)
35
+ else
36
+ if new_config.key? 'patternbot'
37
+ Config['patternbot'].deep_merge! new_config['patternbot']
38
+ if site
39
+ site.process
40
+ end
41
+ end
42
+ end
43
+ end
44
+ ConfigListener.start
26
45
  end
27
46
  end
@@ -0,0 +1,32 @@
1
+ module JekyllPatternbot
2
+ class IncludesFinder
3
+
4
+ def base
5
+ {
6
+ :name => false,
7
+ :description => false,
8
+ }
9
+ end
10
+
11
+ def info
12
+ includes_dir = File.expand_path Config['includes_dir']
13
+ includes = []
14
+ return includes unless File.directory? includes_dir
15
+ include_files = FileHelper.list_files_with_ext includes_dir, '*'
16
+ for include in include_files
17
+ include_data = base.clone
18
+ include_data[:name] = File.basename include, '.*'
19
+ unless Config['patternbot']['includes'].nil?
20
+ Config['patternbot']['includes'].each do |key, desc|
21
+ if key == include_data[:name]
22
+ include_data[:description] = desc.strip if desc
23
+ end
24
+ end
25
+ end
26
+ includes.push include_data
27
+ end
28
+ includes
29
+ end
30
+
31
+ end
32
+ end
@@ -13,7 +13,9 @@ module JekyllPatternbot
13
13
  return {} unless File.file? config_path
14
14
  begin
15
15
  config_data = YAML.load_file config_path
16
- rescue
16
+ rescue Exception => err
17
+ log = PatternbotConsoleLogger.new
18
+ log.fatal(err.message)
17
19
  return {}
18
20
  end
19
21
  if config_data.nil? or config_data == false
@@ -7,10 +7,12 @@ module JekyllPatternbot
7
7
 
8
8
  def self._pattern_assign_tags(fields)
9
9
  assign_tags = []
10
- for field in fields
11
- unless field['required'] == false
12
- if field.key? 'data'
13
- assign_tags.push "{% assign #{self._pattern_data_source_var_name(field)}=#{field['data']['source']} %}"
10
+ if fields.is_a? Array
11
+ for field in fields
12
+ unless field['required'] == false
13
+ if field.key? 'data'
14
+ assign_tags.push "{% assign #{self._pattern_data_source_var_name(field)}=#{field['data']['source']} %}"
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -19,21 +21,29 @@ module JekyllPatternbot
19
21
 
20
22
  def self._pattern_include_fields(fields, datasource=false)
21
23
  liquid_fields = []
22
- for field in fields
23
- unless field['required'] == false
24
- if field.key? 'data'
25
- if datasource
26
- liquid_fields.push "#{field['name']}=#{self._pattern_data_source_var_name(field)}"
27
- else
28
- liquid_fields.push "#{field['name']}=#{field['data']['type']}"
29
- end
24
+ if fields.is_a? Array
25
+ for field in fields
26
+ if not field.key? 'name' or field['name'] == ''
27
+ err_msg = 'A pattern field, inside a pattern’s config.yml file, is missing a name.'
28
+ err_logger = PatternbotConsoleLogger.new
29
+ err_logger.fatal err_msg
30
+ raise err_msg
30
31
  end
31
- if field.key? 'example'
32
- quotes = ''
33
- if field['example'].is_a? String
34
- quotes = '"'
32
+ unless field['required'] == false
33
+ if field.key? 'data'
34
+ if datasource
35
+ liquid_fields.push "#{field['name']}=#{self._pattern_data_source_var_name(field)}"
36
+ else
37
+ liquid_fields.push "#{field['name']}=#{field['data']['type']}"
38
+ end
39
+ end
40
+ if field.key? 'example'
41
+ quotes = ''
42
+ if field['example'].is_a? String
43
+ quotes = '"'
44
+ end
45
+ liquid_fields.push "#{field['name']}=#{quotes}#{field['example']}#{quotes}"
35
46
  end
36
- liquid_fields.push "#{field['name']}=#{quotes}#{field['example']}#{quotes}"
37
47
  end
38
48
  end
39
49
  end
@@ -60,6 +60,9 @@ module JekyllPatternbot
60
60
  layouts = LayoutsFinder.new
61
61
  PatternbotData[:layouts] = layouts.info
62
62
 
63
+ includes = IncludesFinder.new
64
+ PatternbotData[:includes] = includes.info
65
+
63
66
  pattern_files = PatternsFinder.new
64
67
  PatternbotData[:patterns] = {
65
68
  :internal => pattern_files.internal_patterns_info,
@@ -84,6 +84,12 @@ module JekyllPatternbot
84
84
  end
85
85
 
86
86
  def self.parse_font(dec, val, available_weights)
87
+ if not val.is_a? String
88
+ err_msg = "There’s a syntax error in the #{dec.strip} declaration of the css/theme.css file."
89
+ err_logger = PatternbotConsoleLogger.new
90
+ err_logger.fatal err_msg
91
+ raise err_msg
92
+ end
87
93
  font_family = val.match(/[^\,\;]*/)[0].gsub(/['"]/, '')
88
94
  font_family_slug = font_family.force_encoding("utf-8").to_slug.normalize.to_s
89
95
  font = self.font.clone
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.required_ruby_version = '~> 2'
23
23
 
24
24
  spec.add_runtime_dependency 'jekyll', '~> 3.8'
25
+ spec.add_runtime_dependency 'listen', '~> 3.0'
25
26
  spec.add_runtime_dependency 'unicode', '~> 0.4'
26
27
  spec.add_runtime_dependency 'colorator', '~> 1'
27
28
  spec.add_runtime_dependency 'babosa', '~> 1'
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JekyllPatternbot
2
- VERSION = '1.4.2'
2
+ VERSION = '1.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_patternbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas J Bradley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-11 00:00:00.000000000 Z
11
+ date: 2020-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: listen
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: unicode
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -194,6 +208,8 @@ files:
194
208
  - _patterns/icons/icon-sizes.html
195
209
  - _patterns/icons/icons-with-labels.html
196
210
  - _patterns/icons/icons.html
211
+ - _patterns/includes/config.yml
212
+ - _patterns/includes/includes.html
197
213
  - _patterns/layouts/config.yml
198
214
  - _patterns/layouts/layouts.html
199
215
  - _patterns/modules/config.yml
@@ -226,6 +242,7 @@ files:
226
242
  - _plugins/jekyll_patternbot/filters/text.rb
227
243
  - _plugins/jekyll_patternbot/finders/finder.rb
228
244
  - _plugins/jekyll_patternbot/finders/icons.rb
245
+ - _plugins/jekyll_patternbot/finders/includes.rb
229
246
  - _plugins/jekyll_patternbot/finders/layouts.rb
230
247
  - _plugins/jekyll_patternbot/finders/logos.rb
231
248
  - _plugins/jekyll_patternbot/finders/patterns.rb
@@ -317,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
334
  - !ruby/object:Gem::Version
318
335
  version: '0'
319
336
  requirements: []
320
- rubygems_version: 3.0.2
337
+ rubygems_version: 3.0.6
321
338
  signing_key:
322
339
  specification_version: 4
323
340
  summary: Your pompous and persnickety patterning robot.