Skip to content

Commit f0d2b02

Browse files
committed
Move version variable to autoload script, include in every message
1 parent dd866d6 commit f0d2b02

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ If you have questions, bug reports, suggestions, etc. the author can be contacte
4545
## License
4646

4747
This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
48-
© 2010 Peter Odding &lt;<peter@peterodding.com>&gt;.
48+
© 2011 Peter Odding &lt;<peter@peterodding.com>&gt;.

autoload/xolox/publish.vim

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
" Vim script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: May 26, 2011
3+
" Last Change: September 4, 2011
44
" URL: http://peterodding.com/code/vim/publish/
55

6+
let g:xolox#publish#version = '1.7.3'
7+
68
function! xolox#publish#resolve_files(directory, pathnames) " {{{1
79
" Create a dictionary that maps the fully resolved pathnames of the files to
810
" 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
4749
let tag_name = string(entry.name)
4850
let this_path = string(entry.filename)
4951
let other_path = string(other.filename)
50-
let msg = "publish.vim: Ignoring duplicate tag %s! (duplicate is in %s, first was in %s)"
51-
call xolox#misc#msg#warn(msg, tag_name, this_path, other_path)
52+
let msg = "publish.vim %s: Ignoring duplicate tag %s! (duplicate is in %s, first was in %s)"
53+
call xolox#misc#msg#warn(msg, g:xolox#publish#version, tag_name, this_path, other_path)
5254
endif
5355
endif
5456
endif
5557
endfor
5658
if num_duplicates > 3
5759
let more = num_duplicates - 3
58-
let msg = "publish.vim: Ignored %s more duplicate tag%s!"
59-
call xolox#misc#msg#warn(msg, more, more == 1 ? '' : 's')
60+
let msg = "publish.vim: %s Ignored %s more duplicate tag%s!"
61+
call xolox#misc#msg#warn(msg, g:xolox#publish#version, more, more == 1 ? '' : 's')
6062
endif
6163
unlet s:cached_contents
62-
let msg = "publish.vim: Found %i tag%s to publish in %s."
64+
let msg = "publish.vim %s: Found %i tag%s to publish in %s."
6365
let numtags = len(tags_to_publish)
64-
call xolox#misc#timer#stop(msg, numtags, numtags != 1 ? 's' : '', start)
66+
call xolox#misc#timer#stop(msg, g:xolox#publish#version, numtags, numtags != 1 ? 's' : '', start)
6567
return tags_to_publish
6668
endfunction
6769

@@ -147,17 +149,17 @@ function! xolox#publish#rsync_check(target) " {{{1
147149
endif
148150
endif
149151
endif
150-
call xolox#misc#timer#stop("publish.vim: Checked rsync support in %s.", start)
152+
call xolox#misc#timer#stop("publish.vim %s: Checked rsync support in %s.", g:xolox#publish#version, start)
151153
return result
152154
endfunction
153155

154156
function! xolox#publish#run_rsync(target, tempdir) " {{{1
155157
let start = xolox#misc#timer#start()
156158
let target = fnameescape(a:target . '/')
157159
let tempdir = fnameescape(a:tempdir . '/')
158-
call xolox#misc#msg#info("publish.vim: Uploading files to %s using rsync.", a:target)
160+
call xolox#misc#msg#info("publish.vim %s: Uploading files to %s using rsync.", g:xolox#publish#version, a:target)
159161
execute '!rsync -vr' tempdir target
160-
call xolox#misc#timer#stop("publish.vim: Finished uploading in %s.", start)
162+
call xolox#misc#timer#stop("publish.vim %s: Finished uploading in %s.", g:xolox#publish#version, start)
161163
if v:shell_error
162164
throw "publish.vim: Failed to run rsync!"
163165
endif
@@ -174,12 +176,12 @@ function! xolox#publish#create_dirs(target_path) " {{{1
174176
if !isdirectory(current_directory)
175177
let msg = "Failed to create directory %s! What now?"
176178
if confirm(printf(msg, string(current_directory)), "&Abort\n&Ignore") == 1
177-
let msg = "publish.vim: Failed to create %s, aborting .."
178-
call xolox#misc#msg#warn(msg, string(current_directory))
179+
let msg = "publish.vim %s: Failed to create %s, aborting .."
180+
call xolox#misc#msg#warn(msg, g:xolox#publish#version, string(current_directory))
179181
return 0
180182
else
181-
let msg = "publish.vim: Failed to create %s, ignoring .."
182-
call xolox#misc#msg#warn(msg, string(current_directory))
183+
let msg = "publish.vim %s: Failed to create %s, ignoring .."
184+
call xolox#misc#msg#warn(msg, g:xolox#publish#version, string(current_directory))
183185
continue
184186
endif
185187
endif

doc/publish.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ in Vim scripting so I decided to clean up my code and release it. If you're
1414
wondering what the result looks like, I've published the plug-in source code
1515
[2] as a demonstration.
1616

17-
==============================================================================
17+
===============================================================================
1818
*publish-installation-usage*
1919
Installation & usage ~
2020

@@ -53,7 +53,7 @@ the script as '~/publish_test.vim' and try it in Vim by executing the command
5353
moment and after that you will find a bunch of syntax highlighted, interlinked
5454
HTML documents in the 'target' directory!
5555

