jekyll-git_metadata 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b04abb3fc947d4408d6678a8f897498605d8337d
4
- data.tar.gz: 174fb87059b38b4ae3f1079407cfabb9d5fff318
3
+ metadata.gz: f3014ab1dbe6939519a268f017994fc5402dcf78
4
+ data.tar.gz: 8ac69a4517a11d9376d208a432c49779dec58415
5
5
  SHA512:
6
- metadata.gz: 0f39fff0b23fe6146ae663a212495ffced805bde7202c0aebe13ecdbaf62ed9b83dae4b03eecb9c2bc3375a4cc142017afb3342aa9e97896f93b98972bded7ef
7
- data.tar.gz: 9aba3c7ffefbd555add6b1cfc12fa0c7567df09f336d05c22bf04811c159a6a1fbc2b9257b5857cdefce54c529609ee47e49c79b1c4ce66bca22ec295462147e
6
+ metadata.gz: aedc7a9c9eb90b13a2f40376f6ff75cb7fef94f1589a0eba33b505fcd2e0774838aae9ddc8f24d9aac9118ad652253b5be59ecd6d1a208d86ffae25dc34939a5
7
+ data.tar.gz: a48999e28a7a543206258ea9f87b441640ca49be840927c60ee97d7e0fd17edd8cf0f8ea21a22e60da1df42ee51cde28f0b69e4476275302642e778e905a5b3c
data/.travis.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  language: ruby
2
+ before_script: sudo apt-get update && sudo apt-get install git
2
3
  script: bundle exec rake test
