Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move version variable to autoload script, include in every message

  • Loading branch information...
commit f0d2b02f54d7ccc3f38e53d3d20534f37ca0c949 1 parent dd866d6
Peter Odding authored
2  README.md
View
@@ -45,4 +45,4 @@ If you have questions, bug reports, suggestions, etc. the author can be contacte
## License
This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
2010 Peter Odding &lt;<peter@peterodding.com>&gt;.
2011 Peter Odding &lt;<peter@peterodding.com>&gt;.
30 autoload/xolox/publish.vim
View
@@ -1,8 +1,10 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 26, 2011
+" Last Change: September 4, 2011
" URL: http://peterodding.com/code/vim/publish/
+let g:xolox#publish#version = '1.7.3'
+
function! xolox#publish#resolve_files(directory, pathnames) " {{{1
" Create a dictionary that maps the fully resolved pathnames of the files to
" be published to the absolute pathnames provided by the user. This enables
@@ -47,21 +49,21 @@ function! xolox#publish#find_tags(files_to_publish) " {{{1
let tag_name = string(entry.name)
let this_path = string(entry.filename)
let other_path = string(other.filename)
- let msg = "publish.vim: Ignoring duplicate tag %s! (duplicate is in %s, first was in %s)"
- call xolox#misc#msg#warn(msg, tag_name, this_path, other_path)
+ let msg = "publish.vim %s: Ignoring duplicate tag %s! (duplicate is in %s, first was in %s)"
+ call xolox#misc#msg#warn(msg, g:xolox#publish#version, tag_name, this_path, other_path)
endif
endif
endif
endfor
if num_duplicates > 3
let more = num_duplicates - 3
- let msg = "publish.vim: Ignored %s more duplicate tag%s!"
- call xolox#misc#msg#warn(msg, more, more == 1 ? '' : 's')
+ let msg = "publish.vim: %s Ignored %s more duplicate tag%s!"
+ call xolox#misc#msg#warn(msg, g:xolox#publish#version, more, more == 1 ? '' : 's')
endif
unlet s:cached_contents
- let msg = "publish.vim: Found %i tag%s to publish in %s."
+ let msg = "publish.vim %s: Found %i tag%s to publish in %s."
let numtags = len(tags_to_publish)
- call xolox#misc#timer#stop(msg, numtags, numtags != 1 ? 's' : '', start)
+ call xolox#misc#timer#stop(msg, g:xolox#publish#version, numtags, numtags != 1 ? 's' : '', start)
return tags_to_publish
endfunction
@@ -147,7 +149,7 @@ function! xolox#publish#rsync_check(target) " {{{1
endif
endif
endif
- call xolox#misc#timer#stop("publish.vim: Checked rsync support in %s.", start)
+ call xolox#misc#timer#stop("publish.vim %s: Checked rsync support in %s.", g:xolox#publish#version, start)
return result
endfunction
@@ -155,9 +157,9 @@ function! xolox#publish#run_rsync(target, tempdir) " {{{1
let start = xolox#misc#timer#start()
let target = fnameescape(a:target . '/')
let tempdir = fnameescape(a:tempdir . '/')
- call xolox#misc#msg#info("publish.vim: Uploading files to %s using rsync.", a:target)
+ call xolox#misc#msg#info("publish.vim %s: Uploading files to %s using rsync.", g:xolox#publish#version, a:target)
execute '!rsync -vr' tempdir target
- call xolox#misc#timer#stop("publish.vim: Finished uploading in %s.", start)
+ call xolox#misc#timer#stop("publish.vim %s: Finished uploading in %s.", g:xolox#publish#version, start)
if v:shell_error
throw "publish.vim: Failed to run rsync!"
endif
@@ -174,12 +176,12 @@ function! xolox#publish#create_dirs(target_path) " {{{1
if !isdirectory(current_directory)
let msg = "Failed to create directory %s! What now?"
if confirm(printf(msg, string(current_directory)), "&Abort\n&Ignore") == 1
- let msg = "publish.vim: Failed to create %s, aborting .."
- call xolox#misc#msg#warn(msg, string(current_directory))
+ let msg = "publish.vim %s: Failed to create %s, aborting .."
+ call xolox#misc#msg#warn(msg, g:xolox#publish#version, string(current_directory))
return 0
else
- let msg = "publish.vim: Failed to create %s, ignoring .."
- call xolox#misc#msg#warn(msg, string(current_directory))
+ let msg = "publish.vim %s: Failed to create %s, ignoring .."
+ call xolox#misc#msg#warn(msg, g:xolox#publish#version, string(current_directory))
continue
endif
endif
12 doc/publish.txt
View
@@ -14,7 +14,7 @@ in Vim scripting so I decided to clean up my code and release it. If you're
wondering what the result looks like, I've published the plug-in source code
[2] as a demonstration.
-==============================================================================
+===============================================================================
*publish-installation-usage*
Installation & usage ~
@@ -53,7 +53,7 @@ the script as '~/publish_test.vim' and try it in Vim by executing the command
moment and after that you will find a bunch of syntax highlighted, interlinked
HTML documents in the 'target' directory!
-==============================================================================
+===============================================================================
Publishing to a remote location (website) ~
As you can see from the example above it's possible to publish files directly
@@ -73,7 +73,7 @@ automatically use rsync [6] when both the local and remote system have it
installed. This cuts the time to publish to a remote location in half and
enables the plug-in to automatically create directories on the remote side.
-==============================================================================
+===============================================================================
*publish-contact*
Contact ~
@@ -82,14 +82,14 @@ contacted at peter@peterodding.com. The latest version is available at
http://peterodding.com/code/vim/publish/ and http://github.com/xolox/vim-publish.
If you like the script please vote for it on Vim Online [7].
-==============================================================================
+===============================================================================
*publish-license*
License ~
-This software is licensed under the MIT license [8]. Copyright 2010 Peter
+This software is licensed under the MIT license [8]. Copyright 2011 Peter
Odding <peter@peterodding.com>.
-==============================================================================
+===============================================================================
*publish-references*
References ~
24 plugin/publish.vim
View
@@ -1,14 +1,12 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 26, 2011
+" Last Change: September 4, 2011
" URL: http://peterodding.com/code/vim/publish/
-" License: MIT
-" Version: 1.7.2
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 2252 1 :AutoInstall: publish.zip
-" Don't source the plug-in when its already been loaded or &compatible is set.
+" Don't source the plug-in when it's already been loaded or &compatible is set.
if &cp || exists('g:loaded_publish')
finish
endif
@@ -23,7 +21,7 @@ endif
function! Publish(source, target, files) abort
let start = xolox#misc#timer#start()
- call xolox#misc#msg#info("Preparing to publish file%s ..", len(a:files) == 1 ? '' : 's')
+ call xolox#misc#msg#info("publish.vim %s: Preparing to publish file%s ..", g:xolox#publish#version, len(a:files) == 1 ? '' : 's')
let s:files_to_publish = xolox#publish#resolve_files(a:source, a:files)
call xolox#publish#update_tags(values(s:files_to_publish))
let s:tags_to_publish = xolox#publish#find_tags(s:files_to_publish)
@@ -40,7 +38,7 @@ function! Publish(source, target, files) abort
let source_path = xolox#misc#path#merge(a:source, pathname)
let suffix = g:publish_omit_dothtml ? '' : '.html'
let target_path = xolox#misc#path#merge(target_dir, pathname . suffix)
- call xolox#misc#msg#info("Publishing %s", string(pathname))
+ call xolox#misc#msg#info("publish.vim %s: Publishing %s", g:xolox#publish#version, string(pathname))
if !xolox#publish#create_dirs(target_path)
return
endif
@@ -60,13 +58,13 @@ function! Publish(source, target, files) abort
let highlight_start = xolox#misc#timer#start()
call xolox#publish#munge_syntax_items()
runtime syntax/2html.vim
- let msg = "publish.vim: The 2html.vim script took %s to highlight %s."
- call xolox#misc#timer#stop(msg, highlight_start, pathname)
+ let msg = "publish.vim %s: The 2html.vim script took %s to highlight %s."
+ call xolox#misc#timer#stop(msg, g:xolox#publish#version, highlight_start, pathname)
if exists('tags_to_links_command')
let tags_to_links_start = xolox#misc#timer#start()
silent execute tags_to_links_command
- let msg = "publish.vim: Finished converting tags in %s to links in %s."
- call xolox#misc#timer#stop(msg, pathname, tags_to_links_start)
+ let msg = "publish.vim %s: Finished converting tags in %s to links in %s."
+ call xolox#misc#timer#stop(msg, g:xolox#publish#version, pathname, tags_to_links_start)
endif
call xolox#publish#customize_html(pathname)
silent execute 'write!' fnameescape(target_path)
@@ -76,9 +74,9 @@ function! Publish(source, target, files) abort
if rsync_target != ''
call xolox#publish#run_rsync(rsync_target, rsync_dir)
endif
- let msg = "publish.vim: Published %i file%s to %s."
- call xolox#misc#msg#info(msg, len(a:files), len(a:files) == 1 ? '' : 's', a:target)
- call xolox#misc#timer#stop("Finished publishing files in %s.", start)
+ let msg = "publish.vim %s: Published %i file%s to %s."
+ call xolox#misc#msg#info(msg, g:xolox#publish#version, len(a:files), len(a:files) == 1 ? '' : 's', a:target)
+ call xolox#misc#timer#stop("publish.vim %s: Finished publishing files in %s.", g:xolox#publish#version, start)
call xolox#publish#prep_env(0)
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.