56-
==============================================================================
56+
===============================================================================
5757
Publishing to a remote location (website) ~
5858

5959
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
7373
installed. This cuts the time to publish to a remote location in half and
7474
enables the plug-in to automatically create directories on the remote side.
7575

76-
==============================================================================
76+
===============================================================================
7777
*publish-contact*
7878
Contact ~
7979

@@ -82,14 +82,14 @@ contacted at peter@peterodding.com. The latest version is available at
8282
http://peterodding.com/code/vim/publish/ and http://github.com/xolox/vim-publish.
8383
If you like the script please vote for it on Vim Online [7].
8484

85-
==============================================================================
85+
===============================================================================
8686
*publish-license*
8787
License ~
8888

89-
This software is licensed under the MIT license [8]. Copyright 2010 Peter
89+
This software is licensed under the MIT license [8]. Copyright 2011 Peter
9090
Odding <peter@peterodding.com>.
9191

92-
==============================================================================
92+
===============================================================================
9393
*publish-references*
9494
References ~
9595

plugin/publish.vim

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
" Vim plug-in
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: May 26, 2011
3+
" Last Change: September 4, 2011
44
" URL: http://peterodding.com/code/vim/publish/
5-
" License: MIT
6-
" Version: 1.7.2
75

86
" Support for automatic update using the GLVS plug-in.
97
" GetLatestVimScripts: 2252 1 :AutoInstall: publish.zip
108

11-
" Don't source the plug-in when its already been loaded or &compatible is set.
9+
" Don't source the plug-in when it's already been loaded or &compatible is set.
1210
if &cp || exists('g:loaded_publish')
1311
finish
1412
endif
@@ -23,7 +21,7 @@ endif
2321

2422
function! Publish(source, target, files) abort
2523
let start = xolox#misc#timer#start()
26-
call xolox#misc#msg#info("Preparing to publish file%s ..", len(a:files) == 1 ? '' : 's')
24+
call xolox#misc#msg#info("publish.vim %s: Preparing to publish file%s ..", g:xolox#publish#version, len(a:files) == 1 ? '' : 's')
2725
let s:files_to_publish = xolox#publish#resolve_files(a:source, a:files)
2826
call xolox#publish#update_tags(values(s:files_to_publish))
2927
let s:tags_to_publish = xolox#publish#find_tags(s:files_to_publish)
@@ -40,7 +38,7 @@ function! Publish(source, target, files) abort
4038
let source_path = xolox#misc#path#merge(a:source, pathname)
4139
let suffix = g:publish_omit_dothtml ? '' : '.html'
4240
let target_path = xolox#misc#path#merge(target_dir, pathname . suffix)
43-
call xolox#misc#msg#info("Publishing %s", string(pathname))
41+
call xolox#misc#msg#info("publish.vim %s: Publishing %s", g:xolox#publish#version, string(pathname))
4442
if !xolox#publish#create_dirs(target_path)
4543
return
4644
endif
@@ -60,13 +58,13 @@ function! Publish(source, target, files) abort
6058
let highlight_start = xolox#misc#timer#start()
6159
call xolox#publish#munge_syntax_items()
6260
runtime syntax/2html.vim
63-
let msg = "publish.vim: The 2html.vim script took %s to highlight %s."
64-
call xolox#misc#timer#stop(msg, highlight_start, pathname)
61+
let msg = "publish.vim %s: The 2html.vim script took %s to highlight %s."
62+
call xolox#misc#timer#stop(msg, g:xolox#publish#version, highlight_start, pathname)
6563
if exists('tags_to_links_command')
6664
let tags_to_links_start = xolox#misc#timer#start()
6765
silent execute tags_to_links_command
68-
let msg = "publish.vim: Finished converting tags in %s to links in %s."
69-
call xolox#misc#timer#stop(msg, pathname, tags_to_links_start)
66+
let msg = "publish.vim %s: Finished converting tags in %s to links in %s."
67+
call xolox#misc#timer#stop(msg, g:xolox#publish#version, pathname, tags_to_links_start)
7068
endif
7169
call xolox#publish#customize_html(pathname)
7270
silent execute 'write!' fnameescape(target_path)
@@ -76,9 +74,9 @@ function! Publish(source, target, files) abort
7674
if rsync_target != ''
7775
call xolox#publish#run_rsync(rsync_target, rsync_dir)
7876
endif
79-
let msg = "publish.vim: Published %i file%s to %s."
80-
call xolox#misc#msg#info(msg, len(a:files), len(a:files) == 1 ? '' : 's', a:target)
81-
call xolox#misc#timer#stop("Finished publishing files in %s.", start)
77+
let msg = "publish.vim %s: Published %i file%s to %s."
78+
call xolox#misc#msg#info(msg, g:xolox#publish#version, len(a:files), len(a:files) == 1 ? '' : 's', a:target)
79+
call xolox#misc#timer#stop("publish.vim %s: Finished publishing files in %s.", g:xolox#publish#version, start)
8280
call xolox#publish#prep_env(0)
8381
endfunction
8482

0 commit comments

Comments
 (0)