Skip to content

Commit

Permalink
rake doc:upload: check for wrong/incomplete rev
Browse files Browse the repository at this point in the history
  • Loading branch information
npostavs committed Dec 6, 2013
1 parent 7d4e4aa commit 7518cb4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
authors.txt
doc/gh-pages
doc/*.html
doc/html-revision
pkg/
extras/imported/**
!extras/imported/*/.yas-setup.el
Expand Down
11 changes: 10 additions & 1 deletion Rakefile
Expand Up @@ -67,7 +67,16 @@ namespace :doc do
Dir.glob("doc/images/*").each do |file|
FileUtils.cp file, 'doc/gh-pages/images'
end
rev = `git rev-parse --verify HEAD`
curRev = `git rev-parse --verify HEAD`.chomp()
expRev = IO.read('doc/html-revision').chomp()
if curRev != expRev
raise ("The HTML rev: #{expRev},\n" +
"current rev: #{curRev}!\n")
end
if !system "git diff-index --quiet HEAD"
system "git status --untracked-files=no"
raise "You have uncommitted changes!"
end
Dir.chdir 'doc/gh-pages' do
sh "git commit -a -m 'Automatic documentation update.\n\n" +
"From #{rev.chomp()}'"
Expand Down
12 changes: 6 additions & 6 deletions doc/yas-doc-helper.el
Expand Up @@ -114,13 +114,13 @@
;; This lets all the org files be exported to HTML with
;; `org-publish-current-project' (C-c C-e P).

(let* ((rev (or (with-temp-buffer
(when (eq (call-process "git" nil t nil
"rev-parse" "--verify" "HEAD") 0)
(buffer-string)))
yas--version))
(dir (if load-file-name (file-name-directory load-file-name)
(let* ((dir (if load-file-name (file-name-directory load-file-name)
default-directory))
(rev (with-temp-file (expand-file-name "html-revision" dir)
(or (when (eq (call-process "git" nil t nil
"rev-parse" "--verify" "HEAD") 0)
(buffer-string))
(princ yas--version (current-buffer)))))
(proj-plist
(list
:base-directory dir :publishing-directory dir
Expand Down

0 comments on commit 7518cb4

Please sign in to comment.