vimget 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/vim-get +15 -0
- data/lib/vimget/command.rb +157 -0
- data/lib/vimget/command_manager.rb +126 -0
- data/lib/vimget/commands/clean_command.rb +35 -0
- data/lib/vimget/commands/install_command.rb +75 -0
- data/lib/vimget/commands/installed_command.rb +34 -0
- data/lib/vimget/commands/list_command.rb +71 -0
- data/lib/vimget/commands/outdated_command.rb +34 -0
- data/lib/vimget/commands/sync_command.rb +39 -0
- data/lib/vimget/commands/uninstall_command.rb +59 -0
- data/lib/vimget/commands/upgrade_command.rb +41 -0
- data/lib/vimget/configure.rb +33 -0
- data/lib/vimget/db.rb +139 -0
- data/lib/vimget/exceptions.rb +24 -0
- data/lib/vimget/installer.rb +158 -0
- data/lib/vimget/script.rb +56 -0
- data/lib/vimget/webparser.rb +33 -0
- data/lib/vimget.rb +37 -0
- data/test/tc_db.rb +45 -0
- data/test/tc_installer.rb +23 -0
- data/test/tc_script.rb +57 -0
- data/test/ts_vimget.rb +11 -0
- metadata +85 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Configure management
|
4
|
+
#
|
5
|
+
# 2008 (c) Eddy Xu <eddyxu@gmail.com>
|
6
|
+
#
|
7
|
+
# $Id: configure.rb 3 2008-04-02 20:47:49Z eddyxu $
|
8
|
+
|
9
|
+
|
10
|
+
module VimGet
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def configure
|
14
|
+
@configure ||= Configure.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Configure
|
19
|
+
attr_reader :base_dir, :db_dir, :distfiles_dir, :vim_dir
|
20
|
+
attr_accessor :debug, :verbose
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
@base_dir = "~/.vimget"
|
24
|
+
@vim_dir = "~/.vim"
|
25
|
+
@db_dir = File.join(@base_dir, "db")
|
26
|
+
@distfiles_dir = File.join(@base_dir, "distfiles")
|
27
|
+
@debug = false
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/lib/vimget/db.rb
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# manage local script index database
|
4
|
+
#
|
5
|
+
# $Id: db.rb 5 2008-04-11 18:33:39Z eddyxu $
|
6
|
+
|
7
|
+
require "vimget/configure"
|
8
|
+
require "vimget/script"
|
9
|
+
|
10
|
+
module VimGet
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def db
|
14
|
+
@db ||= VimGet::PathDB.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class PathDB
|
19
|
+
@@EXT = ".manifest"
|
20
|
+
attr_reader :db_path
|
21
|
+
|
22
|
+
def initialize(parent_path = "")
|
23
|
+
parent_path = VimGet.configure.base_dir if parent_path.empty?
|
24
|
+
|
25
|
+
@db_path = File.expand_path(File.join(parent_path, "db"))
|
26
|
+
Dir.mkdir(@db_path) if !File.exist?(@db_path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def add(script)
|
30
|
+
file_path = File.join(@db_path, script.name + @@EXT)
|
31
|
+
file_path = File.expand_path(file_path)
|
32
|
+
File.open(file_path, 'w') do |f|
|
33
|
+
f.truncate(0)
|
34
|
+
|
35
|
+
ctx = <<-SCRIPT
|
36
|
+
# this file is automatical generate by vim-get. Do not motifiy it manualy.
|
37
|
+
|
38
|
+
name #{script.name}
|
39
|
+
id #{script.sid}
|
40
|
+
author #{script.author}
|
41
|
+
installed #{script.installed}
|
42
|
+
version #{script.version}
|
43
|
+
download #{script.download}
|
44
|
+
|
45
|
+
manifest {
|
46
|
+
#{script.manifest.dup.collect! {|l| l = " #{l}\n"}}}
|
47
|
+
|
48
|
+
SCRIPT
|
49
|
+
f.write(ctx)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def update(script)
|
55
|
+
if script.manifest.empty?
|
56
|
+
filepath = File.join(@db_path, script.name + @@EXT)
|
57
|
+
s = parse_script(filepath)
|
58
|
+
script.manifest = s.manifest if s
|
59
|
+
end
|
60
|
+
|
61
|
+
add(script)
|
62
|
+
end
|
63
|
+
|
64
|
+
def remove(script)
|
65
|
+
file_path = File.join(@db_path, script.name + @@EXT)
|
66
|
+
file_path = File.expand_path(file_path)
|
67
|
+
File.delete(file_path)
|
68
|
+
end
|
69
|
+
|
70
|
+
def search(pattern = "")
|
71
|
+
file_list = Array.new
|
72
|
+
glob_pattern = (pattern.nil? or pattern.empty?) ? "*" : "*#{pattern}*"
|
73
|
+
|
74
|
+
glob_pattern = File.expand_path(File.join(@db_path, glob_pattern + ".manifest"))
|
75
|
+
file_list = Dir.glob(glob_pattern)
|
76
|
+
|
77
|
+
ret = Array.new
|
78
|
+
closure = ""
|
79
|
+
file_list.each do |f|
|
80
|
+
ret << parse_script(f)
|
81
|
+
end
|
82
|
+
ret
|
83
|
+
end
|
84
|
+
|
85
|
+
def find_with_id(sid)
|
86
|
+
search.each { |s| return s if s.sid == sid }
|
87
|
+
return nil
|
88
|
+
end
|
89
|
+
|
90
|
+
def find(name)
|
91
|
+
# find a script by using name, if not one finded, return nil
|
92
|
+
search.each { |s| return s if s.name == name }
|
93
|
+
return nil
|
94
|
+
end
|
95
|
+
|
96
|
+
def get_outdated_scripts
|
97
|
+
scripts = search()
|
98
|
+
|
99
|
+
ret_array = Array.new
|
100
|
+
scripts.each { |s| ret_array << s if s.outdated? }
|
101
|
+
return ret_array
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def parse_script(filepath)
|
107
|
+
return nil if !File.exist?(filepath)
|
108
|
+
ctn = {}
|
109
|
+
closure = ""
|
110
|
+
File.open(filepath, "r").each_line do |line|
|
111
|
+
line.gsub!(/\#.*$/, "")
|
112
|
+
next if line.nil?
|
113
|
+
line.strip!
|
114
|
+
next if line.empty?
|
115
|
+
|
116
|
+
if line.include? "{"
|
117
|
+
closure = "manifest"
|
118
|
+
ctn["manifest"] = []
|
119
|
+
elsif line.include? "}"
|
120
|
+
closure = ""
|
121
|
+
elsif ! closure.empty?
|
122
|
+
ctn["manifest"] << line
|
123
|
+
else
|
124
|
+
k,*v = line.split
|
125
|
+
ctn[k] = v.join(" ")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
s = Script.new(ctn["id"].to_i, ctn["name"])
|
130
|
+
s.download = ctn["download"]
|
131
|
+
s.version = ctn["version"]
|
132
|
+
s.installed = ctn["installed"]
|
133
|
+
s.manifest = ctn["manifest"]
|
134
|
+
s.author = ctn["author"]
|
135
|
+
return s
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# VimGet exceptions
|
4
|
+
#
|
5
|
+
# Eddy Xu <eddyxu@gmail.com>
|
6
|
+
#
|
7
|
+
# 2008 (c) Quarkware.com
|
8
|
+
#
|
9
|
+
# $Id: exceptions.rb 3 2008-04-02 20:47:49Z eddyxu $
|
10
|
+
|
11
|
+
module VimGet
|
12
|
+
|
13
|
+
# base exception
|
14
|
+
class Exception < RuntimeError; end
|
15
|
+
|
16
|
+
class CommandLineError < VimGet::Exception; end
|
17
|
+
|
18
|
+
class InstallError < VimGet::Exception; end
|
19
|
+
|
20
|
+
class UnknownScriptError < VimGet::Exception; end
|
21
|
+
|
22
|
+
class NetworkError < VimGet::Exception; end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# File installer.rb
|
4
|
+
#
|
5
|
+
# Brief act the install operations
|
6
|
+
#
|
7
|
+
# Author Eddy Xu <eddyxu@gmail.com>
|
8
|
+
#
|
9
|
+
# Copyright 2008 (c) Quarkware.com
|
10
|
+
#
|
11
|
+
# $Id: installer.rb 6 2008-04-11 19:01:26Z eddyxu $
|
12
|
+
|
13
|
+
require 'fileutils'
|
14
|
+
require 'open-uri'
|
15
|
+
require "vimget/configure"
|
16
|
+
require "vimget/script"
|
17
|
+
require "vimget/db"
|
18
|
+
|
19
|
+
module VimGet
|
20
|
+
|
21
|
+
class Installer
|
22
|
+
# Manage the installing progress and uninstall/upgrading etc
|
23
|
+
def initialize(opts = {})
|
24
|
+
@options = opts
|
25
|
+
#@dist_path = VimGet.configure.distfiles_dir
|
26
|
+
end
|
27
|
+
|
28
|
+
def install(script)
|
29
|
+
filepath = fetch(script)
|
30
|
+
script.manifest = extract(filepath)
|
31
|
+
|
32
|
+
script.installed = script.version
|
33
|
+
VimGet.db.update(script) unless @options[:dry_run]
|
34
|
+
end
|
35
|
+
|
36
|
+
def uninstall(script)
|
37
|
+
puts "#{script.name} is not installed yet.";return if !script.installed?
|
38
|
+
|
39
|
+
puts "Uninstalling #{script.name}..."
|
40
|
+
remove_manifest(script)
|
41
|
+
|
42
|
+
if @options[:purge]
|
43
|
+
print "Delete manifest file of #{script.name}..."
|
44
|
+
VimGet.db.remove(script)
|
45
|
+
puts "Done"
|
46
|
+
else
|
47
|
+
script.installed = ""
|
48
|
+
VimGet.db.update(script)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def upgrade(script)
|
53
|
+
puts "#{script.name} is not installed yet."; return if !script.installed?
|
54
|
+
|
55
|
+
puts "Upgrading #{script.name}-#{script.installed}(Relacing by #{script.version})..."
|
56
|
+
remove_manifest(script)
|
57
|
+
install(script)
|
58
|
+
end
|
59
|
+
|
60
|
+
def fetch(script)
|
61
|
+
#raise RuntimeError if script.kind_of? Script
|
62
|
+
|
63
|
+
url = "http://www.vim.org/scripts/#{script.download}"
|
64
|
+
print "Downloading...#{url}..." unless @options[:verbose]
|
65
|
+
STDOUT.flush
|
66
|
+
distfile = ""
|
67
|
+
open(url) do |f|
|
68
|
+
if f.meta["content-disposition"] =~ /filename=(.+)/
|
69
|
+
filename = $1
|
70
|
+
else
|
71
|
+
raise NetworkError, "Can not find appropiated filename"
|
72
|
+
end
|
73
|
+
|
74
|
+
puts filename
|
75
|
+
|
76
|
+
distfile = File.join(VimGet.configure.distfiles_dir, filename)
|
77
|
+
puts "Saving in #{distfile}" if VimGet.configure.verbose
|
78
|
+
File.open(File.expand_path(distfile), "w") do |df|
|
79
|
+
df.truncate(0)
|
80
|
+
df.write(f.read)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
return distfile
|
84
|
+
end
|
85
|
+
|
86
|
+
def extract(filepath)
|
87
|
+
abs_file = File.expand_path(filepath)
|
88
|
+
raise InstallError, "File #{filepath} is not existed!" if not File.exist? abs_file
|
89
|
+
FileUtils.mkdir_p(File.expand_path(VimGet.configure.vim_dir)) if not File.exist? VimGet.configure.vim_dir
|
90
|
+
|
91
|
+
ext = File.extname(abs_file)
|
92
|
+
case ext
|
93
|
+
when ".zip"
|
94
|
+
extract_zip abs_file
|
95
|
+
when ".rar"
|
96
|
+
extract_rar abs_file
|
97
|
+
when ".tgz", ".gz"
|
98
|
+
extract_tar(abs_file, "xzof")
|
99
|
+
when ".bz", ".bz2",".tbz"
|
100
|
+
extract_tar(abs_file, "xjof")
|
101
|
+
when ".vim"
|
102
|
+
FileUtils.cp abs_file, File.expand_path(File.join(VimGet.configure.vim_dir, "plugin"))
|
103
|
+
["#{File.join("plugin", File.basename(abs_file))}"]
|
104
|
+
else
|
105
|
+
raise InstallError, "Unknown ext name: #{ext}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def extract_zip(filepath)
|
112
|
+
cmd = "unzip -o #{filepath} -d #{VimGet.configure.vim_dir}"
|
113
|
+
puts cmd if VimGet.configure.verbose
|
114
|
+
manifest = []
|
115
|
+
IO.popen(cmd, "r") do |p|
|
116
|
+
p.each_line do |l|
|
117
|
+
manifest << $1 if l =~ /inflating\: #{File.expand_path(VimGet.configure.vim_dir)}\/(.+)/
|
118
|
+
end
|
119
|
+
end
|
120
|
+
manifest
|
121
|
+
end
|
122
|
+
|
123
|
+
def extract_rar
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
|
127
|
+
def extract_tar(filepath, flags)
|
128
|
+
manifest = []
|
129
|
+
IO.popen("tar -tf #{filepath}", "r") do |p|
|
130
|
+
p.each_line { |l| manifest << l.strip() }
|
131
|
+
end
|
132
|
+
|
133
|
+
cmd = "tar -C #{File.expand_path(VimGet.configure.vim_dir)} -#{flags} #{filepath} "
|
134
|
+
puts cmd if @options[:verbose]
|
135
|
+
system(cmd)
|
136
|
+
|
137
|
+
manifest
|
138
|
+
end
|
139
|
+
|
140
|
+
def absolute_vim_path(related_path)
|
141
|
+
File.expand_path(File.join(VimGet.configure.vim_dir, related_path))
|
142
|
+
end
|
143
|
+
|
144
|
+
def remove_manifest(script)
|
145
|
+
script.manifest.each do |f|
|
146
|
+
abs_path = absolute_vim_path(f)
|
147
|
+
print " Deleting #{abs_path}..." if @options[:verbose]
|
148
|
+
if not File.exist?(abs_path)
|
149
|
+
puts "Missing!" if @options[:verbose]
|
150
|
+
next
|
151
|
+
end
|
152
|
+
File.delete(abs_path) unless @options[:dry_run]
|
153
|
+
puts "Ok" if @options[:verbose]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# @file script.py
|
4
|
+
#
|
5
|
+
# @brief encapusulate script attributes
|
6
|
+
#
|
7
|
+
# @author Eddy Xu <eddyxu@gmail.com>
|
8
|
+
#
|
9
|
+
# $Id: script.rb 3 2008-04-02 20:47:49Z eddyxu $
|
10
|
+
|
11
|
+
require 'rubygems'
|
12
|
+
|
13
|
+
module VimGet
|
14
|
+
|
15
|
+
class Script # < Hash?
|
16
|
+
attr_reader :sid, :name
|
17
|
+
attr_accessor :author, :installed, :version, :download, :manifest
|
18
|
+
|
19
|
+
def initialize(id, name="", author="", version="", installed="", download="",
|
20
|
+
manifest=[])
|
21
|
+
@sid = id
|
22
|
+
@name = name
|
23
|
+
@author = author
|
24
|
+
@version = version
|
25
|
+
@installed = installed
|
26
|
+
@download = download
|
27
|
+
@manifest = manifest
|
28
|
+
end
|
29
|
+
|
30
|
+
def [](key)
|
31
|
+
# act as a hash
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"#{@name}(#{@sid}): #{@version} <= #{@installed}\n" +
|
36
|
+
"By: #{@author} from #{@download}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def outdated?
|
40
|
+
if @installed.empty?
|
41
|
+
false
|
42
|
+
elsif @installed.to_f < @version.to_f
|
43
|
+
true
|
44
|
+
elsif @installed < @version
|
45
|
+
true
|
46
|
+
else
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def installed?
|
52
|
+
return !installed.empty?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# $Id: webparser.rb 3 2008-04-02 20:47:49Z eddyxu $
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'hpricot'
|
7
|
+
require 'open-uri'
|
8
|
+
require 'vimget/script'
|
9
|
+
|
10
|
+
module VimGet
|
11
|
+
|
12
|
+
def VimGet.parse_script_page(sid)
|
13
|
+
url = "http://www.vim.org/scripts/script.php?script_id=#{sid}"
|
14
|
+
puts "Fetching...#{url}..."
|
15
|
+
doc = Hpricot(open(url))
|
16
|
+
|
17
|
+
name = (doc/'title').inner_html.split(" - ")[0]
|
18
|
+
script = Script.new(sid, name)
|
19
|
+
|
20
|
+
table = (doc/"//tr[@class='tableheader']")[0]
|
21
|
+
top_row = table.next_sibling()
|
22
|
+
|
23
|
+
if top_row
|
24
|
+
ctns = top_row.containers()
|
25
|
+
script.download = ctns[0].at('a').attributes['href']
|
26
|
+
script.version = ctns[1].at('b').inner_text
|
27
|
+
script.author = ctns[4].at('a').inner_text
|
28
|
+
end
|
29
|
+
|
30
|
+
return script
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/lib/vimget.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby -wKU
|
2
|
+
#
|
3
|
+
# Main file for vim-get application
|
4
|
+
#
|
5
|
+
# Copyright GPLv2
|
6
|
+
#
|
7
|
+
# $Id: vimget.rb 5 2008-04-11 18:33:39Z eddyxu $
|
8
|
+
|
9
|
+
require "vimget/command_manager"
|
10
|
+
|
11
|
+
VIMGET_VERSION = "0.1.0"
|
12
|
+
|
13
|
+
module VimGet
|
14
|
+
|
15
|
+
# Singleton access point
|
16
|
+
class << self
|
17
|
+
def application
|
18
|
+
@application ||= VimGet::Application.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def application=(app)
|
22
|
+
@application = app
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
#-----------------------------------------------------
|
27
|
+
# VimGet application class
|
28
|
+
class Application
|
29
|
+
def initialize
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
CommandManager.instance.run(ARGV)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/test/tc_db.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# test case for db.rb
|
4
|
+
#
|
5
|
+
# $Id: tc_db.rb 4 2008-04-07 19:16:34Z eddyxu $
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require "vimget/db"
|
9
|
+
require "vimget/script"
|
10
|
+
require "tmpdir"
|
11
|
+
|
12
|
+
class TestDB < Test::Unit::TestCase
|
13
|
+
def setup
|
14
|
+
@basedir = Dir.tmpdir
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_find
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_add
|
26
|
+
s = VimGet::Script.new("123", "test")
|
27
|
+
s.author = "Eddy Xu"
|
28
|
+
s.installed = "4.23"
|
29
|
+
s.version = "5.23"
|
30
|
+
s.download = "download?from=somewhere"
|
31
|
+
s.manifest = ["plugin/taglist.vim", "doc/taglist.txt"]
|
32
|
+
|
33
|
+
db = VimGet::PathDB.new(@basedir)
|
34
|
+
|
35
|
+
db.add(s)
|
36
|
+
|
37
|
+
expected_filepath = File.join(@basedir, "db", "test.manifest")
|
38
|
+
assert(File.exist?(expected_filepath), "Failed to create script manifest.")
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_update
|
43
|
+
s = VimGet::Script.new("123", "test")
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Test Case for Installer class
|
4
|
+
#
|
5
|
+
# $Id: tc_installer.rb 5 2008-04-11 18:33:39Z eddyxu $
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'vimget/installer'
|
9
|
+
|
10
|
+
class TestInstaller < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_fetch
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_install
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/test/tc_script.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# test case for script.rb
|
4
|
+
#
|
5
|
+
# author: Eddy Xu <eddyxu@gmail.com>
|
6
|
+
#
|
7
|
+
# $Id: tc_script.rb 3 2008-04-02 20:47:49Z eddyxu $
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require 'vimget/script'
|
11
|
+
|
12
|
+
class TestScript < Test::Unit::TestCase
|
13
|
+
def setup
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_outdated
|
22
|
+
s = VimGet::Script.new(32, "test", "eddyxu", "2.3", "3.2")
|
23
|
+
assert_equal(false, s.outdated?)
|
24
|
+
|
25
|
+
s.version = "4.3"
|
26
|
+
assert_equal(true, s.outdated?)
|
27
|
+
|
28
|
+
s.installed = "2.3"
|
29
|
+
assert_equal(true, s.outdated?)
|
30
|
+
|
31
|
+
s.installed = "4.3"
|
32
|
+
assert_equal(false, s.outdated?)
|
33
|
+
|
34
|
+
s.version = "4.32"
|
35
|
+
assert_equal(true, s.outdated?)
|
36
|
+
|
37
|
+
s.version = "2.33"
|
38
|
+
assert_equal(false, s.outdated?)
|
39
|
+
|
40
|
+
s.installed = "2.3"
|
41
|
+
s.version = "2.3a"
|
42
|
+
assert_equal(true, s.outdated?)
|
43
|
+
|
44
|
+
s.installed = "2.3b"
|
45
|
+
s.version = "2.3c"
|
46
|
+
assert_equal(true, s.outdated?)
|
47
|
+
|
48
|
+
s.version = "2.4"
|
49
|
+
assert_equal(true, s.outdated?)
|
50
|
+
|
51
|
+
s.version = "2.4c"
|
52
|
+
assert_equal(true, s.outdated?)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_parse
|
56
|
+
end
|
57
|
+
end
|
data/test/ts_vimget.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vimget
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eddy Xu
|
8
|
+
autorequire: vimget
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-04-12 00:00:00 +08:00
|
13
|
+
default_executable:
|
14
|
+
- vim-get
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: hpricot
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.6.0
|
24
|
+
version:
|
25
|
+
description: vim-get is a automatatical manager tools which used to auto update vim scripts
|
26
|
+
email: eddyxu@gmail.com
|
27
|
+
executables:
|
28
|
+
- vim-get
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- bin/vim-get
|
35
|
+
- test/tc_db.rb
|
36
|
+
- test/tc_installer.rb
|
37
|
+
- test/tc_script.rb
|
38
|
+
- test/ts_vimget.rb
|
39
|
+
- lib/vimget
|
40
|
+
- lib/vimget/command.rb
|
41
|
+
- lib/vimget/command_manager.rb
|
42
|
+
- lib/vimget/commands
|
43
|
+
- lib/vimget/commands/clean_command.rb
|
44
|
+
- lib/vimget/commands/install_command.rb
|
45
|
+
- lib/vimget/commands/installed_command.rb
|
46
|
+
- lib/vimget/commands/list_command.rb
|
47
|
+
- lib/vimget/commands/outdated_command.rb
|
48
|
+
- lib/vimget/commands/sync_command.rb
|
49
|
+
- lib/vimget/commands/uninstall_command.rb
|
50
|
+
- lib/vimget/commands/upgrade_command.rb
|
51
|
+
- lib/vimget/configure.rb
|
52
|
+
- lib/vimget/db.rb
|
53
|
+
- lib/vimget/exceptions.rb
|
54
|
+
- lib/vimget/installer.rb
|
55
|
+
- lib/vimget/script.rb
|
56
|
+
- lib/vimget/webparser.rb
|
57
|
+
- lib/vimget.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://www.xulei.org/projects/vimget
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.1.1
|
81
|
+
signing_key:
|
82
|
+
specification_version: 2
|
83
|
+
summary: An vim script tool
|
84
|
+
test_files:
|
85
|
+
- test/ts_vimget.rb
|