distributed-press-api-client 0.1.0 → 0.1.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: 9851a2ea9ababa58c8a990d18cf2bde427e695c70c641b1fc2bf56849fe8bd95
4
- data.tar.gz: 9a883d1d204796510a04f4588e99eed5b2093d410b940d62c7c8dd074fb265e2
3
+ metadata.gz: 73ad534bb05c5ea77506ddafa7243934e6954caabbf1080a3a031bef89a11236
4
+ data.tar.gz: c400d32f71de754f2940044961f680af9d3b927fbd6e11a4816b757f3cb4446b
5
5
  SHA512:
6
- metadata.gz: d19a77c2cef4d0d26c28fb6317c6b0602c8f5c68951c4214a634b136f01a01256077ba3d13f7f4bb1c37f4193bb6f653f7d746b7a3cfef45a300e38481e72ef1
7
- data.tar.gz: b71374a0b60435231a4b61616935433989f727d810ae3b0c9dea924b67d9419095b3c3fa9665f15d33a5819521e469006812c0404cb5b4b124da689af99b506b
6
+ metadata.gz: 76250fbce14ed2a9a159f5c394a153edd936260ccd8bf3f564d81f00613a9ac60cd3a5730878809160b0fa278c5cfb923bcec47206ac3827e4dcbcef70db41eb
7
+ data.tar.gz: d83e4be00733c4566e02415cfa5a1e637db011fe1fc8da6ff3183fa0655baaea384834887e016a7387a39869cc61a8040d2fc6079a792cb3b4cd8d30ec67eccd
data/README.md CHANGED
@@ -45,6 +45,23 @@ API key and project domain can be passed as environment variables called
45
45
  respectively. API URL is optional and defaults to
46
46
  `https://api.distributed.press`.
47
47
 
48
+ ## Jekyll plugin
49
+
50
+ **Note:** May be moved to its own repository.
51
+
52
+ Install and add to `_config.yml`:
53
+
54
+ ```yaml
55
+ plugins:
56
+ - jekyll-distributed-press
57
+ ```
58
+
59
+ Build and publish site:
60
+
61
+ ```bash
62
+ JEKYLL_ENV=production DISTRIBUTED_PRESS_API_KEY=the_api_key bundle exec jekyll build
63
+ ```
64
+
48
65
  ## Contributing
49
66
 
50
67
  Bug reports and pull requests are welcome on 0xacab.org at
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'distributed_press'
4
+
5
+ Jekyll::Hooks.register :site, :post_write, priority: :low do |site|
6
+ next unless ENV['JEKYLL_ENV'] == 'production'
7
+
8
+ hostname = ENV['DISTRIBUTED_PRESS_PROJECT_DOMAIN']
9
+ hostname ||= site.config['hostname']
10
+ hostname ||= URI(site.config['url']).hostname
11
+
12
+ raise URI::Error unless hostname
13
+
14
+ distributed_press = DistributedPress.new project_domain: hostname
15
+ distributed_press.configure && distributed_press.publish(site.destination)
16
+ rescue URI::Error
17
+ Jekyll::Logger.warn "`hostname` or `url` keys missing on _config.yml, skipping Distributed Press publication."
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed-press-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
@@ -34,6 +34,7 @@ extra_rdoc_files:
34
34
  files:
35
35
  - README.md
36
36
  - lib/distributed_press.rb
37
+ - lib/jekyll-distributed-press.rb
37
38
  homepage: https://0xacab.org/sutty/distributed-press-api-client
38
39
  licenses:
39
40
  - AGPL-3.0