jekyll-git-authors 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 +4 -4
- data/README.md +1 -1
- data/lib/jekyll-git-authors.rb +28 -16
- data/lib/jekyll-git-authors/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f16a9833a6d2c0ea29b3af6e0ede1455154b8d0e8216018c68f058e37d10a4
|
4
|
+
data.tar.gz: 5e069b91a4fc9179d3b6b7b0f3aee15ab72a23365e2c2a07b340ff6b57fcc2d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6db8590b31df33735fb64dcb05679c555f153e9f33017b6a7ae76dc843e923a0f1ab4f46d8dff2d8526ac894da9506abe5aa71f8aee074a1e1e39ed72cd8ff16
|
7
|
+
data.tar.gz: 8c179ba6c81ab872ab7660a8f7e1c0b063e8c211f115e947a96136af406d6bbd12c73412ea29665eb2c6def510fb1f3f3e0dbddb86c88f84189add4488f1877d
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Be sure to also have [jekyll-email-protect](https://github.com/vwochnik/jekyll-e
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
This plugin is available as a [rubygem]().
|
8
|
+
This plugin is available as a [rubygem](https://rubygems.org/gems/jekyll-git-authors).
|
9
9
|
|
10
10
|
Add this line to your application's `Gemfile`:
|
11
11
|
|
data/lib/jekyll-git-authors.rb
CHANGED
@@ -72,7 +72,7 @@ module Git
|
|
72
72
|
# Create instance of Git::Submodules and execute expected command.
|
73
73
|
# We receive array of absolute paths of all submodules
|
74
74
|
def self.submodules
|
75
|
-
Submodules.new(execute('submodule foreach
|
75
|
+
Submodules.new(execute('submodule foreach pwd'))
|
76
76
|
end
|
77
77
|
|
78
78
|
# Create instance of Git::Log and pass it output from git log command
|
@@ -104,31 +104,43 @@ module Jekyll
|
|
104
104
|
def generate(site)
|
105
105
|
puts "\nGenerating authors"
|
106
106
|
|
107
|
-
repositories = Git.submodules
|
107
|
+
repositories = Git.submodules.extract_path
|
108
108
|
|
109
109
|
# For each submodule we go into directory of that submodule
|
110
|
+
# delete the submodule dir from page path
|
110
111
|
# before executing Git#log, then go back where we were.
|
111
112
|
site.pages.each do |page|
|
112
|
-
|
113
|
+
file = page.path
|
114
|
+
if file =~ /\.md/
|
113
115
|
repositories.each do |repository|
|
114
|
-
|
115
|
-
|
116
|
-
|
116
|
+
if file =~ /^#{repository}/
|
117
|
+
original_dir = Dir.pwd
|
118
|
+
Dir.chdir repository
|
117
119
|
|
118
|
-
|
119
|
-
author_md = author_md.sort
|
120
|
-
author_md = author_md.map { |a, e| Markdown.mailto(a, e) }
|
120
|
+
file.sub!(repository, '.')
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
author_md = Git.log(file).author_email
|
123
|
+
author_md = author_md.sort
|
124
|
+
author_md = author_md.map { |a, e| Markdown.mailto(a, e) }
|
125
125
|
|
126
|
-
|
126
|
+
output = author_md.join ', '
|
127
|
+
output = "Authors: #{output}"
|
128
|
+
output = Markdown.center output
|
127
129
|
|
128
|
-
|
130
|
+
page.content += output
|
129
131
|
|
130
|
-
|
131
|
-
|
132
|
+
Dir.chdir original_dir
|
133
|
+
else
|
134
|
+
author_md = Git.log(file).author_email
|
135
|
+
author_md = author_md.sort
|
136
|
+
author_md = author_md.map { |a, e| Markdown.mailto(a, e) }
|
137
|
+
|
138
|
+
output = author_md.join ', '
|
139
|
+
output = "Authors: #{output}"
|
140
|
+
output = Markdown.center output
|
141
|
+
|
142
|
+
page.content += output
|
143
|
+
end
|
132
144
|
end
|
133
145
|
end
|
134
146
|
end
|