Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Move version variable to autoload script, include in every message

  • Loading branch information...
commit f0d2b02f54d7ccc3f38e53d3d20534f37ca0c949 1 parent dd866d6
Peter Odding authored
2  README.md
Source Rendered
@@ -45,4 +45,4 @@ If you have questions, bug reports, suggestions, etc. the author can be contacte
45 45
 ## License
46 46
 
47 47
 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;.
30  autoload/xolox/publish.vim
... ...
@@ -1,8 +1,10 @@
1 1
 " Vim script
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: May 26, 2011
  3
+" Last Change: September 4, 2011
4 4
 " URL: http://peterodding.com/code/vim/publish/
5 5
 
  6
+let g:xolox#publish#version = '1.7.3'
  7
+
6 8
 function! xolox#publish#resolve_files(directory, pathnames) " {{{1
7 9
   " Create a dictionary that maps the fully resolved pathnames of the files to
8 10
   " 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
47 49
           let tag_name = string(entry.name)
48 50
           let this_path = string(entry.filename)
49 51
           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)
52 54
         endif
53 55
       endif
54 56
     endif
55 57
   endfor
56 58
   if num_duplicates > 3
57 59
     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')
60 62
   endif
61 63
   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."
63 65
   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)
65 67
   return tags_to_publish
66 68
 endfunction
67 69
 
@@ -147,7 +149,7 @@ function! xolox#publish#rsync_check(target) " {{{1
147 149
       endif
148 150
     endif
149 151
   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)
151 153
   return result
152 154
 endfunction
153 155
 
@@ -155,9 +157,9 @@ function! xolox#publish#run_rsync(target, tempdir) " {{{1
155 157
   let start = xolox#misc#timer#start()
156 158
   let target = fnameescape(a:target . '/')
157 159
   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)
159 161
   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)
161 163
   if v:shell_error
162 164
     throw "publish.vim: Failed to run rsync!"
163 165
   endif
@@ -174,12 +176,12 @@ function! xolox#publish#create_dirs(target_path) " {{{1
174 176
       if !isdirectory(current_directory)
175 177
         let msg = "Failed to create directory %s! What now?"
176 178
         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))
179 181
           return 0
180 182
         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))
183 185
           continue
184 186
         endif
185 187
       endif
12  doc/publish.txt
@@ -14,7 +14,7 @@ in Vim scripting so I decided to clean up my code and release it. If you're
14 14
 wondering what the result looks like, I've published the plug-in source code
15 15
 [2] as a demonstration.
16 16
 
17  
-==============================================================================
  17
+===============================================================================
18 18
                                                     *publish-installation-usage*
19 19
 Installation & usage ~
20 20
 
@@ -53,7 +53,7 @@ the script as '~/publish_test.vim' and try it in Vim by executing the command
53 53
 moment and after that you will find a bunch of syntax highlighted, interlinked
54 54
 HTML documents in the 'target' directory!
55 55
 
56  
-==============================================================================
  56
+===============================================================================
57 57
 Publishing to a remote location (website) ~
58 58
 
59 59
 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
73 73
 installed. This cuts the time to publish to a remote location in half and
74 74
 enables the plug-in to automatically create directories on the remote side.
75 75
 
76  
-==============================================================================
  76
+===============================================================================
77 77
                                                                *publish-contact*
78 78
 Contact ~
79 79
 
@@ -82,14 +82,14 @@ contacted at peter@peterodding.com. The latest version is available at
82 82
 http://peterodding.com/code/vim/publish/ and http://github.com/xolox/vim-publish.
83 83
 If you like the script please vote for it on Vim Online [7].
84 84
 
85  
-==============================================================================
  85
+===============================================================================
86 86
                                                                *publish-license*
87 87
 License ~
88 88
 
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
90 90
 Odding <peter@peterodding.com>.
91 91
 
92  
-==============================================================================
  92
+===============================================================================
93 93
                                                             *publish-references*
94 94
 References ~
95 95
 
24  plugin/publish.vim
... ...
@@ -1,14 +1,12 @@
1 1
 " Vim plug-in
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: May 26, 2011
  3
+" Last Change: September 4, 2011
4 4
 " URL: http://peterodding.com/code/vim/publish/
5  
-" License: MIT
6  
-" Version: 1.7.2
7 5
 
8 6
 " Support for automatic update using the GLVS plug-in.
9 7
 " GetLatestVimScripts: 2252 1 :AutoInstall: publish.zip
10 8
 
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.
12 10
 if &cp || exists('g:loaded_publish')
13 11
   finish
14 12
 endif
@@ -23,7 +21,7 @@ endif
23 21
 
24 22
 function! Publish(source, target, files) abort
25 23
   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')
27 25
   let s:files_to_publish = xolox#publish#resolve_files(a:source, a:files)
28 26
   call xolox#publish#update_tags(values(s:files_to_publish))
29 27
   let s:tags_to_publish = xolox#publish#find_tags(s:files_to_publish)
@@ -40,7 +38,7 @@ function! Publish(source, target, files) abort
40 38
     let source_path = xolox#misc#path#merge(a:source, pathname)
41 39
     let suffix = g:publish_omit_dothtml ? '' : '.html'
42 40
     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))
44 42
     if !xolox#publish#create_dirs(target_path)
45 43
       return
46 44
     endif
@@ -60,13 +58,13 @@ function! Publish(source, target, files) abort
60 58
     let highlight_start = xolox#misc#timer#start()
61 59
     call xolox#publish#munge_syntax_items()
62 60
     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)
65 63
     if exists('tags_to_links_command')
66 64
       let tags_to_links_start = xolox#misc#timer#start()
67 65
       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)
70 68
     endif
71 69
     call xolox#publish#customize_html(pathname)
72 70
     silent execute 'write!' fnameescape(target_path)
@@ -76,9 +74,9 @@ function! Publish(source, target, files) abort
76 74
   if rsync_target != ''
77 75
     call xolox#publish#run_rsync(rsync_target, rsync_dir)
78 76
   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)
82 80
   call xolox#publish#prep_env(0)
83 81
 endfunction
84 82
 

0 notes on commit f0d2b02

Please sign in to comment.
Something went wrong with that request. Please try again.