asciidoctor-github-include 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4eef1cd3edd907cc787076ac217d434f4be7726c
4
+ data.tar.gz: 960c70636ad1932d5c5bdde93f523a623023233d
5
+ SHA512:
6
+ metadata.gz: 541f4e9e7d342918413dc96f6b856b1c41414b22055a9d69618460c1ca283b93b2a62f8d073aefa427e8f14d5784d2763defdb078e552fed2c760391f5dd2879
7
+ data.tar.gz: a99513b1be53ed0a7462e24ed0da1cc152141087e73a50b55b99b59bc53647b0331e97072fd543fdf390b9161785f83f0291ed428f3cfe6ef4786b973b72b7f7
@@ -0,0 +1,28 @@
1
+ require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
2
+ require 'open-uri'
3
+
4
+ include ::Asciidoctor
5
+
6
+ class GithubPrivateUriIncludeProcessor < Extensions::IncludeProcessor
7
+ def handles? target
8
+ (target.start_with? 'https://raw.githubusercontent.com')
9
+ end
10
+
11
+ def process doc, reader, target, attributes
12
+ begin
13
+ doc.attr('github-access-token').nil? ?
14
+ content = (open target).readlines :
15
+ content = (open target, "Authorization" => "token " + doc.attr('github-access-token')).readlines
16
+ rescue
17
+ warn %(asciidoctor: WARNING: Failed to retrieve GitHub URI #{target}. Did you set :github-access-token:?)
18
+ content = "WARNING: Failed to retrieve GitHub URI link:#{target}[]"
19
+ end
20
+ reader.push_include content, target, target, 1, attributes
21
+ reader
22
+ end
23
+ end
24
+
25
+ Extensions.register do
26
+ include_processor GithubPrivateUriIncludeProcessor
27
+ end
28
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asciidoctor-github-include
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jon Oster
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.5.0
33
+ description: Asciidoctor extension for including files from private GitHub repos
34
+ email:
35
+ - jon@advancedtelematic.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - lib/asciidoctor-github-include.rb
41
+ homepage: https://github.com/tkfu/asciidoctor-github-include
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.4.8
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Fetch files from private GitHub repos when you render your asciidoc files,
65
+ using a GitHub private access token.
66
+ test_files: []