vimgem 0.1.0 → 0.1.1

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/vimgem CHANGED
@@ -2,6 +2,4 @@
2
2
  require 'rubygems'
3
3
  require 'vimgem'
4
4
 
5
- exit unless ARGV[0]
6
-
7
- Vimgem::browse(ARGV[0])
5
+ Vimgem.browse(ARGV[0])
@@ -1,3 +1,3 @@
1
1
  module Vimgem
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/vimgem.rb CHANGED
@@ -1,8 +1,23 @@
1
+ require 'rbconfig'
2
+
1
3
  module Vimgem
2
- def self.browse(gem_name)
4
+ extend self
5
+
6
+ def browse(gem)
7
+ return unless gem
8
+ spec = get_gemspec(gem)
9
+ exec_vim spec.full_gem_path
10
+ end
11
+
12
+ def get_gemspec(gem)
3
13
  matches = Gem.source_index.find_name(gem_name)
4
- exit if matches.empty?
5
- spec = matches.first
6
- `gvim #{spec.full_gem_path}`
14
+ matches.first
15
+ end
16
+
17
+ def exec_vim(path)
18
+ case Config::CONFIG['target_os'].to_sym
19
+ when :linux
20
+ `gvim #{spec.full_gem_path}`
21
+ end
7
22
  end
8
23
  end
data/vimgem-0.1.0.gem ADDED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimgem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lim Chanmann
@@ -36,6 +36,7 @@ files:
36
36
  - bin/vimgem
37
37
  - lib/vimgem.rb
38
38
  - lib/vimgem/version.rb
39
+ - vimgem-0.1.0.gem
39
40
  - vimgem.gemspec
40
41
  has_rdoc: true
41
42
  homepage: http://rubygems.org/gems/vimgem