about_page 0.2.7 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +3 -0
- data/about_page.gemspec +2 -1
- data/app/assets/stylesheets/about_page.scss +21 -1
- data/app/views/about_page/about/_git_log.html.erb +41 -0
- data/lib/about_page.rb +1 -0
- data/lib/about_page/engine.rb +3 -0
- data/lib/about_page/git_log.rb +28 -0
- data/lib/about_page/version.rb +1 -1
- data/spec/features/about_page_spec.rb +1 -1
- data/spec/features/health_spec.rb +2 -2
- data/spec/fixtures/README.md +0 -0
- data/spec/fixtures/dot_git/COMMIT_EDITMSG +1 -0
- data/spec/fixtures/dot_git/HEAD +1 -0
- data/spec/fixtures/dot_git/config +7 -0
- data/spec/fixtures/dot_git/description +1 -0
- data/spec/fixtures/dot_git/hooks/applypatch-msg.sample +15 -0
- data/spec/fixtures/dot_git/hooks/commit-msg.sample +24 -0
- data/spec/fixtures/dot_git/hooks/post-update.sample +8 -0
- data/spec/fixtures/dot_git/hooks/pre-applypatch.sample +14 -0
- data/spec/fixtures/dot_git/hooks/pre-commit.sample +49 -0
- data/spec/fixtures/dot_git/hooks/pre-push.sample +54 -0
- data/spec/fixtures/dot_git/hooks/pre-rebase.sample +169 -0
- data/spec/fixtures/dot_git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/fixtures/dot_git/hooks/update.sample +128 -0
- data/spec/fixtures/dot_git/index +0 -0
- data/spec/fixtures/dot_git/info/exclude +6 -0
- data/spec/fixtures/dot_git/logs/HEAD +13 -0
- data/spec/fixtures/dot_git/logs/refs/heads/changes +2 -0
- data/spec/fixtures/dot_git/logs/refs/heads/master +10 -0
- data/spec/fixtures/dot_git/objects/0f/77d1d716c52571abb8e6e42804061a35163109 +3 -0
- data/spec/fixtures/dot_git/objects/11/d90eb028fccb636afd602c79ed8b972d4bdcdc +0 -0
- data/spec/fixtures/dot_git/objects/1b/0f59702ab12d0081b139790e5e534a6d4c6497 +3 -0
- data/spec/fixtures/dot_git/objects/27/0ed00ed85f5d85bbf93e0031da068f3826c861 +0 -0
- data/spec/fixtures/dot_git/objects/2c/c95862fce4c3d4d00233f6adbafa1ff8d90f6d +0 -0
- data/spec/fixtures/dot_git/objects/49/8a9d05fd31925befce4a4157f52e9fa790d6ba +0 -0
- data/spec/fixtures/dot_git/objects/5a/def156c19f70c6b0acb68ee52da3e3f3c1ac70 +0 -0
- data/spec/fixtures/dot_git/objects/6c/d5be8bbb45fd873e93815e68267d964e0498ad +0 -0
- data/spec/fixtures/dot_git/objects/71/885c8f88ef89ad3a503383fa52d75a7ffebc96 +0 -0
- data/spec/fixtures/dot_git/objects/76/bb13ca91b6b8c012a567f2fead60994aced279 +0 -0
- data/spec/fixtures/dot_git/objects/8a/3e086e86082d395adf1d5d307688e7eddf373b +0 -0
- data/spec/fixtures/dot_git/objects/8f/93524577981087cb8bdd16ff3de628e32ddd03 +0 -0
- data/spec/fixtures/dot_git/objects/9b/fb6eaf845d51e4637083824a3a0e75d608acef +0 -0
- data/spec/fixtures/dot_git/objects/a6/34b0a1744154fa6d05d0d2a82a5ab0e2915b10 +3 -0
- data/spec/fixtures/dot_git/objects/ac/4be5027e6aa9dbf80c762f46647e4854b2d2ea +0 -0
- data/spec/fixtures/dot_git/objects/b8/cbe299f4b8947ab07a6e1ee79c015f47010f05 +0 -0
- data/spec/fixtures/dot_git/objects/c2/b7db3786b68834d4ed540b0e45ddcdd102b99e +0 -0
- data/spec/fixtures/dot_git/objects/cd/3c5e9aefdf4772f35e37552de61ce1cd96c63c +0 -0
- data/spec/fixtures/dot_git/objects/d2/2536083f68aab3013df16b56778b643e9b3e09 +0 -0
- data/spec/fixtures/dot_git/objects/d2/dbef1ed2244f46a0910a9fa26aaa78b064680f +0 -0
- data/spec/fixtures/dot_git/objects/d8/91cd57bb52df201d435c067ce70ae15a56d460 +0 -0
- data/spec/fixtures/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/spec/fixtures/dot_git/objects/f0/8a0cb3d8083f7389f0281391f6e5316ea3c5be +3 -0
- data/spec/fixtures/dot_git/objects/f5/c347a93feee4bf68835d7913e64a2c8f7ecc2a +0 -0
- data/spec/fixtures/dot_git/refs/heads/changes +1 -0
- data/spec/fixtures/dot_git/refs/heads/master +1 -0
- data/spec/fixtures/dot_git/refs/tags/v0.5 +1 -0
- data/spec/fixtures/file.txt +0 -0
- data/spec/fixtures/file_1 +0 -0
- data/spec/fixtures/file_2 +0 -0
- data/spec/fixtures/file_3 +0 -0
- data/spec/fixtures/file_4 +0 -0
- data/spec/fixtures/file_5 +0 -0
- data/spec/fixtures/file_6 +0 -0
- data/spec/fixtures/file_7 +0 -0
- data/spec/fixtures/file_8 +0 -0
- data/spec/fixtures/file_9 +0 -0
- data/spec/lib/git_log_spec.rb +31 -0
- data/spec/lib/solr_spec.rb +7 -17
- metadata +134 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjI3YWY5NDQwMzNmOWY3MDUyMGFlMzZiZjZiYjI1NTA0ZmU3NzYwMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGFkZTQ2N2U1YmI4OGYzMjc3NjM1MDIwYTVhYWIyNDEzYThmMmIzMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDFiZTI2MDYzNmU5YjZmM2Y1NDMwZTE0OTYwYjBkNjMwOTBjNmE1YjI0OWQ0
|
10
|
+
YjVlMmNkYmY1MWY2MWZjZTE5ZWQxMDBkMDE0MDg4YjhjMGZjMjZiZjg0OGM1
|
11
|
+
OWEyNGEwZjg0OTNhOTkyZjEwMGM4MTliOTBjYWQ2NDk3M2E1NTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjNhNDU5NDE1NGQwNWE4ZjZjOTMyYmMzNWFlY2RkMzA0NDhiZmU2NDg1ZWJj
|
14
|
+
Njg3ZjQwYzJkYzJiZGNlN2IxMTgxZGNiNTMzYmI2MjNkZDU1OTZiOWRmMmMw
|
15
|
+
Yjk1ZGMyY2FmMWUwZDJhMjZiYWY3N2I5NjUyMmU0NDc5NjQwNGU=
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# AboutPage
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/sul-dlss/about_page.svg?branch=master)](https://travis-ci.org/sul-dlss/about_page)
|
4
|
+
|
3
5
|
To use in a Hydra app:
|
4
6
|
|
5
7
|
# In Gemfile
|
@@ -19,6 +21,7 @@ To use in a Hydra app:
|
|
19
21
|
config.dependencies = AboutPage::Dependencies.new
|
20
22
|
config.fedora = AboutPage::Fedora.new(ActiveFedora::Base.connection_for_pid(0)) # Rubydora::Repository instance
|
21
23
|
config.solr = AboutPage::Solr.new(ActiveFedora.solr) # RSolr instance
|
24
|
+
config.git = AboutPage::GitLog.new(15) # Display the last 15 git commits
|
22
25
|
end
|
23
26
|
|
24
27
|
# In config/routes.rb
|
data/about_page.gemspec
CHANGED
@@ -17,7 +17,8 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
|
19
19
|
s.add_dependency "rails", ">= 3.2"
|
20
|
-
s.
|
20
|
+
s.add_dependency "grit" unless defined? JRUBY_VERSION
|
21
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
21
22
|
s.add_development_dependency "rspec-rails"
|
22
23
|
s.add_development_dependency "capybara"
|
23
24
|
s.add_development_dependency "launchy"
|
@@ -21,4 +21,24 @@
|
|
21
21
|
|
22
22
|
dl.dl-horizontal dd {
|
23
23
|
margin-bottom: 0px;
|
24
|
-
}
|
24
|
+
}
|
25
|
+
|
26
|
+
.git-log {
|
27
|
+
white-space: nowrap;
|
28
|
+
table {
|
29
|
+
width: 100%;
|
30
|
+
font-size: 85%;
|
31
|
+
table-layout: fixed;
|
32
|
+
tr:nth-child(odd) { background-color: lightgrey; }
|
33
|
+
td {
|
34
|
+
padding: 0px 3px;
|
35
|
+
text-overflow: ellipsis;
|
36
|
+
overflow: hidden;
|
37
|
+
&.mono { font-family: consolas, andale-mono, monospace; }
|
38
|
+
}
|
39
|
+
col.git-time { width: 20%; }
|
40
|
+
col.git-sha { width: 8%; }
|
41
|
+
col.git-desc { width: 50%; }
|
42
|
+
col.git-auth { width: 22%; }
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<h2>Git Log</h2>
|
2
|
+
<div class="git-log">
|
3
|
+
<p>
|
4
|
+
<span class="label label-info">Local Branch</span>
|
5
|
+
<span class="label label-warning">Remote Branch</span>
|
6
|
+
<span class="label label-danger">Tag</span>
|
7
|
+
</p>
|
8
|
+
<table>
|
9
|
+
<colgroup>
|
10
|
+
<col class="git-time"/>
|
11
|
+
<col class="git-sha"/>
|
12
|
+
<col class="git-desc"/>
|
13
|
+
<col class="git-auth"/>
|
14
|
+
</colgroup>
|
15
|
+
<tbody>
|
16
|
+
<% profile.commits.each do |commit| %>
|
17
|
+
<tr>
|
18
|
+
<td class="mono"><%= Time.parse(commit[:commit]['authored_date']).to_s %></td>
|
19
|
+
<td class="mono"><%= commit[:commit]['id'][0..6] %></td>
|
20
|
+
<td>
|
21
|
+
<% Array(commit[:refs]).each do |ref| %>
|
22
|
+
<%
|
23
|
+
ref_class = 'label label-'
|
24
|
+
if ref =~ %r{/remotes/}
|
25
|
+
ref_class << 'warning'
|
26
|
+
elsif ref =~ %r{/tags/}
|
27
|
+
ref_class << 'danger'
|
28
|
+
else
|
29
|
+
ref_class << 'info'
|
30
|
+
end
|
31
|
+
%>
|
32
|
+
<span class="<%=ref_class%>"><%= ref.split(%r{^refs/(heads|remotes|tags)/}).last %></span>
|
33
|
+
<% end %>
|
34
|
+
<span class="git-msg"><%= commit[:commit]['message'].lines.first.chomp %></span>
|
35
|
+
</td>
|
36
|
+
<td><%= '%s <%s>' % commit[:commit]['author'].values_at('name','email') %></td>
|
37
|
+
</tr>
|
38
|
+
<% end %>
|
39
|
+
</tbody>
|
40
|
+
</table>
|
41
|
+
</div>
|
data/lib/about_page.rb
CHANGED
data/lib/about_page/engine.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'grit'
|
2
|
+
|
3
|
+
module AboutPage
|
4
|
+
class GitLog < AboutPage::Configuration::Node
|
5
|
+
attr_reader :commits
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
root = opts.fetch(:root, Rails.root)
|
9
|
+
limit = opts.fetch(:limit, %r{/tags/})
|
10
|
+
repo = Grit::Repo.new(root)
|
11
|
+
refs = repo.refs_list.inject(Hash.new { |h,k| h[k] = [] }) { |h,r| h[r[1]] << r[0]; h }
|
12
|
+
@commits = repo.log(repo.head.name).inject([]) do |a,c|
|
13
|
+
a << { :commit => c.to_hash, :refs => refs[c.sha] }
|
14
|
+
bail = case limit
|
15
|
+
when Fixnum then a.length == limit
|
16
|
+
when Regexp then a.last[:refs].any? { |ref| ref =~ limit }
|
17
|
+
when Time then c.committed_date < limit
|
18
|
+
when Proc then limit.call(c)
|
19
|
+
end
|
20
|
+
if bail then break(a) else a end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_h
|
25
|
+
@commits
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/about_page/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "the health page", :type => :
|
3
|
+
describe "the health page", :type => :feature do
|
4
4
|
before :all do
|
5
5
|
module AboutPage
|
6
6
|
class HealthTest < AboutPage::Configuration::Node
|
@@ -71,4 +71,4 @@ describe "the health page", :type => :request do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
74
|
-
end
|
74
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Add file_9
|
@@ -0,0 +1 @@
|
|
1
|
+
ref: refs/heads/master
|
@@ -0,0 +1 @@
|
|
1
|
+
Unnamed repository; edit this file 'description' to name the repository.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to check the commit log message taken by
|
4
|
+
# applypatch from an e-mail message.
|
5
|
+
#
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
7
|
+
# appropriate message if it wants to stop the commit. The hook is
|
8
|
+
# allowed to edit the commit message file.
|
9
|
+
#
|
10
|
+
# To enable this hook, rename this file to "applypatch-msg".
|
11
|
+
|
12
|
+
. git-sh-setup
|
13
|
+
test -x "$GIT_DIR/hooks/commit-msg" &&
|
14
|
+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
15
|
+
:
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to check the commit log message.
|
4
|
+
# Called by "git commit" with one argument, the name of the file
|
5
|
+
# that has the commit message. The hook should exit with non-zero
|
6
|
+
# status after issuing an appropriate message if it wants to stop the
|
7
|
+
# commit. The hook is allowed to edit the commit message file.
|
8
|
+
#
|
9
|
+
# To enable this hook, rename this file to "commit-msg".
|
10
|
+
|
11
|
+
# Uncomment the below to add a Signed-off-by line to the message.
|
12
|
+
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
13
|
+
# hook is more suited to it.
|
14
|
+
#
|
15
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
16
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
17
|
+
|
18
|
+
# This example catches duplicate Signed-off-by lines.
|
19
|
+
|
20
|
+
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
21
|
+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
22
|
+
echo >&2 Duplicate Signed-off-by lines.
|
23
|
+
exit 1
|
24
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to verify what is about to be committed
|
4
|
+
# by applypatch from an e-mail message.
|
5
|
+
#
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
7
|
+
# appropriate message if it wants to stop the commit.
|
8
|
+
#
|
9
|
+
# To enable this hook, rename this file to "pre-applypatch".
|
10
|
+
|
11
|
+
. git-sh-setup
|
12
|
+
test -x "$GIT_DIR/hooks/pre-commit" &&
|
13
|
+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
|
14
|
+
:
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to verify what is about to be committed.
|
4
|
+
# Called by "git commit" with no arguments. The hook should
|
5
|
+
# exit with non-zero status after issuing an appropriate message if
|
6
|
+
# it wants to stop the commit.
|
7
|
+
#
|
8
|
+
# To enable this hook, rename this file to "pre-commit".
|
9
|
+
|
10
|
+
if git rev-parse --verify HEAD >/dev/null 2>&1
|
11
|
+
then
|
12
|
+
against=HEAD
|
13
|
+
else
|
14
|
+
# Initial commit: diff against an empty tree object
|
15
|
+
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
16
|
+
fi
|
17
|
+
|
18
|
+
# If you want to allow non-ASCII filenames set this variable to true.
|
19
|
+
allownonascii=$(git config --bool hooks.allownonascii)
|
20
|
+
|
21
|
+
# Redirect output to stderr.
|
22
|
+
exec 1>&2
|
23
|
+
|
24
|
+
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
25
|
+
# them from being added to the repository. We exploit the fact that the
|
26
|
+
# printable range starts at the space character and ends with tilde.
|
27
|
+
if [ "$allownonascii" != "true" ] &&
|
28
|
+
# Note that the use of brackets around a tr range is ok here, (it's
|
29
|
+
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
30
|
+
# the square bracket bytes happen to fall in the designated range.
|
31
|
+
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
32
|
+
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
33
|
+
then
|
34
|
+
cat <<\EOF
|
35
|
+
Error: Attempt to add a non-ASCII file name.
|
36
|
+
|
37
|
+
This can cause problems if you want to work with people on other platforms.
|
38
|
+
|
39
|
+
To be portable it is advisable to rename the file.
|
40
|
+
|
41
|
+
If you know what you are doing you can disable this check using:
|
42
|
+
|
43
|
+
git config hooks.allownonascii true
|
44
|
+
EOF
|
45
|
+
exit 1
|
46
|
+
fi
|
47
|
+
|
48
|
+
# If there are whitespace errors, print the offending file names and fail.
|
49
|
+
exec git diff-index --check --cached $against --
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# An example hook script to verify what is about to be pushed. Called by "git
|
4
|
+
# push" after it has checked the remote status, but before anything has been
|
5
|
+
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
6
|
+
#
|
7
|
+
# This hook is called with the following parameters:
|
8
|
+
#
|
9
|
+
# $1 -- Name of the remote to which the push is being done
|
10
|
+
# $2 -- URL to which the push is being done
|
11
|
+
#
|
12
|
+
# If pushing without using a named remote those arguments will be equal.
|
13
|
+
#
|
14
|
+
# Information about the commits which are being pushed is supplied as lines to
|
15
|
+
# the standard input in the form:
|
16
|
+
#
|
17
|
+
# <local ref> <local sha1> <remote ref> <remote sha1>
|
18
|
+
#
|
19
|
+
# This sample shows how to prevent push of commits where the log message starts
|
20
|
+
# with "WIP" (work in progress).
|
21
|
+
|
22
|
+
remote="$1"
|
23
|
+
url="$2"
|
24
|
+
|
25
|
+
z40=0000000000000000000000000000000000000000
|
26
|
+
|
27
|
+
IFS=' '
|
28
|
+
while read local_ref local_sha remote_ref remote_sha
|
29
|
+
do
|
30
|
+
if [ "$local_sha" = $z40 ]
|
31
|
+
then
|
32
|
+
# Handle delete
|
33
|
+
:
|
34
|
+
else
|
35
|
+
if [ "$remote_sha" = $z40 ]
|
36
|
+
then
|
37
|
+
# New branch, examine all commits
|
38
|
+
range="$local_sha"
|
39
|
+
else
|
40
|
+
# Update to existing branch, examine new commits
|
41
|
+
range="$remote_sha..$local_sha"
|
42
|
+
fi
|
43
|
+
|
44
|
+
# Check for WIP commit
|
45
|
+
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
|
46
|
+
if [ -n "$commit" ]
|
47
|
+
then
|
48
|
+
echo "Found WIP commit in $local_ref, not pushing"
|
49
|
+
exit 1
|
50
|
+
fi
|
51
|
+
fi
|
52
|
+
done
|
53
|
+
|
54
|
+
exit 0
|
@@ -0,0 +1,169 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Copyright (c) 2006, 2008 Junio C Hamano
|
4
|
+
#
|
5
|
+
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
6
|
+
# its job, and can prevent the command from running by exiting with
|
7
|
+
# non-zero status.
|
8
|
+
#
|
9
|
+
# The hook is called with the following parameters:
|
10
|
+
#
|
11
|
+
# $1 -- the upstream the series was forked from.
|
12
|
+
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
13
|
+
#
|
14
|
+
# This sample shows how to prevent topic branches that are already
|
15
|
+
# merged to 'next' branch from getting rebased, because allowing it
|
16
|
+
# would result in rebasing already published history.
|
17
|
+
|
18
|
+
publish=next
|
19
|
+
basebranch="$1"
|
20
|
+
if test "$#" = 2
|
21
|
+
then
|
22
|
+
topic="refs/heads/$2"
|
23
|
+
else
|
24
|
+
topic=`git symbolic-ref HEAD` ||
|
25
|
+
exit 0 ;# we do not interrupt rebasing detached HEAD
|
26
|
+
fi
|
27
|
+
|
28
|
+
case "$topic" in
|
29
|
+
refs/heads/??/*)
|
30
|
+
;;
|
31
|
+
*)
|
32
|
+
exit 0 ;# we do not interrupt others.
|
33
|
+
;;
|
34
|
+
esac
|
35
|
+
|
36
|
+
# Now we are dealing with a topic branch being rebased
|
37
|
+
# on top of master. Is it OK to rebase it?
|
38
|
+
|
39
|
+
# Does the topic really exist?
|
40
|
+
git show-ref -q "$topic" || {
|
41
|
+
echo >&2 "No such branch $topic"
|
42
|
+
exit 1
|
43
|
+
}
|
44
|
+
|
45
|
+
# Is topic fully merged to master?
|
46
|
+
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
47
|
+
if test -z "$not_in_master"
|
48
|
+
then
|
49
|
+
echo >&2 "$topic is fully merged to master; better remove it."
|
50
|
+
exit 1 ;# we could allow it, but there is no point.
|
51
|
+
fi
|
52
|
+
|
53
|
+
# Is topic ever merged to next? If so you should not be rebasing it.
|
54
|
+
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
55
|
+
only_next_2=`git rev-list ^master ${publish} | sort`
|
56
|
+
if test "$only_next_1" = "$only_next_2"
|
57
|
+
then
|
58
|
+
not_in_topic=`git rev-list "^$topic" master`
|
59
|
+
if test -z "$not_in_topic"
|
60
|
+
then
|
61
|
+
echo >&2 "$topic is already up-to-date with master"
|
62
|
+
exit 1 ;# we could allow it, but there is no point.
|
63
|
+
else
|
64
|
+
exit 0
|
65
|
+
fi
|
66
|
+
else
|
67
|
+
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
68
|
+
/usr/bin/perl -e '
|
69
|
+
my $topic = $ARGV[0];
|
70
|
+
my $msg = "* $topic has commits already merged to public branch:\n";
|
71
|
+
my (%not_in_next) = map {
|
72
|
+
/^([0-9a-f]+) /;
|
73
|
+
($1 => 1);
|
74
|
+
} split(/\n/, $ARGV[1]);
|
75
|
+
for my $elem (map {
|
76
|
+
/^([0-9a-f]+) (.*)$/;
|
77
|
+
[$1 => $2];
|
78
|
+
} split(/\n/, $ARGV[2])) {
|
79
|
+
if (!exists $not_in_next{$elem->[0]}) {
|
80
|
+
if ($msg) {
|
81
|
+
print STDERR $msg;
|
82
|
+
undef $msg;
|
83
|
+
}
|
84
|
+
print STDERR " $elem->[1]\n";
|
85
|
+
}
|
86
|
+
}
|
87
|
+
' "$topic" "$not_in_next" "$not_in_master"
|
88
|
+
exit 1
|
89
|
+
fi
|
90
|
+
|
91
|
+
exit 0
|
92
|
+
|
93
|
+
################################################################
|
94
|
+
|
95
|
+
This sample hook safeguards topic branches that have been
|
96
|
+
published from being rewound.
|
97
|
+
|
98
|
+
The workflow assumed here is:
|
99
|
+
|
100
|
+
* Once a topic branch forks from "master", "master" is never
|
101
|
+
merged into it again (either directly or indirectly).
|
102
|
+
|
103
|
+
* Once a topic branch is fully cooked and merged into "master",
|
104
|
+
it is deleted. If you need to build on top of it to correct
|
105
|
+
earlier mistakes, a new topic branch is created by forking at
|
106
|
+
the tip of the "master". This is not strictly necessary, but
|
107
|
+
it makes it easier to keep your history simple.
|
108
|
+
|
109
|
+
* Whenever you need to test or publish your changes to topic
|
110
|
+
branches, merge them into "next" branch.
|
111
|
+
|
112
|
+
The script, being an example, hardcodes the publish branch name
|
113
|
+
to be "next", but it is trivial to make it configurable via
|
114
|
+
$GIT_DIR/config mechanism.
|
115
|
+
|
116
|
+
With this workflow, you would want to know:
|
117
|
+
|
118
|
+
(1) ... if a topic branch has ever been merged to "next". Young
|
119
|
+
topic branches can have stupid mistakes you would rather
|
120
|
+
clean up before publishing, and things that have not been
|
121
|
+
merged into other branches can be easily rebased without
|
122
|
+
affecting other people. But once it is published, you would
|
123
|
+
not want to rewind it.
|
124
|
+
|
125
|
+
(2) ... if a topic branch has been fully merged to "master".
|
126
|
+
Then you can delete it. More importantly, you should not
|
127
|
+
build on top of it -- other people may already want to
|
128
|
+
change things related to the topic as patches against your
|
129
|
+
"master", so if you need further changes, it is better to
|
130
|
+
fork the topic (perhaps with the same name) afresh from the
|
131
|
+
tip of "master".
|
132
|
+
|
133
|
+
Let's look at this example:
|
134
|
+
|
135
|
+
o---o---o---o---o---o---o---o---o---o "next"
|
136
|
+
/ / / /
|
137
|
+
/ a---a---b A / /
|
138
|
+
/ / / /
|
139
|
+
/ / c---c---c---c B /
|
140
|
+
/ / / \ /
|
141
|
+
/ / / b---b C \ /
|
142
|
+
/ / / / \ /
|
143
|
+
---o---o---o---o---o---o---o---o---o---o---o "master"
|
144
|
+
|
145
|
+
|
146
|
+
A, B and C are topic branches.
|
147
|
+
|
148
|
+
* A has one fix since it was merged up to "next".
|
149
|
+
|
150
|
+
* B has finished. It has been fully merged up to "master" and "next",
|
151
|
+
and is ready to be deleted.
|
152
|
+
|
153
|
+
* C has not merged to "next" at all.
|
154
|
+
|
155
|
+
We would want to allow C to be rebased, refuse A, and encourage
|
156
|
+
B to be deleted.
|
157
|
+
|
158
|
+
To compute (1):
|
159
|
+
|
160
|
+
git rev-list ^master ^topic next
|
161
|
+
git rev-list ^master next
|
162
|
+
|
163
|
+
if these match, topic has not merged in next at all.
|
164
|
+
|
165
|
+
To compute (2):
|
166
|
+
|
167
|
+
git rev-list master..topic
|
168
|
+
|
169
|
+
if this is empty, it is fully merged to "master".
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to prepare the commit log message.
|
4
|
+
# Called by "git commit" with the name of the file that has the
|
5
|
+
# commit message, followed by the description of the commit
|
6
|
+
# message's source. The hook's purpose is to edit the commit
|
7
|
+
# message file. If the hook fails with a non-zero status,
|
8
|
+
# the commit is aborted.
|
9
|
+
#
|
10
|
+
# To enable this hook, rename this file to "prepare-commit-msg".
|
11
|
+
|
12
|
+
# This hook includes three examples. The first comments out the
|
13
|
+
# "Conflicts:" part of a merge commit.
|
14
|
+
#
|
15
|
+
# The second includes the output of "git diff --name-status -r"
|
16
|
+
# into the message, just before the "git status" output. It is
|
17
|
+
# commented because it doesn't cope with --amend or with squashed
|
18
|
+
# commits.
|
19
|
+
#
|
20
|
+
# The third example adds a Signed-off-by line to the message, that can
|
21
|
+
# still be edited. This is rarely a good idea.
|
22
|
+
|
23
|
+
case "$2,$3" in
|
24
|
+
merge,)
|
25
|
+
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
26
|
+
|
27
|
+
# ,|template,)
|
28
|
+
# /usr/bin/perl -i.bak -pe '
|
29
|
+
# print "\n" . `git diff --cached --name-status -r`
|
30
|
+
# if /^#/ && $first++ == 0' "$1" ;;
|
31
|
+
|
32
|
+
*) ;;
|
33
|
+
esac
|
34
|
+
|
35
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
36
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to blocks unannotated tags from entering.
|
4
|
+
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
5
|
+
#
|
6
|
+
# To enable this hook, rename this file to "update".
|
7
|
+
#
|
8
|
+
# Config
|
9
|
+
# ------
|
10
|
+
# hooks.allowunannotated
|
11
|
+
# This boolean sets whether unannotated tags will be allowed into the
|
12
|
+
# repository. By default they won't be.
|
13
|
+
# hooks.allowdeletetag
|
14
|
+
# This boolean sets whether deleting tags will be allowed in the
|
15
|
+
# repository. By default they won't be.
|
16
|
+
# hooks.allowmodifytag
|
17
|
+
# This boolean sets whether a tag may be modified after creation. By default
|
18
|
+
# it won't be.
|
19
|
+
# hooks.allowdeletebranch
|
20
|
+
# This boolean sets whether deleting branches will be allowed in the
|
21
|
+
# repository. By default they won't be.
|
22
|
+
# hooks.denycreatebranch
|
23
|
+
# This boolean sets whether remotely creating branches will be denied
|
24
|
+
# in the repository. By default this is allowed.
|
25
|
+
#
|
26
|
+
|
27
|
+
# --- Command line
|
28
|
+
refname="$1"
|
29
|
+
oldrev="$2"
|
30
|
+
newrev="$3"
|
31
|
+
|
32
|
+
# --- Safety check
|
33
|
+
if [ -z "$GIT_DIR" ]; then
|
34
|
+
echo "Don't run this script from the command line." >&2
|
35
|
+
echo " (if you want, you could supply GIT_DIR then run" >&2
|
36
|
+
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
37
|
+
exit 1
|
38
|
+
fi
|
39
|
+
|
40
|
+
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
41
|
+
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
42
|
+
exit 1
|
43
|
+
fi
|
44
|
+
|
45
|
+
# --- Config
|
46
|
+
allowunannotated=$(git config --bool hooks.allowunannotated)
|
47
|
+
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
48
|
+
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
49
|
+
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
50
|
+
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
51
|
+
|
52
|
+
# check for no description
|
53
|
+
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
54
|
+
case "$projectdesc" in
|
55
|
+
"Unnamed repository"* | "")
|
56
|
+
echo "*** Project description file hasn't been set" >&2
|
57
|
+
exit 1
|
58
|
+
;;
|
59
|
+
esac
|
60
|
+
|
61
|
+
# --- Check types
|
62
|
+
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
63
|
+
zero="0000000000000000000000000000000000000000"
|
64
|
+
if [ "$newrev" = "$zero" ]; then
|
65
|
+
newrev_type=delete
|
66
|
+
else
|
67
|
+
newrev_type=$(git cat-file -t $newrev)
|
68
|
+
fi
|
69
|
+
|
70
|
+
case "$refname","$newrev_type" in
|
71
|
+
refs/tags/*,commit)
|
72
|
+
# un-annotated tag
|
73
|
+
short_refname=${refname##refs/tags/}
|
74
|
+
if [ "$allowunannotated" != "true" ]; then
|
75
|
+
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
76
|
+
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
77
|
+
exit 1
|
78
|
+
fi
|
79
|
+
;;
|
80
|
+
refs/tags/*,delete)
|
81
|
+
# delete tag
|
82
|
+
if [ "$allowdeletetag" != "true" ]; then
|
83
|
+
echo "*** Deleting a tag is not allowed in this repository" >&2
|
84
|
+
exit 1
|
85
|
+
fi
|
86
|
+
;;
|
87
|
+
refs/tags/*,tag)
|
88
|
+
# annotated tag
|
89
|
+
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
90
|
+
then
|
91
|
+
echo "*** Tag '$refname' already exists." >&2
|
92
|
+
echo "*** Modifying a tag is not allowed in this repository." >&2
|
93
|
+
exit 1
|
94
|
+
fi
|
95
|
+
;;
|
96
|
+
refs/heads/*,commit)
|
97
|
+
# branch
|
98
|
+
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
99
|
+
echo "*** Creating a branch is not allowed in this repository" >&2
|
100
|
+
exit 1
|
101
|
+
fi
|
102
|
+
;;
|
103
|
+
refs/heads/*,delete)
|
104
|
+
# delete branch
|
105
|
+
if [ "$allowdeletebranch" != "true" ]; then
|
106
|
+
echo "*** Deleting a branch is not allowed in this repository" >&2
|
107
|
+
exit 1
|
108
|
+
fi
|
109
|
+
;;
|
110
|
+
refs/remotes/*,commit)
|
111
|
+
# tracking branch
|
112
|
+
;;
|
113
|
+
refs/remotes/*,delete)
|
114
|
+
# delete tracking branch
|
115
|
+
if [ "$allowdeletebranch" != "true" ]; then
|
116
|
+
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
117
|
+
exit 1
|
118
|
+
fi
|
119
|
+
;;
|
120
|
+
*)
|
121
|
+
# Anything else (is there anything else?)
|
122
|
+
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
123
|
+
exit 1
|
124
|
+
;;
|
125
|
+
esac
|
126
|
+
|
127
|
+
# --- Finished
|
128
|
+
exit 0
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
0000000000000000000000000000000000000000 9bfb6eaf845d51e4637083824a3a0e75d608acef Michael Klein <mbklein@gmail.com> 1407882599 -0500 commit (initial): Initial commit
|
2
|
+
9bfb6eaf845d51e4637083824a3a0e75d608acef 9bfb6eaf845d51e4637083824a3a0e75d608acef Michael Klein <mbklein@gmail.com> 1407882625 -0500 checkout: moving from master to changes
|
3
|
+
9bfb6eaf845d51e4637083824a3a0e75d608acef b8cbe299f4b8947ab07a6e1ee79c015f47010f05 Michael Klein <mbklein@gmail.com> 1407882655 -0500 commit: Changed file
|
4
|
+
b8cbe299f4b8947ab07a6e1ee79c015f47010f05 9bfb6eaf845d51e4637083824a3a0e75d608acef Michael Klein <mbklein@gmail.com> 1407882663 -0500 checkout: moving from changes to master
|
5
|
+
9bfb6eaf845d51e4637083824a3a0e75d608acef 11d90eb028fccb636afd602c79ed8b972d4bdcdc Michael Klein <mbklein@gmail.com> 1407882956 -0500 commit: Add file_1
|
6
|
+
11d90eb028fccb636afd602c79ed8b972d4bdcdc d2dbef1ed2244f46a0910a9fa26aaa78b064680f Michael Klein <mbklein@gmail.com> 1407882965 -0500 commit: Add file_2
|
7
|
+
d2dbef1ed2244f46a0910a9fa26aaa78b064680f 1b0f59702ab12d0081b139790e5e534a6d4c6497 Michael Klein <mbklein@gmail.com> 1407882975 -0500 commit: Add file_3
|
8
|
+
1b0f59702ab12d0081b139790e5e534a6d4c6497 a634b0a1744154fa6d05d0d2a82a5ab0e2915b10 Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_4
|
9
|
+
a634b0a1744154fa6d05d0d2a82a5ab0e2915b10 f5c347a93feee4bf68835d7913e64a2c8f7ecc2a Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_5
|
10
|
+
f5c347a93feee4bf68835d7913e64a2c8f7ecc2a f08a0cb3d8083f7389f0281391f6e5316ea3c5be Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_6
|
11
|
+
f08a0cb3d8083f7389f0281391f6e5316ea3c5be c2b7db3786b68834d4ed540b0e45ddcdd102b99e Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_7
|
12
|
+
c2b7db3786b68834d4ed540b0e45ddcdd102b99e 0f77d1d716c52571abb8e6e42804061a35163109 Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_8
|
13
|
+
0f77d1d716c52571abb8e6e42804061a35163109 cd3c5e9aefdf4772f35e37552de61ce1cd96c63c Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_9
|
@@ -0,0 +1,2 @@
|
|
1
|
+
0000000000000000000000000000000000000000 9bfb6eaf845d51e4637083824a3a0e75d608acef Michael Klein <mbklein@gmail.com> 1407882625 -0500 branch: Created from HEAD
|
2
|
+
9bfb6eaf845d51e4637083824a3a0e75d608acef b8cbe299f4b8947ab07a6e1ee79c015f47010f05 Michael Klein <mbklein@gmail.com> 1407882655 -0500 commit: Changed file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
0000000000000000000000000000000000000000 9bfb6eaf845d51e4637083824a3a0e75d608acef Michael Klein <mbklein@gmail.com> 1407882599 -0500 commit (initial): Initial commit
|
2
|
+
9bfb6eaf845d51e4637083824a3a0e75d608acef 11d90eb028fccb636afd602c79ed8b972d4bdcdc Michael Klein <mbklein@gmail.com> 1407882956 -0500 commit: Add file_1
|
3
|
+
11d90eb028fccb636afd602c79ed8b972d4bdcdc d2dbef1ed2244f46a0910a9fa26aaa78b064680f Michael Klein <mbklein@gmail.com> 1407882965 -0500 commit: Add file_2
|
4
|
+
d2dbef1ed2244f46a0910a9fa26aaa78b064680f 1b0f59702ab12d0081b139790e5e534a6d4c6497 Michael Klein <mbklein@gmail.com> 1407882975 -0500 commit: Add file_3
|
5
|
+
1b0f59702ab12d0081b139790e5e534a6d4c6497 a634b0a1744154fa6d05d0d2a82a5ab0e2915b10 Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_4
|
6
|
+
a634b0a1744154fa6d05d0d2a82a5ab0e2915b10 f5c347a93feee4bf68835d7913e64a2c8f7ecc2a Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_5
|
7
|
+
f5c347a93feee4bf68835d7913e64a2c8f7ecc2a f08a0cb3d8083f7389f0281391f6e5316ea3c5be Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_6
|
8
|
+
f08a0cb3d8083f7389f0281391f6e5316ea3c5be c2b7db3786b68834d4ed540b0e45ddcdd102b99e Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_7
|
9
|
+
c2b7db3786b68834d4ed540b0e45ddcdd102b99e 0f77d1d716c52571abb8e6e42804061a35163109 Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_8
|
10
|
+
0f77d1d716c52571abb8e6e42804061a35163109 cd3c5e9aefdf4772f35e37552de61ce1cd96c63c Michael Klein <mbklein@gmail.com> 1407883003 -0500 commit: Add file_9
|
@@ -0,0 +1 @@
|
|
1
|
+
b8cbe299f4b8947ab07a6e1ee79c015f47010f05
|
@@ -0,0 +1 @@
|
|
1
|
+
cd3c5e9aefdf4772f35e37552de61ce1cd96c63c
|
@@ -0,0 +1 @@
|
|
1
|
+
f5c347a93feee4bf68835d7913e64a2c8f7ecc2a
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "AboutPage::GitLog" do
|
4
|
+
let(:root) { File.expand_path('../../fixtures',__FILE__) }
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
File.rename(File.join(root,'dot_git'),File.join(root,'.git'))
|
8
|
+
end
|
9
|
+
|
10
|
+
after :each do
|
11
|
+
File.rename(File.join(root,'.git'),File.join(root,'dot_git'))
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should respect line limits" do
|
15
|
+
pending "Grit doesn't work under JRuby" if defined? JRUBY_VERSION
|
16
|
+
expect(AboutPage::GitLog.new(root: root, limit: 5).commits.length).to eq(5)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should respect RegExp limits" do
|
20
|
+
pending "Grit doesn't work under JRuby" if defined? JRUBY_VERSION
|
21
|
+
expect(AboutPage::GitLog.new(root: root, limit: %r{^refs/tags/}).commits.last[:refs]).to include('refs/tags/v0.5')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should respect Proc limits" do
|
25
|
+
pending "Grit doesn't work under JRuby" if defined? JRUBY_VERSION
|
26
|
+
check = double('commit checker')
|
27
|
+
expect(check).to receive(:check).with(instance_of(Grit::Commit)).exactly(2).times.and_return(false, true)
|
28
|
+
limit = ->(c) { check.check(c) }
|
29
|
+
expect(AboutPage::GitLog.new(root: root, limit: limit).commits.length).to eq(2)
|
30
|
+
end
|
31
|
+
end
|
data/spec/lib/solr_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe AboutPage::Solr do
|
|
13
13
|
subject.schema.should be_empty
|
14
14
|
end
|
15
15
|
it "should retrieve index information from luke" do
|
16
|
-
@mock_solr_connection.should_receive(:get).with('admin/luke', an_instance_of(Hash)).and_return
|
16
|
+
@mock_solr_connection.should_receive(:get).with('admin/luke', an_instance_of(Hash)).and_return Hash.new
|
17
17
|
subject.schema.should be_a_kind_of(Hash)
|
18
18
|
end
|
19
19
|
end
|
@@ -21,7 +21,7 @@ describe AboutPage::Solr do
|
|
21
21
|
describe "#index" do
|
22
22
|
it "should get the index information from the schema" do
|
23
23
|
m = double()
|
24
|
-
subject.stub(:schema
|
24
|
+
subject.stub(:schema => { 'index' => m })
|
25
25
|
|
26
26
|
subject.index.should == m
|
27
27
|
end
|
@@ -29,39 +29,29 @@ describe AboutPage::Solr do
|
|
29
29
|
|
30
30
|
describe "#valid?" do
|
31
31
|
it "should be ok if the number of documents in the index is greater than or equal to the :minimum_numdocs" do
|
32
|
-
subject.stub(:ping
|
33
|
-
subject.stub(:schema).and_return { { 'index' => { :numDocs => 1 } } }
|
34
|
-
subject.stub(:expects).and_return 1
|
32
|
+
subject.stub(:ping => 'OK' , :schema => { 'index' => { :numDocs => 1 } }, :expects => 1)
|
35
33
|
subject.should be_valid
|
36
34
|
end
|
37
35
|
|
38
36
|
it "should be not be ok if the number of documents in the index is less than the :minimum_numdocs" do
|
39
|
-
subject.stub(:ping
|
40
|
-
subject.stub(:schema).and_return { { 'index' => { :numDocs => 1 } } }
|
41
|
-
subject.stub(:expects).and_return 5
|
37
|
+
subject.stub(:ping => 'OK', :schema => { 'index' => { :numDocs => 1 } }, :expects => 5)
|
42
38
|
subject.should_not be_valid
|
43
39
|
end
|
44
40
|
|
45
41
|
it "should not be ok if the index :numDocs param is not set" do
|
46
|
-
subject.stub(:ping
|
47
|
-
subject.stub(:schema).and_return { { 'index' => { } } }
|
48
|
-
subject.stub(:expects).and_return 1
|
42
|
+
subject.stub(:ping => 'OK', :schema => { 'index' => { } }, :expects => 1)
|
49
43
|
subject.should_not be_valid
|
50
44
|
end
|
51
45
|
|
52
46
|
it "should not be ok if the server doesn't respond to ping" do
|
53
|
-
subject.stub(:ping
|
54
|
-
subject.stub(:schema).and_return { { 'index' => { } } }
|
55
|
-
subject.stub(:expects).and_return 1
|
47
|
+
subject.stub(:ping => nil, :schema => { 'index' => { } }, :expects => 1)
|
56
48
|
subject.should_not be_valid
|
57
49
|
end
|
58
50
|
end
|
59
51
|
|
60
52
|
describe "#set_headers!" do
|
61
53
|
it "should add helpful headers when something is wrong" do
|
62
|
-
subject.stub(:ping
|
63
|
-
subject.stub(:schema).and_return { { 'index' => { :numDocs => 1 } } }
|
64
|
-
subject.stub(:expects).and_return 5
|
54
|
+
subject.stub(:ping => 'OK', :schema => { 'index' => { :numDocs => 1 } }, :expects => 5)
|
65
55
|
|
66
56
|
subject.should_receive(:add_header)
|
67
57
|
subject.set_headers! double()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: about_page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael B. Klein
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -26,19 +26,33 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: grit
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
|
-
type: :
|
35
|
+
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ! '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: rspec-rails
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +120,7 @@ files:
|
|
106
120
|
- app/views/about_page/about/_environment.html.erb
|
107
121
|
- app/views/about_page/about/_exception.html.erb
|
108
122
|
- app/views/about_page/about/_generic_hash.html.erb
|
123
|
+
- app/views/about_page/about/_git_log.html.erb
|
109
124
|
- app/views/about_page/about/health.html.erb
|
110
125
|
- app/views/about_page/about/index.html.erb
|
111
126
|
- config/routes.rb
|
@@ -115,6 +130,7 @@ files:
|
|
115
130
|
- lib/about_page/engine.rb
|
116
131
|
- lib/about_page/environment.rb
|
117
132
|
- lib/about_page/fedora.rb
|
133
|
+
- lib/about_page/git_log.rb
|
118
134
|
- lib/about_page/request_environment.rb
|
119
135
|
- lib/about_page/solr.rb
|
120
136
|
- lib/about_page/version.rb
|
@@ -159,8 +175,65 @@ files:
|
|
159
175
|
- spec/dummy/tmp/capybara/capybara-201204200939394978936149.html
|
160
176
|
- spec/features/about_page_spec.rb
|
161
177
|
- spec/features/health_spec.rb
|
178
|
+
- spec/fixtures/README.md
|
179
|
+
- spec/fixtures/dot_git/COMMIT_EDITMSG
|
180
|
+
- spec/fixtures/dot_git/HEAD
|
181
|
+
- spec/fixtures/dot_git/config
|
182
|
+
- spec/fixtures/dot_git/description
|
183
|
+
- spec/fixtures/dot_git/hooks/applypatch-msg.sample
|
184
|
+
- spec/fixtures/dot_git/hooks/commit-msg.sample
|
185
|
+
- spec/fixtures/dot_git/hooks/post-update.sample
|
186
|
+
- spec/fixtures/dot_git/hooks/pre-applypatch.sample
|
187
|
+
- spec/fixtures/dot_git/hooks/pre-commit.sample
|
188
|
+
- spec/fixtures/dot_git/hooks/pre-push.sample
|
189
|
+
- spec/fixtures/dot_git/hooks/pre-rebase.sample
|
190
|
+
- spec/fixtures/dot_git/hooks/prepare-commit-msg.sample
|
191
|
+
- spec/fixtures/dot_git/hooks/update.sample
|
192
|
+
- spec/fixtures/dot_git/index
|
193
|
+
- spec/fixtures/dot_git/info/exclude
|
194
|
+
- spec/fixtures/dot_git/logs/HEAD
|
195
|
+
- spec/fixtures/dot_git/logs/refs/heads/changes
|
196
|
+
- spec/fixtures/dot_git/logs/refs/heads/master
|
197
|
+
- spec/fixtures/dot_git/objects/0f/77d1d716c52571abb8e6e42804061a35163109
|
198
|
+
- spec/fixtures/dot_git/objects/11/d90eb028fccb636afd602c79ed8b972d4bdcdc
|
199
|
+
- spec/fixtures/dot_git/objects/1b/0f59702ab12d0081b139790e5e534a6d4c6497
|
200
|
+
- spec/fixtures/dot_git/objects/27/0ed00ed85f5d85bbf93e0031da068f3826c861
|
201
|
+
- spec/fixtures/dot_git/objects/2c/c95862fce4c3d4d00233f6adbafa1ff8d90f6d
|
202
|
+
- spec/fixtures/dot_git/objects/49/8a9d05fd31925befce4a4157f52e9fa790d6ba
|
203
|
+
- spec/fixtures/dot_git/objects/5a/def156c19f70c6b0acb68ee52da3e3f3c1ac70
|
204
|
+
- spec/fixtures/dot_git/objects/6c/d5be8bbb45fd873e93815e68267d964e0498ad
|
205
|
+
- spec/fixtures/dot_git/objects/71/885c8f88ef89ad3a503383fa52d75a7ffebc96
|
206
|
+
- spec/fixtures/dot_git/objects/76/bb13ca91b6b8c012a567f2fead60994aced279
|
207
|
+
- spec/fixtures/dot_git/objects/8a/3e086e86082d395adf1d5d307688e7eddf373b
|
208
|
+
- spec/fixtures/dot_git/objects/8f/93524577981087cb8bdd16ff3de628e32ddd03
|
209
|
+
- spec/fixtures/dot_git/objects/9b/fb6eaf845d51e4637083824a3a0e75d608acef
|
210
|
+
- spec/fixtures/dot_git/objects/a6/34b0a1744154fa6d05d0d2a82a5ab0e2915b10
|
211
|
+
- spec/fixtures/dot_git/objects/ac/4be5027e6aa9dbf80c762f46647e4854b2d2ea
|
212
|
+
- spec/fixtures/dot_git/objects/b8/cbe299f4b8947ab07a6e1ee79c015f47010f05
|
213
|
+
- spec/fixtures/dot_git/objects/c2/b7db3786b68834d4ed540b0e45ddcdd102b99e
|
214
|
+
- spec/fixtures/dot_git/objects/cd/3c5e9aefdf4772f35e37552de61ce1cd96c63c
|
215
|
+
- spec/fixtures/dot_git/objects/d2/2536083f68aab3013df16b56778b643e9b3e09
|
216
|
+
- spec/fixtures/dot_git/objects/d2/dbef1ed2244f46a0910a9fa26aaa78b064680f
|
217
|
+
- spec/fixtures/dot_git/objects/d8/91cd57bb52df201d435c067ce70ae15a56d460
|
218
|
+
- spec/fixtures/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
219
|
+
- spec/fixtures/dot_git/objects/f0/8a0cb3d8083f7389f0281391f6e5316ea3c5be
|
220
|
+
- spec/fixtures/dot_git/objects/f5/c347a93feee4bf68835d7913e64a2c8f7ecc2a
|
221
|
+
- spec/fixtures/dot_git/refs/heads/changes
|
222
|
+
- spec/fixtures/dot_git/refs/heads/master
|
223
|
+
- spec/fixtures/dot_git/refs/tags/v0.5
|
224
|
+
- spec/fixtures/file.txt
|
225
|
+
- spec/fixtures/file_1
|
226
|
+
- spec/fixtures/file_2
|
227
|
+
- spec/fixtures/file_3
|
228
|
+
- spec/fixtures/file_4
|
229
|
+
- spec/fixtures/file_5
|
230
|
+
- spec/fixtures/file_6
|
231
|
+
- spec/fixtures/file_7
|
232
|
+
- spec/fixtures/file_8
|
233
|
+
- spec/fixtures/file_9
|
162
234
|
- spec/lib/about_page_configuration.rb
|
163
235
|
- spec/lib/configuration_environment_spec.rb
|
236
|
+
- spec/lib/git_log_spec.rb
|
164
237
|
- spec/lib/solr_spec.rb
|
165
238
|
- spec/spec_helper.rb
|
166
239
|
homepage: http://github.com/sul-dlss/about_page
|
@@ -224,7 +297,64 @@ test_files:
|
|
224
297
|
- spec/dummy/tmp/capybara/capybara-201204200939394978936149.html
|
225
298
|
- spec/features/about_page_spec.rb
|
226
299
|
- spec/features/health_spec.rb
|
300
|
+
- spec/fixtures/README.md
|
301
|
+
- spec/fixtures/dot_git/COMMIT_EDITMSG
|
302
|
+
- spec/fixtures/dot_git/HEAD
|
303
|
+
- spec/fixtures/dot_git/config
|
304
|
+
- spec/fixtures/dot_git/description
|
305
|
+
- spec/fixtures/dot_git/hooks/applypatch-msg.sample
|
306
|
+
- spec/fixtures/dot_git/hooks/commit-msg.sample
|
307
|
+
- spec/fixtures/dot_git/hooks/post-update.sample
|
308
|
+
- spec/fixtures/dot_git/hooks/pre-applypatch.sample
|
309
|
+
- spec/fixtures/dot_git/hooks/pre-commit.sample
|
310
|
+
- spec/fixtures/dot_git/hooks/pre-push.sample
|
311
|
+
- spec/fixtures/dot_git/hooks/pre-rebase.sample
|
312
|
+
- spec/fixtures/dot_git/hooks/prepare-commit-msg.sample
|
313
|
+
- spec/fixtures/dot_git/hooks/update.sample
|
314
|
+
- spec/fixtures/dot_git/index
|
315
|
+
- spec/fixtures/dot_git/info/exclude
|
316
|
+
- spec/fixtures/dot_git/logs/HEAD
|
317
|
+
- spec/fixtures/dot_git/logs/refs/heads/changes
|
318
|
+
- spec/fixtures/dot_git/logs/refs/heads/master
|
319
|
+
- spec/fixtures/dot_git/objects/0f/77d1d716c52571abb8e6e42804061a35163109
|
320
|
+
- spec/fixtures/dot_git/objects/11/d90eb028fccb636afd602c79ed8b972d4bdcdc
|
321
|
+
- spec/fixtures/dot_git/objects/1b/0f59702ab12d0081b139790e5e534a6d4c6497
|
322
|
+
- spec/fixtures/dot_git/objects/27/0ed00ed85f5d85bbf93e0031da068f3826c861
|
323
|
+
- spec/fixtures/dot_git/objects/2c/c95862fce4c3d4d00233f6adbafa1ff8d90f6d
|
324
|
+
- spec/fixtures/dot_git/objects/49/8a9d05fd31925befce4a4157f52e9fa790d6ba
|
325
|
+
- spec/fixtures/dot_git/objects/5a/def156c19f70c6b0acb68ee52da3e3f3c1ac70
|
326
|
+
- spec/fixtures/dot_git/objects/6c/d5be8bbb45fd873e93815e68267d964e0498ad
|
327
|
+
- spec/fixtures/dot_git/objects/71/885c8f88ef89ad3a503383fa52d75a7ffebc96
|
328
|
+
- spec/fixtures/dot_git/objects/76/bb13ca91b6b8c012a567f2fead60994aced279
|
329
|
+
- spec/fixtures/dot_git/objects/8a/3e086e86082d395adf1d5d307688e7eddf373b
|
330
|
+
- spec/fixtures/dot_git/objects/8f/93524577981087cb8bdd16ff3de628e32ddd03
|
331
|
+
- spec/fixtures/dot_git/objects/9b/fb6eaf845d51e4637083824a3a0e75d608acef
|
332
|
+
- spec/fixtures/dot_git/objects/a6/34b0a1744154fa6d05d0d2a82a5ab0e2915b10
|
333
|
+
- spec/fixtures/dot_git/objects/ac/4be5027e6aa9dbf80c762f46647e4854b2d2ea
|
334
|
+
- spec/fixtures/dot_git/objects/b8/cbe299f4b8947ab07a6e1ee79c015f47010f05
|
335
|
+
- spec/fixtures/dot_git/objects/c2/b7db3786b68834d4ed540b0e45ddcdd102b99e
|
336
|
+
- spec/fixtures/dot_git/objects/cd/3c5e9aefdf4772f35e37552de61ce1cd96c63c
|
337
|
+
- spec/fixtures/dot_git/objects/d2/2536083f68aab3013df16b56778b643e9b3e09
|
338
|
+
- spec/fixtures/dot_git/objects/d2/dbef1ed2244f46a0910a9fa26aaa78b064680f
|
339
|
+
- spec/fixtures/dot_git/objects/d8/91cd57bb52df201d435c067ce70ae15a56d460
|
340
|
+
- spec/fixtures/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
341
|
+
- spec/fixtures/dot_git/objects/f0/8a0cb3d8083f7389f0281391f6e5316ea3c5be
|
342
|
+
- spec/fixtures/dot_git/objects/f5/c347a93feee4bf68835d7913e64a2c8f7ecc2a
|
343
|
+
- spec/fixtures/dot_git/refs/heads/changes
|
344
|
+
- spec/fixtures/dot_git/refs/heads/master
|
345
|
+
- spec/fixtures/dot_git/refs/tags/v0.5
|
346
|
+
- spec/fixtures/file.txt
|
347
|
+
- spec/fixtures/file_1
|
348
|
+
- spec/fixtures/file_2
|
349
|
+
- spec/fixtures/file_3
|
350
|
+
- spec/fixtures/file_4
|
351
|
+
- spec/fixtures/file_5
|
352
|
+
- spec/fixtures/file_6
|
353
|
+
- spec/fixtures/file_7
|
354
|
+
- spec/fixtures/file_8
|
355
|
+
- spec/fixtures/file_9
|
227
356
|
- spec/lib/about_page_configuration.rb
|
228
357
|
- spec/lib/configuration_environment_spec.rb
|
358
|
+
- spec/lib/git_log_spec.rb
|
229
359
|
- spec/lib/solr_spec.rb
|
230
360
|
- spec/spec_helper.rb
|