gem-open 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  Jeweler::Tasks.new do |gem|
12
12
  gem.name = "gem-open"
13
- gem.version = "0.1.0"
13
+ gem.version = "0.1.1"
14
14
  gem.summary = "Open gems into your favorite editor by running a specific gem command."
15
15
  gem.email = "fnando.vieira@gmail.com"
16
16
  gem.homepage = "http://github.com/fnando/open-gem"
@@ -34,16 +34,16 @@ class Gem::Commands::OpenCommand < Gem::Command
34
34
  end
35
35
 
36
36
  def search(gemname)
37
- regex = /^(.*?)(?:-(.*?))?$/
37
+ regex = /^(.*?)-*([\d.]+[\w\d]*)?$/
38
38
  _, required_name, required_version = *gemname.match(regex)
39
39
 
40
40
  gemspecs = Dir["{#{Gem::SourceIndex.installed_spec_directories.join(",")}}/*.gemspec"].select do |gemspec|
41
41
  basename = File.basename(gemspec).gsub(/\.gemspec$/, "")
42
- _, name, version = *basename.match(regex)
43
42
 
44
43
  if required_version
45
44
  basename == gemname
46
45
  else
46
+ _, name, version = *basename.match(regex)
47
47
  name == gemname
48
48
  end
49
49
  end
@@ -7,7 +7,7 @@ require "FileUtils"
7
7
 
8
8
  class GemOpenTest < Test::Unit::TestCase
9
9
  def setup
10
- ENV["GEM_EDIT"] = "mate"
10
+ ENV["GEM_EDITOR"] = "mate"
11
11
  @plugin = Gem::Commands::OpenCommand.new
12
12
  @gemdir = File.expand_path(File.dirname(__FILE__) + "/gems")
13
13
  end
@@ -53,6 +53,28 @@ class GemOpenTest < Test::Unit::TestCase
53
53
  @plugin.execute
54
54
  end
55
55
 
56
+ def test_gem_with_compound_name
57
+ gemname = "sinatra-sugar"
58
+
59
+ Gem::SourceIndex.expects(:installed_spec_directories).returns([File.dirname(__FILE__) + "/resources"])
60
+
61
+ @plugin.expects(:options).returns(:args => [gemname])
62
+ @plugin.expects(:system).with("mate #{@gemdir}/sinatra-sugar-0.4.1")
63
+
64
+ @plugin.execute
65
+ end
66
+
67
+ def test_gem_with_compound_name_and_version
68
+ gemname = "sinatra-sugar-0.4.1"
69
+
70
+ Gem::SourceIndex.expects(:installed_spec_directories).returns([File.dirname(__FILE__) + "/resources"])
71
+
72
+ @plugin.expects(:options).returns(:args => [gemname])
73
+ @plugin.expects(:system).with("mate #{@gemdir}/sinatra-sugar-0.4.1")
74
+
75
+ @plugin.execute
76
+ end
77
+
56
78
  def test_unset_editor
57
79
  ENV["GEM_EDITOR"] = nil
58
80
  gemname = "activesupport"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-17 00:00:00 -03:00
17
+ date: 2010-05-23 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20