Permalink
Browse files

add version

  • Loading branch information...
1 parent 2c3d45d commit 2372484dee02ba17eb2c3e3d66a77241c8af2234 @c9s committed Mar 23, 2010
Showing with 186 additions and 58 deletions.
  1. +164 −55 Makefile
  2. +17 −0 README.mkd
  3. +1 −1 autoload/libperl.vim
  4. +4 −1 config.mk
  5. +0 −1 plugin/cpan.vim
View
219 Makefile
@@ -1,9 +1,23 @@
# vim:filetype=make:foldmethod=marker:fdl=0:
+#
+#
+# Look at the stars, Look how they shine for you, And everything you do,
+# Yeah they were all yellow,
+#
+# I came along, I wrote a song for you, And all the things you do And it was
+# called yellow.
+#
+# So then I took my turn. Oh all the things I've done And it was all yellow
+#
+# - Coldplay
+#
+#
# Makefile: install/uninstall/link vim plugin files.
# Author: Cornelius <cornelius.howl@gmail.com>
# Date: 一 3/15 22:49:26 2010
+# Version: 1.0
+#
# PLEASE DO NOT EDIT THIS FILE. THIS FILE IS AUTO-GENERATED FROM Makefile.tpl
-# TODO: support vimball.
# LICENSE {{{
# Copyright (c) 2010 <Cornelius (c9s)>
#
@@ -44,21 +58,43 @@ RECORD_FILE=.record
PWD=`pwd`
README_FILES=`find . -type f -iname "README*"`
README_FILES=`find . -type f -iname "README*"`
-WGET_OPT="-c -nv"
-CURL_OPT=""
+WGET_OPT=-c -nv
+CURL_OPT=
+RECORD_SCRIPT=.mkrecord
+TAR=tar czvHf
-# FUNCTIONS {{{
+# INTERNAL FUNCTIONS {{{
+record_file = \
+ PTYPE=`cat $(1) | perl -nle 'print $$1 if /^"\s*script\s*type:\s*(\S*)$$/i'` ;\
+ echo $(VIMRUNTIME)/$$PTYPE/$(1) >> $(2)
+
+# }}}
+
+# PUBLIC FUNCTIONS {{{
+
+# install file by inspecting content
+install_file = \
+ PTYPE=`cat $(1) | perl -nle 'print $$1 if /^"\s*script\s*type:\s*(\S*)$$/i'` ;\
+ cp -v $(1) $(VIMRUNTIME)/$$PTYPE/$(1)
+
+link_file = \
+ PTYPE=`cat $(1) | perl -nle 'print $$1 if /^"\s*script\s*type:\s*(\S*)$$/i'` ;\
+ cp -v $(1) $(VIMRUNTIME)/$$PTYPE/$(1)
+
+unlink_file = \
+ PTYPE=`cat $(1) | perl -nle 'print $$1 if /^"\s*script\s*type:\s*(\S*)$$/i'` ;\
+ rm -fv $(VIMRUNTIME)/$$PTYPE/$(1)
# fetch script from an url
-fetch_deps = \
+fetch_url = \
@if [[ -e $(2) ]] ; then \
exit \
; fi \
; echo " => $(2)" \
- ; if [[ ! -z `which wget` ]] ; then \
+ ; if [[ ! -z `which curl` ]] ; then \
+ curl $(CURL_OPT) $(1) -o $(2) ; \
+ ; elif [[ ! -z `which wget` ]] ; then \
wget $(WGET_OPT) $(1) -O $(2) \
- ; elif [[ ! -z `which curl` ]] ; then \
- curl $(CURL_OPT) $(1) > $(2) ; \
; fi \
; echo $(2) >> .bundlefiles
@@ -68,10 +104,10 @@ fetch_github = \
exit \
; fi \
; echo " => $(5)" \
- ; if [[ ! -z `which wget` ]] ; then \
+ ; if [[ ! -z `which curl` ]] ; then \
+ curl $(CURL_OPT) http://github.com/$(1)/$(2)/raw/$(3)/$(4) -o $(5) \
+ ; elif [[ ! -z `which wget` ]] ; then \
wget $(WGET_OPT) http://github.com/$(1)/$(2)/raw/$(3)/$(4) -O $(5) \
- ; elif [[ ! -z `which curl` ]] ; then \
- curl $(CURL_OPT) http://github.com/$(1)/$(2)/raw/$(3)/$(4) > $(5) \
; fi \
; echo $(5) >> .bundlefiles
@@ -85,6 +121,7 @@ fetch_local = @cp -v $(1) $(2) \
# Default plugin name
NAME=`basename \`pwd\``
+VERSION=0.1
# Files to add to tarball:
DIRS=`ls -1F | grep / | sed -e 's/\///'`
@@ -93,7 +130,7 @@ DIRS=`ls -1F | grep / | sed -e 's/\///'`
VIMRUNTIME=~/.vim
# Other Files to be added:
-OTHER_FILES=
+FILES=`ls -1 | grep '.vim$$'` Makefile *.mk
# ======== USER CONFIG ======= {{{
# please write config in config.mk
@@ -109,103 +146,175 @@ OTHER_FILES=
#
# Files to add to tarball:
#
-# OTHER_FILES=
+# FILES=
#
# Bundle dependent scripts:
#
# bundle-deps:
# $(call fetch_github,[account id],[project],[branch],[source path],[target path])
# $(call fetch_url,[file url],[target path])
# $(call fetch_local,[from],[to])
--include config.mk
-# }}}
+CONFIG_FILE=config.mk
+-include ~/.vimauthor.mk
+-include $(CONFIG_FILE)
+
+# }}}
# }}}
# ======= SECTIONS ======= {{{
+-include ext.mk
+
all: install
-bundle: bundle-deps
+check-require:
+ @if [[ -n `which wget` || -n `which curl` || -n `which fetch` ]]; then echo "wget|curl|fetch: OK" ; else echo "wget|curl|fetch: NOT OK" ; fi
+ @if [[ -n `which vim` ]] ; then echo "vim: OK" ; else echo "vim: NOT OK" ; fi
+
+
+config:
+ @rm -f $(CONFIG_FILE)
+ @echo "NAME=" >> $(CONFIG_FILE)
+ @echo "VERSION=" >> $(CONFIG_FILE)
+ @echo "#DIRS="
+ @echo "#FILES="
+ @echo "" >> $(CONFIG_FILE)
+ @echo "bundle-deps:" >> $(CONFIG_FILE)
+ @echo "\t\t\$$(call fetch_github,ID,REPOSITORY,BRANCH,PATH,TARGET_PATH)" >> $(CONFIG_FILE)
+ @echo "\t\t\$$(call fetch_url,FILE_URL,TARGET_PATH)" >> $(CONFIG_FILE)
+
+
+init-author:
+ @echo "AUTHOR=" > ~/.vimauthor.mk
+
+bundle-deps:
+
+bundle: bundle-deps
dist: bundle mkfilelist
- @tar czvHf $(NAME).tar.gz --exclude '*.svn' --exclude '.git' $(DIRS) $(README_FILES) $(OTHER_FILES)
+ @$(TAR) $(NAME)-$(VERSION).tar.gz --exclude '*.svn' --exclude '.git' $(DIRS) $(README_FILES) $(FILES)
@echo "$(NAME).tar.gz is ready."
init-runtime:
- @mkdir -p $(VIMRUNTIME)
- @mkdir -p $(VIMRUNTIME)/record
- @find $(DIRS) -type d | while read dir ; do \
- mkdir -p $(VIMRUNTIME)/$$dir ; done
+ @mkdir -vp $(VIMRUNTIME)
+ @mkdir -vp $(VIMRUNTIME)/record
+ @if [[ -n "$(DIRS)" ]] ; then find $(DIRS) -type d | while read dir ; do \
+ mkdir -vp $(VIMRUNTIME)/$$dir ; done ; fi
release:
if [[ -n `which vimup` ]] ; then \
fi
pure-install:
@echo "Installing"
- @find $(DIRS) -type f | while read file ; do \
- cp -v $$file $(VIMRUNTIME)/$$file ; done
+ @if [[ -n "$(DIRS)" ]] ; then find $(DIRS) -type f | while read file ; do \
+ cp -v $$file $(VIMRUNTIME)/$$file ; done ; fi
+ @echo "$(FILES)" | while read vimfile ; do \
+ if [[ -n $$vimfile ]] ; then \
+ $(call install_file,$$vimfile) ; fi ; done
install: init-runtime bundle pure-install record
-uninstall: rmrecord
+
+uninstall-files:
@echo "Uninstalling"
- @find $(DIRS) -type f | while read file ; do \
- rm -v $(VIMRUNTIME)/$$file ; done
+ @if [[ -n "$(DIRS)" ]] ; then find $(DIRS) -type f | while read file ; do \
+ rm -fv $(VIMRUNTIME)/$$file ; done ; fi
+ @echo "$(FILES)" | while read vimfile ; do \
+ if [[ -n $$vimfile ]] ; then \
+ $(call unlink_file,$$vimfile) ; fi ; done
+
+uninstall: uninstall-files rmrecord
link: init-runtime
@echo "Linking"
- @find $(DIRS) -type f | while read file ; do \
- ln -sfv $(PWD)/$$file $(VIMRUNTIME)/$$file ; done
+ @if [[ -n "$(DIRS)" ]]; then find $(DIRS) -type f | while read file ; do \
+ ln -sfv $(PWD)/$$file $(VIMRUNTIME)/$$file ; done ; fi
+ @echo "$(FILES)" | while read vimfile ; do \
+ if [[ -n $$vimfile ]] ; then \
+ $(call link_file,$$vimfile) ; fi ; done
mkfilelist:
@echo $(NAME) > $(RECORD_FILE)
- @find $(DIRS) -type f | while read file ; do \
- echo $(VIMRUNTIME)/$$file >> $(RECORD_FILE) ; done
+ @echo $(VERSION) >> $(RECORD_FILE)
+ @if [[ -n "$(DIRS)" ]] ; then find $(DIRS) -type f | while read file ; do \
+ echo $(VIMRUNTIME)/$$file >> $(RECORD_FILE) ; done ; fi
+ @echo "$(FILES)" | while read vimfile ; do \
+ if [[ -n $$vimfile ]] ; then \
+ $(call record_file,$$vimfile,$(RECORD_FILE)) ; fi ; done
+
+vimball-edit:
+ find $(DIRS) -type f > .tmp_list
+ vim .tmp_list
+ vim .tmp_list -c ":MkVimball $(NAME)-$(VERSION)" -c "q"
+ @rm -vf .tmp_list
+ @echo "$(NAME)-$(VERSION).vba is ready."
+
+vimball:
+ find $(DIRS) -type f > .tmp_list
+ vim .tmp_list -c ":MkVimball $(NAME)-$(VERSION)" -c "q"
+ @rm -vf .tmp_list
+ @echo "$(NAME)-$(VERSION).vba is ready."
mkrecordscript:
- @echo "" > .record.vim
- @echo "fun! s:mkmd5(file)" >> .record.vim
- @echo " if executable('md5')" >> .record.vim
- @echo " return system('cat ' . a:file . ' | md5')" >> .record.vim
- @echo " else" >> .record.vim
- @echo " return \"\"" >> .record.vim
- @echo " endif" >> .record.vim
- @echo "endf" >> .record.vim
- @echo "let files = readfile('.record')" >> .record.vim
- @echo "let package_name = remove(files,0)" >> .record.vim
- @echo "let record = { 'version' : 0.3 , 'generated_by': 'Vim-Makefile' , 'install_type' : 'makefile' , 'package' : package_name , 'files': [ ] }" >> .record.vim
- @echo "for file in files " >> .record.vim
- @echo " let md5 = s:mkmd5(file)" >> .record.vim
- @echo " cal add( record.files , { 'checksum': md5 , 'file': file } )" >> .record.vim
- @echo "endfor" >> .record.vim
- @echo "redir => output" >> .record.vim
- @echo "silent echon record" >> .record.vim
- @echo "redir END" >> .record.vim
- @echo "let content = join(split(output,\"\\\\n\"),'')" >> .record.vim
- @echo "let record_file = expand('~/.vim/record/' . package_name )" >> .record.vim
- @echo "cal writefile( [content] , record_file )" >> .record.vim
- @echo "echo \"Done\"" >> .record.vim
+ @echo "" > $(RECORD_SCRIPT)
+ @echo "fun! s:mkmd5(file)" >> $(RECORD_SCRIPT)
+ @echo " if executable('md5')" >> $(RECORD_SCRIPT)
+ @echo " return system('cat ' . a:file . ' | md5')" >> $(RECORD_SCRIPT)
+ @echo " else" >> $(RECORD_SCRIPT)
+ @echo " return \"\"" >> $(RECORD_SCRIPT)
+ @echo " endif" >> $(RECORD_SCRIPT)
+ @echo "endf" >> $(RECORD_SCRIPT)
+ @echo "let files = readfile('.record')" >> $(RECORD_SCRIPT)
+ @echo "let package_name = remove(files,0)" >> $(RECORD_SCRIPT)
+ @echo "let script_version = remove(files,0)" >> $(RECORD_SCRIPT)
+ @echo "let record = { 'version' : 0.3 , 'generated_by': 'Vim-Makefile' , 'script_version': script_version , 'install_type' : 'makefile' , 'package' : package_name , 'files': [ ] }" >> $(RECORD_SCRIPT)
+ @echo "for file in files " >> $(RECORD_SCRIPT)
+ @echo " let md5 = s:mkmd5(file)" >> $(RECORD_SCRIPT)
+ @echo " cal add( record.files , { 'checksum': md5 , 'file': file } )" >> $(RECORD_SCRIPT)
+ @echo "endfor" >> $(RECORD_SCRIPT)
+ @echo "redir => output" >> $(RECORD_SCRIPT)
+ @echo "silent echon record" >> $(RECORD_SCRIPT)
+ @echo "redir END" >> $(RECORD_SCRIPT)
+ @echo "let content = join(split(output,\"\\\\n\"),'')" >> $(RECORD_SCRIPT)
+ @echo "let record_file = expand('~/.vim/record/' . package_name )" >> $(RECORD_SCRIPT)
+ @echo "cal writefile( [content] , record_file )" >> $(RECORD_SCRIPT)
+ @echo "echo \"Done\"" >> $(RECORD_SCRIPT)
record: mkfilelist mkrecordscript
- vim --noplugin -V10install.log -c "so .record.vim" -c "q"
+ vim --noplugin -V10install.log -c "so $(RECORD_SCRIPT)" -c "q"
@echo "Vim script record making log: install.log"
rmrecord:
+ @echo "Removing Record"
@rm -vf $(VIMRUNTIME)/record/$(NAME)
clean: clean-bundle-deps
- rm -f $(RECORD_FILE)
- rm -f install.log
+ @rm -vf $(RECORD_FILE)
+ @rm -vf $(RECORD_SCRIPT)
+ @rm -vf install.log
+ @rm -vf *.tar.gz
clean-bundle-deps:
+ @echo "Removing Bundled scripts..."
@if [[ -e .bundlefiles ]] ; then \
rm -fv `echo \`cat .bundlefiles\``; \
fi
@rm -fv .bundlefiles
+update:
+ @echo "Updating Makefile..."
+ @URL=http://github.com/c9s/vim-makefile/raw/master/Makefile ; \
+ if [[ -n `which curl` ]]; then \
+ curl $$URL -o Makefile ; \
+ if [[ -n `which wget` ]]; then \
+ wget -c $$URL ; \
+ elif [[ -n `which fetch` ]]; then \
+ fetch $$URL ; \
+ fi
+
version:
@echo version - $(MAKEFILE_VERSION)
View
@@ -31,32 +31,49 @@ CPAN Window:
- *C-c C-m* - to open cpan window horizontally
+
- *C-c C-v* - to open cpan window vertically
#### Insert Mode
- *Enter* - to go to the first matched module file.
+
- *C-t* - to go to the first matched module file in new tab.
+
- *@* - to search module by current pattern in your browser
+
- *Tab* - to switch cpan window mode (search all modules or installed modules)
+
- *C-n* - next result
+
- *C-p* - previous result
+
(support bash style bindings , eg: `<C-a>, <C-e>, <C-f>, <C-b>` )
#### Normal Mode
- *C-n* - next result
+
- *C-p* - previous result
+
- *Enter* - to go to the first matched module file.
+
- *t* - to go to the module file in new tab
+
- *@* - to see the module documentation in your browser
+
- *!* - to see the module documentation by perldoc command
+
- *$* - to see the module documentation inside vim window
+
- *I* - to install the module
+
- *ESC ESC* - to close cpan window
+- *?* - to show commands
+
Commands
========
View
@@ -1,4 +1,4 @@
-
+finish
" vim:fdm=syntax:fdl=0:
"
" libperl.vim
View
@@ -1,6 +1,9 @@
+
+
NAME=cpan.vim
+DIRS=autoload/ plugin/
+VERSION=0.8
bundle-deps:
- $(call fetch_github,c9s,libperl.vim,master,vimlib/autoload/libperl.vim,autoload/libperl.vim)
$(call fetch_github,c9s,search-window.vim,master,vimlib/autoload/swindow.vim,autoload/swindow.vim)
$(call fetch_github,c9s,perldoc.vim,master,vimlib/autoload/perldoc.vim,autoload/perldoc.vim)
Oops, something went wrong.

0 comments on commit 2372484

Please sign in to comment.