4
+
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/ivantsepp/jekyll-git_metadata.svg?branch=master)](https://travis-ci.org/ivantsepp/jekyll-git_metadata)
2
+
1
3
  # Jekyll::GitMetadata
2
4
 
3
5
  Expose Git metadata to Jekyll. Just like how Github exposes [repository metadata](https://help.github.com/articles/repository-metadata-on-github-pages), this plugin will expose information about your git repository for your templates. For example:
@@ -73,11 +73,8 @@ module Jekyll
73
73
  end
74
74
 
75
75
  def commit(sha)
76
- result = %x{ git show --format=fuller -s #{sha} }
77
- long_sha, author_name, author_email, author_date, commit_name, commit_email, commit_date, message = result
78
- .scan(/commit (.*)\nAuthor:(.*)<(.*)>\nAuthorDate:(.*)\nCommit:(.*)<(.*)>\nCommitDate:(.*)\n\n(.*)/)
79
- .first
80
- .map(&:strip)
76
+ result = %x{ git show --format=fuller --name-only #{sha} }
77
+ long_sha, author_name, author_email, author_date, commit_name, commit_email, commit_date, message, changed_files = result.scan(/commit (.*)\nAuthor:(.*)<(.*)>\nAuthorDate:(.*)\nCommit:(.*)<(.*)>\nCommitDate:(.*)\n\n((?:\s\s\s\s[^\r\n]*\n)*)\n(.*)/m).first.map(&:strip)
81
78
  {
82
79
  'short_sha' => sha,
83
80
  'long_sha' => long_sha,
@@ -87,7 +84,8 @@ module Jekyll
87
84
  'commit_name' => commit_name,
88
85
  'commit_email' => commit_email,
89
86
  'commit_date' => commit_date,
90
- 'message' => message
87
+ 'message' => message.gsub(/ /, ''),
88
+ 'changed_files' => changed_files.split("\n")
91
89
  }
92
90
  end
93
91
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module GitMetadata
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -33,14 +33,14 @@ class Jekyll::GitMetadataTest < Minitest::Test
33
33
  end
34
34
 
35
35
  should 'have correct totals count' do
36
- assert_equal 5, @site_data['total_commits']
37
- assert_equal 670, @site_data['total_additions']
36
+ assert_equal 6, @site_data['total_commits']
37
+ assert_equal 674, @site_data['total_additions']
38
38
  assert_equal 11, @site_data['total_subtractions']
39
39
  end
40
40
 
41
41
  should 'have correct authors data' do
42
42
  assert_equal 2, @site_data['authors'].count
43
- assert @site_data['authors'].include?({"commits"=>4, "name"=>"Ivan Tse", "email"=>"ivan.tse1@gmail.com"})
43
+ assert @site_data['authors'].include?({"commits"=>5, "name"=>"Ivan Tse", "email"=>"ivan.tse1@gmail.com"})
44
44
  assert @site_data['authors'].include?({"commits"=>1, "name"=>"LeBron James", "email"=>"lbj@example.com"})
45
45
  end
46
46
 
@@ -57,15 +57,16 @@ class Jekyll::GitMetadataTest < Minitest::Test
57
57
  end
58
58
 
59
59
  should 'have correct last commit data' do
60
- assert_equal '25d62f6', @site_data['last_commit']['short_sha']
61
- assert_equal '25d62f6feeb7190483f81564f4a76c1ec33d5118', @site_data['last_commit']['long_sha']
62
- assert_equal 'LeBron James', @site_data['last_commit']['author_name']
63
- assert_equal 'lbj@example.com', @site_data['last_commit']['author_email']
64
- assert_equal 'Mon Jul 14 02:12:31 2014 -0400', @site_data['last_commit']['author_date']
60
+ assert_equal '2410dac', @site_data['last_commit']['short_sha']
61
+ assert_equal '2410dac67d5dc5f47a6d790edfed4f65acd9477b', @site_data['last_commit']['long_sha']
62
+ assert_equal 'Ivan Tse', @site_data['last_commit']['author_name']
63
+ assert_equal 'ivan.tse1@gmail.com', @site_data['last_commit']['author_email']
64
+ assert_equal 'Sun Feb 12 01:00:51 2017 -0500', @site_data['last_commit']['author_date']
65
65
  assert_equal 'Ivan Tse', @site_data['last_commit']['commit_name']
66
66
  assert_equal 'ivan.tse1@gmail.com', @site_data['last_commit']['commit_email']
67
- assert_equal 'Mon Jul 14 02:12:31 2014 -0400', @site_data['last_commit']['commit_date']
68
- assert_equal 'Be more friendly', @site_data['last_commit']['message']
67
+ assert_equal 'Sun Feb 12 01:00:51 2017 -0500', @site_data['last_commit']['commit_date']
68
+ assert_equal "This is a long commit message\n\nAs you can tell this commit message will span several lines long because\nI need to test long comit messages too!", @site_data['last_commit']['message']
69
+ assert_equal ["_posts/2014-07-14-welcome-to-jekyll.markdown", "about.md"], @site_data['last_commit']['changed_files']
69
70
  end
70
71
  end
71
72
 
@@ -76,14 +77,14 @@ class Jekyll::GitMetadataTest < Minitest::Test
76
77
  end
77
78
 
78
79
  should 'have correct totals count' do
79
- assert_equal 3, @page_data['total_commits']
80
- assert_equal 14, @page_data['total_additions']
80
+ assert_equal 4, @page_data['total_commits']
81
+ assert_equal 16, @page_data['total_additions']
81
82
  assert_equal 5, @page_data['total_subtractions']
82
83
  end
83
84
 
84
85
  should 'have correct authors data' do
85
86
  assert_equal 2, @page_data['authors'].count
86
- assert @page_data['authors'].include?({"commits"=>2, "name"=>"Ivan Tse", "email"=>"ivan.tse1@gmail.com"})
87
+ assert @page_data['authors'].include?({"commits"=>3, "name"=>"Ivan Tse", "email"=>"ivan.tse1@gmail.com"})
87
88
  assert @page_data['authors'].include?({"commits"=>1, "name"=>"LeBron James", "email"=>"lbj@example.com"})
88
89
  end
89
90
 
@@ -100,15 +101,15 @@ class Jekyll::GitMetadataTest < Minitest::Test
100
101
  end
101
102
 
102
103
  should 'have correct last commit data' do
103
- assert_equal '25d62f6', @page_data['last_commit']['short_sha']
104
- assert_equal '25d62f6feeb7190483f81564f4a76c1ec33d5118', @page_data['last_commit']['long_sha']
105
- assert_equal 'LeBron James', @page_data['last_commit']['author_name']
106
- assert_equal 'lbj@example.com', @page_data['last_commit']['author_email']
107
- assert_equal 'Mon Jul 14 02:12:31 2014 -0400', @page_data['last_commit']['author_date']
104
+ assert_equal '2410dac', @page_data['last_commit']['short_sha']
105
+ assert_equal '2410dac67d5dc5f47a6d790edfed4f65acd9477b', @page_data['last_commit']['long_sha']
106
+ assert_equal 'Ivan Tse', @page_data['last_commit']['author_name']
107
+ assert_equal 'ivan.tse1@gmail.com', @page_data['last_commit']['author_email']
108
+ assert_equal 'Sun Feb 12 01:00:51 2017 -0500', @page_data['last_commit']['author_date']
108
109
  assert_equal 'Ivan Tse', @page_data['last_commit']['commit_name']
109
110
  assert_equal 'ivan.tse1@gmail.com', @page_data['last_commit']['commit_email']
110
- assert_equal 'Mon Jul 14 02:12:31 2014 -0400', @page_data['last_commit']['commit_date']
111
- assert_equal 'Be more friendly', @page_data['last_commit']['message']
111
+ assert_equal 'Sun Feb 12 01:00:51 2017 -0500', @page_data['last_commit']['commit_date']
112
+ assert_equal "This is a long commit message\n\nAs you can tell this commit message will span several lines long because\nI need to test long comit messages too!", @page_data['last_commit']['message']
112
113
  end
113
114
  end
114
115
 
@@ -119,14 +120,14 @@ class Jekyll::GitMetadataTest < Minitest::Test
119
120
  end
120
121
 
121
122
  should 'have correct totals count' do
122
- assert_equal 2, @page_data['total_commits']
123
- assert_equal 28, @page_data['total_additions']
123
+ assert_equal 3, @page_data['total_commits']
124
+ assert_equal 30, @page_data['total_additions']
124
125
  assert_equal 0, @page_data['total_subtractions']
125
126
  end
126
127
 
127
128
  should 'have correct authors data' do
128
129
  assert_equal 1, @page_data['authors'].count
129
- assert @page_data['authors'].include?({"commits"=>2, "name"=>"Ivan Tse", "email"=>"ivan.tse1@gmail.com"})
130
+ assert @page_data['authors'].include?({"commits"=>3, "name"=>"Ivan Tse", "email"=>"ivan.tse1@gmail.com"})
130
131
  end
131
132
 
132
133
  should 'have correct first commit data' do
@@ -142,15 +143,15 @@ class Jekyll::GitMetadataTest < Minitest::Test
142
143
  end
143
144
 
144
145
  should 'have correct last commit data' do
145
- assert_equal '8365a44', @page_data['last_commit']['short_sha']
146
- assert_equal '8365a44c640d5c7cafc8788607a274dfd91b89bb', @page_data['last_commit']['long_sha']
146
+ assert_equal '2410dac', @page_data['last_commit']['short_sha']
147
+ assert_equal '2410dac67d5dc5f47a6d790edfed4f65acd9477b', @page_data['last_commit']['long_sha']
147
148
  assert_equal 'Ivan Tse', @page_data['last_commit']['author_name']
148
149
  assert_equal 'ivan.tse1@gmail.com', @page_data['last_commit']['author_email']
149
- assert_equal 'Mon Jul 14 02:10:03 2014 -0400', @page_data['last_commit']['author_date']
150
+ assert_equal 'Sun Feb 12 01:00:51 2017 -0500', @page_data['last_commit']['author_date']
150
151
  assert_equal 'Ivan Tse', @page_data['last_commit']['commit_name']
151
152
  assert_equal 'ivan.tse1@gmail.com', @page_data['last_commit']['commit_email']
152
- assert_equal 'Mon Jul 14 02:10:03 2014 -0400', @page_data['last_commit']['commit_date']
153
- assert_equal 'Edit first post', @page_data['last_commit']['message']
153
+ assert_equal 'Sun Feb 12 01:00:51 2017 -0500', @page_data['last_commit']['commit_date']
154
+ assert_equal "This is a long commit message\n\nAs you can tell this commit message will span several lines long because\nI need to test long comit messages too!", @page_data['last_commit']['message']
154
155
  end
155
156
  end
156
157
 
@@ -20,6 +20,8 @@ print_hi('Tom')
20
20
 
21
21
  Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].
22
22
 
23
+ Appending to a post.
24
+
23
25
  ---
24
26
 
25
27
  I hope Jekyll::GitMetadata will be a useful plugin!
@@ -7,3 +7,5 @@ permalink: /about/
7
7
  This is a test Jekyll site for Jekyll::GitMetadata. You can view the plugin at [Github](https://github.com/ivantsepp/jekyll-git_metadata).
8
8
 
9
9
  You are welcome to submit pull requests or suggest ideas!
10
+
11
+ Adding some content
@@ -1 +1,14 @@
1
- Be more friendly
1
+ This is a long commit message
2
+
3
+ As you can tell this commit message will span several lines long because
4
+ I need to test long comit messages too!
5
+ # Please enter the commit message for your changes. Lines starting
6
+ # with '#' will be ignored, and an empty message aborts the commit.
7
+ # On branch master
8
+ # Changes to be committed:
9
+ # modified: _posts/2014-07-14-welcome-to-jekyll.markdown
10
+ # modified: about.md
11
+ #
12
+ # Untracked files:
13
+ # dot_git/
14
+ #
Binary file
@@ -3,3 +3,4 @@
3
3
  da077394cb4d5bf7ffac527dbfc652ec0592b423 9e00340e45d33e52bb16100f1b613a36f82f9c57 Ivan Tse <ivan.tse1@gmail.com> 1405318112 -0400 commit: Change about page text
4
4
  9e00340e45d33e52bb16100f1b613a36f82f9c57 8365a44c640d5c7cafc8788607a274dfd91b89bb Ivan Tse <ivan.tse1@gmail.com> 1405318203 -0400 commit: Edit first post
5
5
  8365a44c640d5c7cafc8788607a274dfd91b89bb 25d62f6feeb7190483f81564f4a76c1ec33d5118 Ivan Tse <ivan.tse1@gmail.com> 1405318351 -0400 commit: Be more friendly
6
+ 25d62f6feeb7190483f81564f4a76c1ec33d5118 2410dac67d5dc5f47a6d790edfed4f65acd9477b Ivan Tse <ivan.tse1@gmail.com> 1486879251 -0500 commit: This is a long commit message
@@ -3,3 +3,4 @@
3
3
  da077394cb4d5bf7ffac527dbfc652ec0592b423 9e00340e45d33e52bb16100f1b613a36f82f9c57 Ivan Tse <ivan.tse1@gmail.com> 1405318112 -0400 commit: Change about page text
4
4
  9e00340e45d33e52bb16100f1b613a36f82f9c57 8365a44c640d5c7cafc8788607a274dfd91b89bb Ivan Tse <ivan.tse1@gmail.com> 1405318203 -0400 commit: Edit first post
5
5
  8365a44c640d5c7cafc8788607a274dfd91b89bb 25d62f6feeb7190483f81564f4a76c1ec33d5118 Ivan Tse <ivan.tse1@gmail.com> 1405318351 -0400 commit: Be more friendly
6
+ 25d62f6feeb7190483f81564f4a76c1ec33d5118 2410dac67d5dc5f47a6d790edfed4f65acd9477b Ivan Tse <ivan.tse1@gmail.com> 1486879251 -0500 commit: This is a long commit message
@@ -1 +1 @@
1
- 25d62f6feeb7190483f81564f4a76c1ec33d5118
1
+ 2410dac67d5dc5f47a6d790edfed4f65acd9477b
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-git_metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Tse