Permalink
Browse files

Merged travisjeffery's Rakefile branch for easier plugin installation.

  • Loading branch information...
1 parent 32dc53b commit 59655c92d7ac00b7dbe7a51edbeee2241e1ed569 @hallettj committed Apr 10, 2009
Showing with 70 additions and 3 deletions.
  1. +8 −3 README.markdown
  2. +62 −0 Rakefile
View
@@ -1,7 +1,7 @@
jslint.vim
=============
-VIM plugin and command line tool for running JSLint <http://jslint.com/>.
+Vim plugin and command line tool for running JSLint <http://jslint.com/>.
JSLint is a handy tool that spots errors and common mistakes in
JavaScript code.
@@ -19,8 +19,12 @@ Installation and Use
On Windows you can use `cscript.exe` - which is probably already installed.
-- Copy the directory plugin/jslint/ into your Vim plugin directory. Usually
- this is `~/.vim/plugin/`. On Windows it is `~/vimfiles/plugin/`.
+- If you have rake installed, run:
+
+ $ rake install
+
+ Otherwise copy the directory plugin/jslint/ into your Vim plugin directory.
+ Usually this is `~/.vim/plugin/`. On Windows it is `~/vimfiles/plugin/`.
- Open a JavaScript file in Vim and run the command `:JSLint` to check the
file. Potential errors will be highlighted in red. Run `:JSLint` again once
@@ -46,6 +50,7 @@ Credits
- Jesse Hallett -- original author
- Nathan Smith -- Windows compatibility and many other improvements
+- Travis Jeffery -- Easy plugin installation with rake
License
View
@@ -0,0 +1,62 @@
+# written by travis jeffery <travisjeffery@gmail.com>
+# contributions by scrooloose <github:scrooloose>
+
+require 'rake'
+require 'find'
+require 'pathname'
+
+PLUGIN = [
+ "plugin/jslint/fulljslint.js",
+ "plugin/jslint/jslint.vim",
+ "plugin/jslint/runjslint.js",
+ "plugin/jslint/runjslint.wsf",
+ "README.markdown",
+ "LICENSE"
+]
+
+files = PLUGIN
+
+desc 'Zip up the project files'
+task :zip do
+ zip_name = File.basename(File.dirname(__FILE__))
+ zip_name.gsub!(/ /, '_')
+ zip_name = "#{zip_name}.zip"
+
+ if File.exist?(zip_name)
+ abort("Zip file #{zip_name} already exists. Remove it first.")
+ end
+
+ puts "Creating zip file: #{zip_name}"
+ system("zip #{zip_name} #{files.join(" ")}")
+end
+
+desc 'Install plugin and documentation'
+task :install do
+ vimfiles = if ENV['VIMFILES']
+ ENV['VIMFILES']
+ elsif RUBY_PLATFORM =~ /(win|w)32$/
+ File.expand_path("~/vimfiles")
+ else
+ File.expand_path("~/.vim")
+ end
+ target_dir = File.join(vimfiles, 'plugin', 'jslint')
+ FileUtils.mkdir_p target_dir
+ files.each do |file|
+ FileUtils.cp file, target_dir
+ puts "Installed #{file} to #{target_dir}/"
+ end
+
+end
+
+desc 'Pulls from origin'
+task :pull do
+ puts "Updating local repo..."
+ system("cd " << Dir.new(File.dirname(__FILE__)).path << " && git pull")
+end
+
+desc 'Calls pull task and then install task'
+task :update => ['pull', 'install'] do
+ puts "Update of vim script complete."
+end
+
+task :default => ['update']

0 comments on commit 59655c9

Please sign in to comment.