jekyll-recker 1.2.1 → 1.6.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 +105 -0
- 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 +14 -13
- data/lib/jekyll_recker/commands.rb +35 -0
- data/lib/{jekyll-recker → jekyll_recker}/configuration.rb +6 -0
- data/lib/{jekyll-recker → jekyll_recker}/error.rb +0 -0
- data/lib/jekyll_recker/facebook.rb +97 -0
- data/lib/jekyll_recker/filters.rb +15 -0
- data/lib/{jekyll-recker/stats.rb → jekyll_recker/generators.rb} +42 -39
- data/lib/{jekyll-recker → jekyll_recker}/logger.rb +0 -0
- data/lib/jekyll_recker/mixins.rb +29 -0
- data/lib/{jekyll-recker → jekyll_recker}/shell.rb +0 -0
- data/lib/{jekyll-recker → jekyll_recker}/slack.rb +10 -1
- data/lib/{jekyll-recker → jekyll_recker}/tags.rb +1 -1
- data/lib/{jekyll-recker → jekyll_recker}/twitter.rb +10 -2
- data/lib/{jekyll-recker → jekyll_recker}/version.rb +1 -1
- data/lib/{jekyll-recker → jekyll_recker}/words.rb +0 -0
- metadata +104 -35
- data/README.org +0 -204
- data/_layouts/default.html +0 -14
- data/assets/jekyll-recker.scss +0 -110
- 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 -30
- data/lib/jekyll-recker/commands/tweet.rb +0 -31
- data/lib/jekyll-recker/generators.rb +0 -17
- data/lib/jekyll-recker/mixins.rb +0 -27
data/README.org
DELETED
@@ -1,204 +0,0 @@
|
|
1
|
-
#+TITLE: jekyll-recker
|
2
|
-
#+SLUG: jekyll-recker.html
|
3
|
-
#+PERMALINK: jekyll-recker.html
|
4
|
-
#+STARTUP: showall
|
5
|
-
#+DESCRIPTION: my website's custom jekyll plugin
|
6
|
-
|
7
|
-
This is the jekyll plugin for my personal website.
|
8
|
-
|
9
|
-
** Installation
|
10
|
-
|
11
|
-
Add =jekyll-recker= to the =jekyll_plugins= group of your =Gemfile=.
|
12
|
-
|
13
|
-
#+BEGIN_SRC ruby
|
14
|
-
group :jekyll_plugins do
|
15
|
-
gem 'jekyll-recker'
|
16
|
-
end
|
17
|
-
#+END_SRC
|
18
|
-
|
19
|
-
Add =jekyll-recker= to the list of plugins in jekyll's =_config.yml=.
|
20
|
-
|
21
|
-
#+BEGIN_SRC yaml
|
22
|
-
# _config.yaml
|
23
|
-
plugins:
|
24
|
-
- jekyll-recker
|
25
|
-
#+END_SRC
|
26
|
-
|
27
|
-
Set the theme.
|
28
|
-
|
29
|
-
#+BEGIN_SRC yaml
|
30
|
-
theme: jekyll-recker
|
31
|
-
#+END_SRC
|
32
|
-
|
33
|
-
Install and enjoy.
|
34
|
-
|
35
|
-
#+BEGIN_SRC sh
|
36
|
-
bundle install
|
37
|
-
bundle exec jekyll serve
|
38
|
-
#+END_SRC
|
39
|
-
|
40
|
-
** Usage
|
41
|
-
|
42
|
-
*** Commands
|
43
|
-
|
44
|
-
**** =slack=
|
45
|
-
|
46
|
-
The =slack= command posts a slack message advertising the latest
|
47
|
-
published jekyll blog post using a private incoming webhook.
|
48
|
-
|
49
|
-
Configure _config.yml
|
50
|
-
|
51
|
-
#+BEGIN_SRC yaml
|
52
|
-
# _config.yml
|
53
|
-
recker:
|
54
|
-
slack:
|
55
|
-
MyTeam:
|
56
|
-
channel: '#blogs' # required!
|
57
|
-
username: 'blogbot' # required!
|
58
|
-
emoji: ':robot:' # required!
|
59
|
-
#+END_SRC
|
60
|
-
|
61
|
-
Multiple teams are supported too!
|
62
|
-
|
63
|
-
#+BEGIN_SRC yaml
|
64
|
-
# _config.yml
|
65
|
-
recker:
|
66
|
-
slack:
|
67
|
-
MyTeamA:
|
68
|
-
channel: '#blogs' # required!
|
69
|
-
username: 'blogbot' # required!
|
70
|
-
emoji: ':robot:' # required!
|
71
|
-
MyTeamB:
|
72
|
-
channel: '#blogs' # required!
|
73
|
-
username: 'blogbot' # required!
|
74
|
-
emoji: ':robot:' # required!
|
75
|
-
MyTeamC:
|
76
|
-
channel: '#blogs' # required!
|
77
|
-
username: 'blogbot' # required!
|
78
|
-
emoji: ':robot:' # required!
|
79
|
-
#+END_SRC
|
80
|
-
|
81
|
-
|
82
|
-
Supply the private webhook through an environment variable.
|
83
|
-
|
84
|
-
#+BEGIN_SRC sh
|
85
|
-
export SLACK_MYTEAM_WEBHOOK="https://..." # SLACK_ + <MyTeam.upcase> + _WEBHOOK
|
86
|
-
#+END_SRC
|
87
|
-
|
88
|
-
Alternatively, add the command with which to retrieve the webhook in
|
89
|
-
_config.yml
|
90
|
-
|
91
|
-
#+BEGIN_SRC yaml
|
92
|
-
# _config.yml
|
93
|
-
recker:
|
94
|
-
slack:
|
95
|
-
MyTeam:
|
96
|
-
webhook_cmd: cat secrets/my-teams-secret-webhook.txt
|
97
|
-
#+END_SRC
|
98
|
-
|
99
|
-
Run =bundle exec jekyll slack= to let it rip!
|
100
|
-
|
101
|
-
[[assets/images/example-slack.png]]
|
102
|
-
|
103
|
-
Using the =--dry= flag, you can preview the message post without
|
104
|
-
actually posting anything.
|
105
|
-
|
106
|
-
#+BEGIN_EXAMPLE
|
107
|
-
arecker@25732-arecker:~/src/blog$ be jekyll slack --dry
|
108
|
-
Configuration file: /Users/arecker/src/blog/_config.yml
|
109
|
-
jekyll-recker: reckerfamily: discovering webhook
|
110
|
-
Configuration file: /Users/arecker/src/blog/_config.yml
|
111
|
-
jekyll-recker: reckerfamily: posting drag racing, windshield wipers, and alex's painting tips
|
112
|
-
jekyll-recker: postign in dry mode, printing message
|
113
|
-
jekyll-recker: BEGIN MESSAGE
|
114
|
-
Sunday, March 15 2020
|
115
|
-
drag racing, windshield wipers, and alex's painting tips
|
116
|
-
https://www.alexrecker.com/2020-03-15.html
|
117
|
-
END MESSAGE
|
118
|
-
#+END_EXAMPLE
|
119
|
-
|
120
|
-
**** =tweet=
|
121
|
-
|
122
|
-
The =tweet= command tweets a link to the latest published jekyll blog
|
123
|
-
post.
|
124
|
-
|
125
|
-
Ensure the following environment variables are set,.
|
126
|
-
|
127
|
-
#+BEGIN_SRC sh
|
128
|
-
export ACCESS_TOKEN_SECRET="..."
|
129
|
-
export ACCESS_TOKEN="..."
|
130
|
-
export CONSUMER_API_KEY="..."
|
131
|
-
export CONSUMER_API_SECRET="..."
|
132
|
-
#+END_SRC
|
133
|
-
|
134
|
-
Alternatively, configure which commands to run to fetch the secrets.
|
135
|
-
|
136
|
-
#+BEGIN_SRC yaml
|
137
|
-
# _config.yml
|
138
|
-
recker:
|
139
|
-
twitter:
|
140
|
-
access_token_secret_cmd: cat secrets/access-token-secret
|
141
|
-
access_token_cmd: cat secrets/access-token
|
142
|
-
consumer_api_key_cmd: cat secrets/consumer-api-key
|
143
|
-
consumer_api_secret_cmd: cat secrets/consumer-api-secret-key
|
144
|
-
#+END_SRC
|
145
|
-
|
146
|
-
Run =bundle exec jekyll tweet= to let it rip!
|
147
|
-
|
148
|
-
[[assets/images/example-tweet.png]]
|
149
|
-
|
150
|
-
Using the =--dry= flag, you can test your configuration without
|
151
|
-
actually tweeting anything.
|
152
|
-
|
153
|
-
#+BEGIN_EXAMPLE
|
154
|
-
arecker@25732-arecker:~/src/blog$ be jekyll tweet --dry
|
155
|
-
jekyll-recker: discovering credentials
|
156
|
-
Configuration file: /Users/arecker/src/blog/_config.yml
|
157
|
-
Configuration file: /Users/arecker/src/blog/_config.yml
|
158
|
-
jekyll-recker: tweeting drag racing, windshield wipers, and alex's painting tips
|
159
|
-
jekyll-recker: tweeting in dry mode, printing message
|
160
|
-
jekyll-recker: BEGIN TWEET
|
161
|
-
Sunday, March 15 2020
|
162
|
-
drag racing, windshield wipers, and alex's painting tips
|
163
|
-
https://www.alexrecker.com/2020-03-15.html
|
164
|
-
END TWEET
|
165
|
-
#+END_EXAMPLE
|
166
|
-
|
167
|
-
*** Generators
|
168
|
-
|
169
|
-
**** =stats=
|
170
|
-
|
171
|
-
On build time, =jekyll-recker= calculates and stores the following
|
172
|
-
stats in the =site.data.stats= object
|
173
|
-
|
174
|
-
| Field Name | Field Description |
|
175
|
-
|-----------------+------------------------------------------------------|
|
176
|
-
| =posts= | The total number of published posts. |
|
177
|
-
| =words.total= | The total number of words from all published post. |
|
178
|
-
| =words.average= | The average number of words for each published post. |
|
179
|
-
| =days.days= | Current streak of daily, consecutive posts. |
|
180
|
-
| =days.start= | First day of current streak. |
|
181
|
-
| =days.end= | Last day of current streak. |
|
182
|
-
|
183
|
-
Use these variables to render your own page of neat writing statistics!
|
184
|
-
|
185
|
-
#+BEGIN_SRC html
|
186
|
-
<table>
|
187
|
-
<tr>
|
188
|
-
<th>Total Posts</th>
|
189
|
-
<th>Total Words</th>
|
190
|
-
<th>Average Words per Post</th>
|
191
|
-
<th>Current Streak</th>
|
192
|
-
<th>First day of current streak</th>
|
193
|
-
<th>Last day of current streak</th>
|
194
|
-
</tr>
|
195
|
-
<tr>
|
196
|
-
<td>{{ site.data.stats.posts }}</td>
|
197
|
-
<td>{{ site.data.stats.words.total }}</td>
|
198
|
-
<td>{{ site.data.stats.words.average }}</td>
|
199
|
-
<td>{{ site.data.stats.days.days }}</td>
|
200
|
-
<td>{{ site.data.stats.days.start }}</td>
|
201
|
-
<td>{{ site.data.stats.days.end }}</td>
|
202
|
-
</tr>
|
203
|
-
</table>
|
204
|
-
#+END_SRC
|
data/_layouts/default.html
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8"/>
|
5
|
-
<title>{{ site.title }} | {{ page.title | default: site.description }}</title>
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
-
<link href="{{ site.baseurl }}/assets/jekyll-recker.css" rel="stylesheet"/>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
{{ content }}
|
11
|
-
<hr/>
|
12
|
-
{% include footer.html %}
|
13
|
-
</body>
|
14
|
-
</html>
|
data/assets/jekyll-recker.scss
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
---
|
2
|
-
---
|
3
|
-
// @import 'https://fonts.googleapis.com/css?family=Titillium+Web&display=swap';
|
4
|
-
@import 'https://fonts.googleapis.com/css?family=Open+Sans&display=swap';
|
5
|
-
@import 'https://fonts.googleapis.com/css?family=Inconsolata&display=swap';
|
6
|
-
|
7
|
-
.float-right {
|
8
|
-
float: right;
|
9
|
-
}
|
10
|
-
|
11
|
-
.float-left {
|
12
|
-
float: left;
|
13
|
-
}
|
14
|
-
|
15
|
-
.clearfix::after {
|
16
|
-
content: "";
|
17
|
-
clear: both;
|
18
|
-
display: block;
|
19
|
-
}
|
20
|
-
|
21
|
-
@media screen and (max-width: 600px) {
|
22
|
-
.hide-on-mobile {
|
23
|
-
display: none;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
ul.unstyled {
|
28
|
-
list-style-type: none;
|
29
|
-
margin: 0;
|
30
|
-
padding: 0;
|
31
|
-
}
|
32
|
-
|
33
|
-
body {
|
34
|
-
margin: 40px auto;
|
35
|
-
max-width: 800px;
|
36
|
-
line-height: 1.6;
|
37
|
-
font-size: 18px;
|
38
|
-
color: #444;
|
39
|
-
padding: 0 10px;
|
40
|
-
}
|
41
|
-
|
42
|
-
h1, h2, h3 {
|
43
|
-
line-height: 1.2;
|
44
|
-
}
|
45
|
-
|
46
|
-
header {
|
47
|
-
h1 {
|
48
|
-
margin-bottom: 9px;
|
49
|
-
}
|
50
|
-
|
51
|
-
p {
|
52
|
-
margin-top: 9px;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
figure {
|
57
|
-
img {
|
58
|
-
display: block;
|
59
|
-
margin-left: auto;
|
60
|
-
margin-right: auto;
|
61
|
-
vertical-align: top;
|
62
|
-
height: auto;
|
63
|
-
max-width: 100%;
|
64
|
-
}
|
65
|
-
|
66
|
-
figcaption {
|
67
|
-
text-align: center;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
nav {
|
72
|
-
a {
|
73
|
-
margin-right: 10px;
|
74
|
-
}
|
75
|
-
|
76
|
-
a.active {
|
77
|
-
color: black !important;
|
78
|
-
}
|
79
|
-
|
80
|
-
span {
|
81
|
-
color: #6f7370;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
a {
|
86
|
-
text-decoration: none !important;
|
87
|
-
color: #008083 !important;
|
88
|
-
|
89
|
-
:hover {
|
90
|
-
text-decoration: underline !important;
|
91
|
-
}
|
92
|
-
|
93
|
-
:active {
|
94
|
-
color: #6f7370 !important;
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
* {
|
99
|
-
// font-family: 'Titillium Web', sans-serif !important;
|
100
|
-
font-family: 'Open Sans', 'sans-serif' !important;
|
101
|
-
}
|
102
|
-
|
103
|
-
code, pre, pre span {
|
104
|
-
font-family: Inconsolata, monospace !important;
|
105
|
-
}
|
106
|
-
|
107
|
-
pre, pre span {
|
108
|
-
font-size: 14px;
|
109
|
-
}
|
110
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Recker
|
5
|
-
module Commands
|
6
|
-
# Share
|
7
|
-
class Share < Jekyll::Command
|
8
|
-
include Jekyll::Recker::LoggingMixin
|
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 do |_args, _options|
|
16
|
-
logger.info 'normally I\'d share here'
|
17
|
-
rescue ReckerError => e
|
18
|
-
logger.abort_with e.message
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Recker
|
5
|
-
module Commands
|
6
|
-
# Slack
|
7
|
-
class Slack < Jekyll::Command
|
8
|
-
class << self
|
9
|
-
def init_with_program(prog)
|
10
|
-
prog.command(:slack) do |c|
|
11
|
-
c.syntax 'slack'
|
12
|
-
c.description 'slack latest post'
|
13
|
-
c.option 'dry', '-d', '--dry', 'print message instead of posting'
|
14
|
-
c.action do |_args, options|
|
15
|
-
Recker::Slack.each_in_config(dry: options['dry']) do |client|
|
16
|
-
Recker.info "#{client.key}: discovering webhook"
|
17
|
-
client.discover_webhook!
|
18
|
-
Recker.info "#{client.key}: posting #{client.latest.data['title']}"
|
19
|
-
client.post_latest!
|
20
|
-
end
|
21
|
-
rescue ReckerError => e
|
22
|
-
Recker.abort_with e.message
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Recker
|
5
|
-
module Commands
|
6
|
-
# Tweet
|
7
|
-
class Tweet < Jekyll::Command
|
8
|
-
include LoggingMixin
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def init_with_program(prog)
|
12
|
-
prog.command(:tweet) do |c|
|
13
|
-
c.syntax 'tweet'
|
14
|
-
c.description 'tweet latest post'
|
15
|
-
c.option 'dry', '-d', '--dry', 'print message instead of tweeting'
|
16
|
-
c.action do |_args, options|
|
17
|
-
client = Jekyll::Recker::Twitter.new(dry: options['dry'])
|
18
|
-
logger.info 'discovering credentials'
|
19
|
-
client.discover_credentials!
|
20
|
-
logger.info "tweeting #{client.latest.data['title']}"
|
21
|
-
client.post_latest!
|
22
|
-
rescue ReckerError => e
|
23
|
-
logger.abort_with e.message
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Recker
|
5
|
-
module Generators
|
6
|
-
# StatsGenerator
|
7
|
-
class StatsGenerator < Jekyll::Generator
|
8
|
-
include Jekyll::Recker::LoggingMixin
|
9
|
-
|
10
|
-
def generate(site)
|
11
|
-
logger.info 'generating site statistics'
|
12
|
-
site.data['stats'] = Stats.crunch(site)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|