jekyll-recker 1.2.3 → 1.8.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/README.md +6 -7
- data/_includes/figure.html +14 -0
- data/_includes/footer.html +10 -1
- data/_includes/head.html +21 -0
- data/_includes/nav.html +3 -6
- data/_includes/pager.html +13 -0
- data/_layouts/home.html +13 -9
- data/_layouts/page.html +13 -8
- data/_layouts/post.html +20 -28
- data/lib/jekyll-recker.rb +17 -17
- data/lib/jekyll_recker/commands.rb +27 -0
- data/lib/jekyll_recker/configuration.rb +37 -0
- data/lib/jekyll_recker/error.rb +6 -0
- data/lib/jekyll_recker/extensions.rb +38 -0
- data/lib/jekyll_recker/filters.rb +13 -0
- data/lib/jekyll_recker/generators.rb +110 -0
- data/lib/jekyll_recker/mixins.rb +43 -0
- data/lib/{jekyll-recker → jekyll_recker}/shell.rb +5 -5
- data/lib/jekyll_recker/social.rb +175 -0
- data/lib/jekyll_recker/tags.rb +14 -0
- data/lib/jekyll_recker/utils.rb +37 -0
- data/lib/jekyll_recker/version.rb +5 -0
- metadata +103 -24
- data/_layouts/default.html +0 -16
- data/assets/inconsolata.css +0 -27
- data/assets/jekyll-recker.scss +0 -107
- data/assets/open-sans.css +0 -63
- data/lib/jekyll-recker/commands.rb +0 -12
- data/lib/jekyll-recker/commands/share.rb +0 -25
- data/lib/jekyll-recker/commands/slack.rb +0 -31
- data/lib/jekyll-recker/commands/tweet.rb +0 -31
- data/lib/jekyll-recker/configuration.rb +0 -35
- data/lib/jekyll-recker/error.rb +0 -8
- data/lib/jekyll-recker/generators.rb +0 -17
- data/lib/jekyll-recker/logger.rb +0 -20
- data/lib/jekyll-recker/mixins.rb +0 -27
- data/lib/jekyll-recker/slack.rb +0 -70
- data/lib/jekyll-recker/stats.rb +0 -109
- data/lib/jekyll-recker/tags.rb +0 -16
- data/lib/jekyll-recker/twitter.rb +0 -83
- data/lib/jekyll-recker/version.rb +0 -7
- data/lib/jekyll-recker/words.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78979b0c186d78e9296b547ead2c4f5a908945d7fe83fa498984e9dfa8766fc6
|
4
|
+
data.tar.gz: dc418d310aec0d6245d637e4ac5f20c428f07f954d7416cb03794781d58e263c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70a080461c6462a80c0296a5573f91f2d8f0eb5995d9fda6be73d018af4cd1999cd1816fb7ca18949a18abd06a05740daefc358f2db9f26e37d4249b21207ad4
|
7
|
+
data.tar.gz: 96d7b050be0ad82ae2da7d1e1cadfe4aa328f4f3a780a800243d2027646a16babc22c030619289f8122899accfc24c40546fa2fa443aa70373b15c0280facaa0
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# jekyll-recker
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
The Greatest Jekyll Plugin in the World. For a live example, check
|
4
|
+
out [my personal website].
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -95,12 +95,11 @@ Configure the tweet share in `_config.yml`.
|
|
95
95
|
|
96
96
|
Alternatively, ensure these environment variables are set.
|
97
97
|
|
98
|
-
export
|
99
|
-
export
|
100
|
-
export
|
101
|
-
export
|
98
|
+
export TWITTER_ACCESS_TOKEN_SECRET="..."
|
99
|
+
export TWITTER_ACCESS_TOKEN="..."
|
100
|
+
export TWITTER_CONSUMER_API_KEY="..."
|
101
|
+
export TWITTER_CONSUMER_API_SECRET="..."
|
102
102
|
|
103
103
|
[example slack]: screenshots/example-slack.png
|
104
104
|
[example tweet]: screenshots/example-tweet.png
|
105
|
-
[github]: https://www.github.com/arecker/blog
|
106
105
|
[my personal website]: https://www.alexrecker.com
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<figure>
|
2
|
+
{%- if include.url %}
|
3
|
+
<a href="{{ include.url }}">
|
4
|
+
{%- endif %}
|
5
|
+
<img alt="{{ alt | default: include.filename }}" src="{{ site.baseurl }}assets/images/{{ include.filename }}"/>
|
6
|
+
{%- if include.url %}
|
7
|
+
</a>
|
8
|
+
{%- endif %}
|
9
|
+
{%- if include.caption %}
|
10
|
+
<figcaption>
|
11
|
+
<p>{{ include.caption }}</p>
|
12
|
+
</figcaption>
|
13
|
+
{%- endif %}
|
14
|
+
</figure>
|
data/_includes/footer.html
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
<footer>
|
2
|
-
|
2
|
+
<nav>
|
3
|
+
find me on:  
|
4
|
+
<a href="mailto:{{ site.email }}">email</a>
|
5
|
+
<a href="https://www.github.com/{{ site.github_username }}">github</a>
|
6
|
+
<a href="https://www.twitter.com/{{ site.twitter_username }}">twitter</a>
|
7
|
+
<a href="{{ site.basurl }}/assets/public.gpg.asc">gpg</a>
|
8
|
+
<a href="https://www.linkedin.com/in/{{ site.linkedin_username }}">linkedin</a>
|
9
|
+
<a href="https://www.facebook.com/{{ site.facebook_username }}">facebook</a>
|
10
|
+
</nav>
|
11
|
+
built with <a href="https://jekyllrb.com/">jekyll</a> using <a href="https://www.github.com/arecker/jekyll-recker/">jekyll-recker</a> v{% recker_version %}
|
3
12
|
<br/>
|
4
13
|
<small>© copyright {{ 'now' | date: '%Y' }}, {{ site.author }}</small>
|
5
14
|
</footer>
|
data/_includes/head.html
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
{%- capture title %}{{ include.title | default: page.title }}{%- endcapture %}
|
2
|
+
{%- capture description %}{{ include.description | default: site.description }}{%- endcapture %}
|
3
|
+
{%- capture image %}{{ include.image | default: page.image }}{%- endcapture %}
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8"/>
|
6
|
+
<title>{{ title }} | {{ description }}</title>
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
8
|
+
<meta name="twitter:card" content="summary" />
|
9
|
+
<meta name="twitter:site" content="@{{ site.twitter_username }}" />
|
10
|
+
<meta name="twitter:title" content="{{ include.title }}" />
|
11
|
+
<meta name="twitter:description" content="{{ include.description }}" />
|
12
|
+
<meta property="og:url" content="{{ site.url }}{{ page.url }}" />
|
13
|
+
<meta property="og:type" content="article" />
|
14
|
+
<meta property="og:title" content="{{ title }}"/>
|
15
|
+
<meta property="og:description" content="{{ description }}" />
|
16
|
+
{%- if image %}
|
17
|
+
<meta name="twitter:image" content="{{ site.url }}{{ site.base_url }}/assets/images/{{ image }}"/>
|
18
|
+
<meta property="og:image" content="{{ site.url }}{{ site.base_url }}/assets/images/{{ image }}"/>
|
19
|
+
{%- endif %}
|
20
|
+
<link href="{{ site.baseurl }}/assets/jekyll-recker.css" rel="stylesheet"/>
|
21
|
+
</head>
|
data/_includes/nav.html
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
<nav>
|
2
|
-
<a href="{{ site.baseurl }}/" class="{% if page.active == 'index' %}active{% endif %}">index</a>
|
3
|
-
<a href="{
|
4
|
-
<a href="{% link stats.md %}" class="{% if page.active == 'stats' %}active{% endif %}">stats</a>
|
5
|
-
<a href="{% link projects.md %}" class="{% if page.active == 'projects' %}active{% endif %}">projects</a>
|
6
|
-
<a href="{% link contact.md %}" class="{% if page.active == 'contact' %}active{% endif %}">contact</a>
|
2
|
+
<a href="{{ site.baseurl }}/" class="{% if page.active == 'index' %}active{% endif %}">index.html</a>
|
3
|
+
<a href="{{ site.basurl }}/feed.xml">feed.xml</a>
|
7
4
|
<span class="float-right hide-on-mobile">{{ page.slug }}</span>
|
8
|
-
</nav>
|
5
|
+
</nav>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<nav class="clearfix">
|
2
|
+
{%- if page.next -%}
|
3
|
+
<a href="{{ page.next.url }}">
|
4
|
+
⟵ {{ page.next.slug }}
|
5
|
+
</a>
|
6
|
+
{%- endif -%}
|
7
|
+
{%- if page.previous -%}
|
8
|
+
<a class="float-right" href="{{ page.previous.url }}">
|
9
|
+
{{ page.previous.slug }} ⟶
|
10
|
+
</a>
|
11
|
+
{%- endif -%}
|
12
|
+
</nav>
|
13
|
+
|
data/_layouts/home.html
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
{% include head.html title=site.title %}
|
4
|
+
<body>
|
5
|
+
{% include header.html title=site.title subtitle=site.description %}
|
6
|
+
<hr/>
|
7
|
+
{% include nav.html %}
|
8
|
+
<hr/>
|
9
|
+
{{ content }}
|
10
|
+
<hr/>
|
11
|
+
{% include footer.html %}
|
12
|
+
</body>
|
13
|
+
</html>
|
data/_layouts/page.html
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
{% include head.html title=site.title %}
|
4
|
+
<body>
|
5
|
+
{% include header.html title=page.title subtitle=page.description %}
|
6
|
+
<hr/>
|
7
|
+
{% include nav.html %}
|
8
|
+
<hr/>
|
9
|
+
{{ content }}
|
10
|
+
<hr/>
|
11
|
+
{% include footer.html %}
|
12
|
+
</body>
|
13
|
+
</html>
|
data/_layouts/post.html
CHANGED
@@ -1,28 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
{%
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
{
|
16
|
-
{
|
17
|
-
<
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
</a>
|
22
|
-
{%- endif -%}
|
23
|
-
{%- if page.previous -%}
|
24
|
-
<a class="float-right" href="{{ page.previous.url }}">
|
25
|
-
{{ page.previous.slug }} ⟶
|
26
|
-
</a>
|
27
|
-
</nav>
|
28
|
-
{%- endif -%}
|
1
|
+
{%- capture datestring %}{{ page.date | uyd_date }}{% endcapture %}
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
{% include head.html title=datestring description=page.title %}
|
5
|
+
<body>
|
6
|
+
{% include header.html title=datestring subtitle=page.title %}
|
7
|
+
<hr/>
|
8
|
+
{% include nav.html %}
|
9
|
+
<hr/>
|
10
|
+
{%- if page.image -%}
|
11
|
+
<br/>
|
12
|
+
{% include figure.html filename=page.image %}
|
13
|
+
<br/>
|
14
|
+
{%- endif -%}
|
15
|
+
{{ content }}
|
16
|
+
{% include pager.html %}
|
17
|
+
<hr/>
|
18
|
+
{% include footer.html %}
|
19
|
+
</body>
|
20
|
+
</html>
|
data/lib/jekyll-recker.rb
CHANGED
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
require 'jekyll'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
# jekyll-recker
|
6
|
+
#
|
7
|
+
# The greatest jekyll plugin in the world
|
8
|
+
module JekyllRecker
|
9
|
+
autoload :Configuration, 'jekyll_recker/configuration.rb'
|
10
|
+
autoload :Error, 'jekyll_recker/error.rb'
|
11
|
+
autoload :Mixins, 'jekyll_recker/mixins.rb'
|
12
|
+
autoload :Shell, 'jekyll_recker/shell.rb'
|
13
|
+
autoload :Social, 'jekyll_recker/social.rb'
|
14
|
+
autoload :VERSION, 'jekyll_recker/version.rb'
|
15
|
+
autoload :Utils, 'jekyll_recker/utils.rb'
|
10
16
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
require 'jekyll-recker/stats.rb'
|
18
|
-
require 'jekyll-recker/tags.rb'
|
19
|
-
require 'jekyll-recker/twitter.rb'
|
20
|
-
require 'jekyll-recker/version.rb'
|
21
|
-
require 'jekyll-recker/words.rb'
|
22
|
-
end
|
17
|
+
# Eager loads!
|
18
|
+
require 'jekyll_recker/commands.rb'
|
19
|
+
require 'jekyll_recker/extensions.rb'
|
20
|
+
require 'jekyll_recker/filters.rb'
|
21
|
+
require 'jekyll_recker/generators.rb'
|
22
|
+
require 'jekyll_recker/tags.rb'
|
23
23
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllRecker
|
4
|
+
# Commands
|
5
|
+
module Commands
|
6
|
+
# Share
|
7
|
+
class Share < Jekyll::Command
|
8
|
+
include Mixins::Logging
|
9
|
+
|
10
|
+
def self.init_with_program(prog)
|
11
|
+
prog.command(:share) do |c|
|
12
|
+
c.syntax 'share'
|
13
|
+
c.description 'Share latest post with each configured backend'
|
14
|
+
c.option 'dry', '-d', '--dry', 'perform dry run'
|
15
|
+
c.action { |args, opts| action(args, opts) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.action(args, options)
|
20
|
+
JekyllRecker::Social.action(args, options)
|
21
|
+
rescue ::JekyllRecker::Error => e
|
22
|
+
logger.error e.message
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllRecker
|
4
|
+
# Configuration
|
5
|
+
module Configuration
|
6
|
+
def self.jekyll
|
7
|
+
@jekyll ||= Jekyll.configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.recker
|
11
|
+
jekyll.fetch('recker', {})
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.facebook
|
15
|
+
recker.fetch('facebook', {})
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.twitter
|
19
|
+
recker.fetch('twitter', {})
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.slack
|
23
|
+
recker.fetch('slack', {})
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.site
|
27
|
+
@site = Jekyll::Site.new(jekyll)
|
28
|
+
@site.reset
|
29
|
+
@site.read
|
30
|
+
@site
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.latest_post
|
34
|
+
@latest_post ||= site.posts.docs.last
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Integer extensions
|
4
|
+
class Integer
|
5
|
+
def pretty
|
6
|
+
JekyllRecker::Utils.prettify_number(self)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# String extensions
|
11
|
+
class String
|
12
|
+
def words
|
13
|
+
JekyllRecker::Utils.to_word_list(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
def word_count
|
17
|
+
JekyllRecker::Utils.to_word_list(self).count
|
18
|
+
end
|
19
|
+
|
20
|
+
def pretty_path(home = nil)
|
21
|
+
JekyllRecker::Utils.prettify_path(self, home)
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_and_array
|
25
|
+
JekyllRecker::Utils.and_list_to_array(self)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Array extensions
|
30
|
+
class Array
|
31
|
+
def to_and_list
|
32
|
+
JekyllRecker::Utils.array_to_and_list(self)
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_weighted_list
|
36
|
+
JekyllRecker::Utils.to_weighted_list(self)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllRecker
|
4
|
+
# Filters
|
5
|
+
module Filters
|
6
|
+
# Converts a date object to standard Uhh Yeah Dude format.
|
7
|
+
def uyd_date(date)
|
8
|
+
date.strftime('%A, %B %d %Y')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
Liquid::Template.register_filter(JekyllRecker::Filters)
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllRecker
|
4
|
+
module Generators
|
5
|
+
# Stats Module
|
6
|
+
#
|
7
|
+
# Functions for stats generators.
|
8
|
+
# @abstract
|
9
|
+
module Stats
|
10
|
+
include Mixins::Logging
|
11
|
+
include Jekyll::Filters
|
12
|
+
|
13
|
+
def key
|
14
|
+
self.class.const_get(:KEY)
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate(site)
|
18
|
+
@site = site
|
19
|
+
logger.info "crunching stats.#{key}"
|
20
|
+
@site.data['stats'] ||= {}
|
21
|
+
@site.data['stats'][key] = crunch
|
22
|
+
end
|
23
|
+
|
24
|
+
def crunch
|
25
|
+
raise NotImplementedError, '#crunch not implemented!'
|
26
|
+
end
|
27
|
+
|
28
|
+
# Calculates the average of a list of numbers.
|
29
|
+
#
|
30
|
+
# @param [Array<Numeric>] numlist list of numbers to be averaged.
|
31
|
+
# @return [Numeric] rounded, calculated average of numlist.
|
32
|
+
def average(numlist)
|
33
|
+
calc = numlist.inject { |sum, el| sum + el }.to_f / numlist.size
|
34
|
+
calc.round
|
35
|
+
end
|
36
|
+
|
37
|
+
# Calculates the total of a list of numbers.
|
38
|
+
#
|
39
|
+
# @param [Array<Numeric>] numlist list of numbers to be totaled.
|
40
|
+
# @return [Numeric] calculated total of numlist.
|
41
|
+
def total(numlist)
|
42
|
+
numlist.inject(0) { |sum, x| sum + x }
|
43
|
+
end
|
44
|
+
|
45
|
+
def entries
|
46
|
+
@site.posts.docs.select(&:published?)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Post Count Generator
|
51
|
+
class PostCount < Jekyll::Generator
|
52
|
+
include Stats
|
53
|
+
|
54
|
+
KEY = 'posts'
|
55
|
+
|
56
|
+
def crunch
|
57
|
+
entries.count.pretty
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Word Count Generator
|
62
|
+
class Words < Jekyll::Generator
|
63
|
+
include Stats
|
64
|
+
|
65
|
+
KEY = 'words'
|
66
|
+
|
67
|
+
def crunch
|
68
|
+
total_counts = entries.collect(&:content).map { |c| number_of_words(c) }
|
69
|
+
{
|
70
|
+
'average' => average(total_counts).pretty,
|
71
|
+
'total' => total(total_counts).pretty
|
72
|
+
}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Streak Count Generator
|
77
|
+
class Streaks < Jekyll::Generator
|
78
|
+
include Stats
|
79
|
+
|
80
|
+
KEY = 'days'
|
81
|
+
|
82
|
+
def crunch
|
83
|
+
streaks.take(1).map do |count, dates|
|
84
|
+
{
|
85
|
+
'days' => count.pretty,
|
86
|
+
'start' => dates[0],
|
87
|
+
'end' => dates[1]
|
88
|
+
}
|
89
|
+
end.first
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def streaks
|
95
|
+
_streaks = []
|
96
|
+
entry_dates.slice_when do |prev, curr|
|
97
|
+
curr != prev - 1
|
98
|
+
end.each do |dates|
|
99
|
+
first, last = dates.minmax
|
100
|
+
_streaks << [(last - first).to_i, [first, last]]
|
101
|
+
end
|
102
|
+
_streaks
|
103
|
+
end
|
104
|
+
|
105
|
+
def entry_dates
|
106
|
+
entries.collect(&:date).map { |t| Date.new(t.year, t.month, t.day) }.sort.reverse
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|