gem-open 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/lib/rubygems/commands/open.rb +6 -2
- data/test/gem_open_test.rb +32 -1
- metadata +6 -13
data/Rakefile
CHANGED
@@ -10,8 +10,8 @@ end
|
|
10
10
|
|
11
11
|
Jeweler::Tasks.new do |gem|
|
12
12
|
gem.name = "gem-open"
|
13
|
-
gem.version = "0.1.
|
14
|
-
gem.summary = "Open gems
|
13
|
+
gem.version = "0.1.2"
|
14
|
+
gem.summary = "Open gems on your favorite editor by running a specific gem command like `gem open nokogiri`."
|
15
15
|
gem.email = "fnando.vieira@gmail.com"
|
16
16
|
gem.homepage = "http://github.com/fnando/open-gem"
|
17
17
|
gem.authors = ["Nando Vieira"]
|
@@ -56,11 +56,15 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def open(spec)
|
59
|
-
|
60
|
-
|
59
|
+
editor = ENV["GEM_EDITOR"] || ENV["EDITOR"]
|
60
|
+
|
61
|
+
if editor
|
62
|
+
system "#{editor} #{spec.full_gem_path}"
|
61
63
|
else
|
62
64
|
say "You must set your editor in your .bash_profile or equivalent:"
|
63
65
|
say " export GEM_EDITOR='mate'"
|
66
|
+
say "or"
|
67
|
+
say " export EDITOR='mate'"
|
64
68
|
return terminate_interaction
|
65
69
|
end
|
66
70
|
end
|
data/test/gem_open_test.rb
CHANGED
@@ -3,7 +3,7 @@ gem "test-unit"
|
|
3
3
|
require "test/unit"
|
4
4
|
require "mocha"
|
5
5
|
require "rubygems_plugin"
|
6
|
-
require "FileUtils"
|
6
|
+
require "FileUtils" unless defined?(FileUtils)
|
7
7
|
|
8
8
|
class GemOpenTest < Test::Unit::TestCase
|
9
9
|
def setup
|
@@ -31,6 +31,34 @@ class GemOpenTest < Test::Unit::TestCase
|
|
31
31
|
@plugin.execute
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_open_gem_using_gem_editor_variable
|
35
|
+
ENV["GEM_EDITOR"] = "mate"
|
36
|
+
ENV["EDITOR"] = "vim"
|
37
|
+
|
38
|
+
gemname = "activesupport"
|
39
|
+
|
40
|
+
Gem::SourceIndex.expects(:installed_spec_directories).returns([File.dirname(__FILE__) + "/resources"])
|
41
|
+
|
42
|
+
@plugin.expects(:options).returns(:args => [gemname])
|
43
|
+
@plugin.expects(:system).with("mate #{@gemdir}/activesupport-3.0.0.beta3")
|
44
|
+
|
45
|
+
@plugin.execute
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_open_gem_using_editor_variable
|
49
|
+
ENV["GEM_EDITOR"] = nil
|
50
|
+
ENV["EDITOR"] = "vim"
|
51
|
+
|
52
|
+
gemname = "activesupport"
|
53
|
+
|
54
|
+
Gem::SourceIndex.expects(:installed_spec_directories).returns([File.dirname(__FILE__) + "/resources"])
|
55
|
+
|
56
|
+
@plugin.expects(:options).returns(:args => [gemname])
|
57
|
+
@plugin.expects(:system).with("vim #{@gemdir}/activesupport-3.0.0.beta3")
|
58
|
+
|
59
|
+
@plugin.execute
|
60
|
+
end
|
61
|
+
|
34
62
|
def test_gem_without_version
|
35
63
|
gemname = "activesupport"
|
36
64
|
|
@@ -77,6 +105,7 @@ class GemOpenTest < Test::Unit::TestCase
|
|
77
105
|
|
78
106
|
def test_unset_editor
|
79
107
|
ENV["GEM_EDITOR"] = nil
|
108
|
+
ENV["EDITOR"] = nil
|
80
109
|
gemname = "activesupport"
|
81
110
|
|
82
111
|
Gem::SourceIndex.expects(:installed_spec_directories).returns([File.dirname(__FILE__) + "/resources"])
|
@@ -84,6 +113,8 @@ class GemOpenTest < Test::Unit::TestCase
|
|
84
113
|
@plugin.expects(:options).returns(:args => [gemname])
|
85
114
|
@plugin.expects(:say).with("You must set your editor in your .bash_profile or equivalent:")
|
86
115
|
@plugin.expects(:say).with(" export GEM_EDITOR='mate'")
|
116
|
+
@plugin.expects(:say).with("or")
|
117
|
+
@plugin.expects(:say).with(" export EDITOR='mate'")
|
87
118
|
@plugin.expects(:terminate_interaction)
|
88
119
|
|
89
120
|
@plugin.execute
|
metadata
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-open
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
version: 0.1.1
|
4
|
+
version: 0.1.2
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- Nando Vieira
|
@@ -14,7 +9,7 @@ autorequire:
|
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
11
|
|
17
|
-
date: 2010-
|
12
|
+
date: 2010-08-10 00:00:00 -03:00
|
18
13
|
default_executable:
|
19
14
|
dependencies: []
|
20
15
|
|
@@ -44,22 +39,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
39
|
requirements:
|
45
40
|
- - ">="
|
46
41
|
- !ruby/object:Gem::Version
|
47
|
-
segments:
|
48
|
-
- 0
|
49
42
|
version: "0"
|
43
|
+
version:
|
50
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
45
|
requirements:
|
52
46
|
- - ">="
|
53
47
|
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 0
|
56
48
|
version: "0"
|
49
|
+
version:
|
57
50
|
requirements: []
|
58
51
|
|
59
52
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.3.
|
53
|
+
rubygems_version: 1.3.5
|
61
54
|
signing_key:
|
62
55
|
specification_version: 3
|
63
|
-
summary: Open gems
|
56
|
+
summary: Open gems on your favorite editor by running a specific gem command like `gem open nokogiri`.
|
64
57
|
test_files:
|
65
58
|
- test/gem_open_test.rb
|