vimmy 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vimmy (0.2.0)
5
- mechanize (~> 1.0.0)
4
+ vimmy (0.3.0)
5
+ rest-client (~> 1.6.7)
6
6
  thor (~> 0.14.6)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- mechanize (1.0.0)
12
- nokogiri (>= 1.2.1)
13
- nokogiri (1.4.4)
11
+ mime-types (1.17.2)
12
+ rest-client (1.6.7)
13
+ mime-types (>= 1.16)
14
14
  thor (0.14.6)
15
15
 
16
16
  PLATFORMS
17
17
  ruby
18
18
 
19
19
  DEPENDENCIES
20
- mechanize (~> 1.0.0)
21
- thor (~> 0.14.6)
22
20
  vimmy!
@@ -1,5 +1,6 @@
1
1
  require "fileutils"
2
- require "mechanize"
2
+ require "json"
3
+ require "rest_client"
3
4
  require "thor"
4
5
  require "vimmy"
5
6
 
@@ -57,13 +58,13 @@ private ######################################################################
57
58
 
58
59
  if (index = STDIN.gets.to_i) > 0
59
60
  return unless plugin = sort(plugins)[index-1]
60
- install_plugin plugin.first
61
+ install_plugin plugin["url"]
61
62
  end
62
63
  end
63
64
 
64
65
  def display(plugins)
65
- sort(plugins).each_with_index do |(url, plugin), index|
66
- puts "%d) %-28s %s" % [index+1, plugin[:name][0,28], plugin[:description][0,50]]
66
+ sort(plugins).each_with_index do |plugin, index|
67
+ puts "%d) %-28s %s" % [index+1, plugin["name"][0,28], plugin["description"][0,50]]
67
68
  end
68
69
  end
69
70
 
@@ -84,8 +85,8 @@ private ######################################################################
84
85
  end
85
86
 
86
87
  def matching(term)
87
- plugins.select do |url, plugin|
88
- [plugin[:name], plugin[:description]].join(" ") =~ /#{term}/i
88
+ plugins.select do |plugin|
89
+ [plugin["name"], plugin["description"]].join(" ") =~ /#{term}/i
89
90
  end
90
91
  end
91
92
 
@@ -94,18 +95,17 @@ private ######################################################################
94
95
  end
95
96
 
96
97
  def plugins
97
- page = Mechanize.new.get('http://vim-scripts.org/vim/scripts.html')
98
- page.search('//tr').inject({}) do |hash, row|
99
- link = row.search('td/a').first
100
- hash.update(link.attributes['href'] => {
101
- :name => link.text,
102
- :description => row.search('td')[3].text
103
- })
98
+ JSON.parse(vimscripts["scripts_recent.json"].get).map do |plugin|
99
+ {
100
+ "name" => plugin["n"],
101
+ "description" => plugin["s"],
102
+ "url" => "https://github.com/vim-scripts/#{plugin["n"]}"
103
+ }
104
104
  end
105
105
  end
106
106
 
107
107
  def sort(plugins)
108
- plugins.sort_by { |p| p.last[:name] }
108
+ plugins.sort_by { |p| p["name"] }
109
109
  end
110
110
 
111
111
  def template(file)
@@ -114,4 +114,8 @@ private ######################################################################
114
114
  FileUtils.cp(source, target)
115
115
  end
116
116
 
117
+ def vimscripts
118
+ @vimscripts ||= RestClient::Resource.new("http://vim-scripts.org/api")
119
+ end
120
+
117
121
  end
@@ -1,3 +1,3 @@
1
1
  module Vimmy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency "mechanize", "~> 1.0.0"
23
- s.add_dependency "thor", "~> 0.14.6"
22
+ s.add_dependency "rest-client", "~> 1.6.7"
23
+ s.add_dependency "thor", "~> 0.14.6"
24
24
  end
metadata CHANGED
@@ -1,64 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vimmy
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - David Dollar
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-12-04 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: mechanize
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-01-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rest-client
16
+ requirement: &70100753435860 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 23
30
- segments:
31
- - 1
32
- - 0
33
- - 0
34
- version: 1.0.0
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.7
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: thor
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70100753435860
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70100753523940 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
29
+ requirements:
43
30
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 43
46
- segments:
47
- - 0
48
- - 14
49
- - 6
31
+ - !ruby/object:Gem::Version
50
32
  version: 0.14.6
51
33
  type: :runtime
52
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *70100753523940
53
36
  description: Manage vim plugins using pathogen
54
37
  email: ddollar@gmail.com
55
- executables:
38
+ executables:
56
39
  - vimmy
57
40
  extensions: []
58
-
59
41
  extra_rdoc_files: []
60
-
61
- files:
42
+ files:
62
43
  - .gitignore
63
44
  - Gemfile
64
45
  - Gemfile.lock
@@ -71,39 +52,28 @@ files:
71
52
  - lib/vimmy/cli.rb
72
53
  - lib/vimmy/version.rb
73
54
  - vimmy.gemspec
74
- has_rdoc: true
75
55
  homepage: http://github.com/ddollar/vimmy
76
56
  licenses: []
77
-
78
57
  post_install_message:
79
58
  rdoc_options: []
80
-
81
- require_paths:
59
+ require_paths:
82
60
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
61
+ required_ruby_version: !ruby/object:Gem::Requirement
84
62
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
92
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
68
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
- version: "0"
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
101
73
  requirements: []
102
-
103
74
  rubyforge_project: vimmy
104
- rubygems_version: 1.3.7
75
+ rubygems_version: 1.8.15
105
76
  signing_key:
106
77
  specification_version: 3
107
78
  summary: Manage vim plugins using pathogen
108
79
  test_files: []
109
-