jekyll-readme-index 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/jekyll-readme-index.rb +5 -0
- data/lib/jekyll-readme-index/generator.rb +42 -0
- data/lib/jekyll-readme-index/version.rb +3 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9bc7c506d7f680ea917ae338e110518bdb8078a
|
4
|
+
data.tar.gz: f5ae60ee147bc8cf4f8dae4c4d372ed740a015b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4cf1e81d7e4a64e7d925969a23b70d68b24f7832196f66df907edbad761d68a812d1656da500a575c0c8ad988f1d43e6c11b04c2ab5e42786f8819536c1428f4
|
7
|
+
data.tar.gz: d1da4e793a76ef533bd929c43395e4f2e7b062b1b3c110dc7cec47bba231805caadfa261ad144159b4e19801e5c9e5a1e9af834d8c0c880a8ca4ef647d973c55
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module JekyllReadmeIndex
|
2
|
+
class Generator < Jekyll::Generator
|
3
|
+
README_REGEX = %r!^/readme(\.[^.]+)?$!i
|
4
|
+
INDEX_REGEX = %r!^/index.html?$!i
|
5
|
+
|
6
|
+
attr_accessor :site
|
7
|
+
|
8
|
+
safe true
|
9
|
+
priority :low
|
10
|
+
|
11
|
+
def initialize(site)
|
12
|
+
@site = site
|
13
|
+
end
|
14
|
+
|
15
|
+
def generate(site)
|
16
|
+
@site = site
|
17
|
+
|
18
|
+
return if index? || readme.nil?
|
19
|
+
site.pages << page
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def readme
|
25
|
+
site.static_files.find { |file| file.relative_path =~ README_REGEX }
|
26
|
+
end
|
27
|
+
|
28
|
+
def index?
|
29
|
+
site.pages.any? { |page| page.url == "/" } ||
|
30
|
+
site.static_files.any? { |file| file.url =~ INDEX_REGEX }
|
31
|
+
end
|
32
|
+
|
33
|
+
def page
|
34
|
+
base = readme.instance_variable_get("@base")
|
35
|
+
dir = readme.instance_variable_get("@dir")
|
36
|
+
name = readme.instance_variable_get("@name")
|
37
|
+
page = Jekyll::Page.new(site, base, dir, name)
|
38
|
+
page.data["permalink"] = "/"
|
39
|
+
page
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-readme-index
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Balter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.40'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.40'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- ben.balter@github.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/jekyll-readme-index.rb
|
63
|
+
- lib/jekyll-readme-index/generator.rb
|
64
|
+
- lib/jekyll-readme-index/version.rb
|
65
|
+
homepage: https://github.com/benbalter/jekyll-readme-index
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.6.6
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: A Jekyll plugin to render a project's README as the site's index.
|
89
|
+
test_files: []
|