open_gem 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +6 -1
- data/Rakefile +2 -1
- data/VERSION.yml +1 -1
- data/lib/rubygems/commands/open_command.rb +2 -2
- data/lib/rubygems/commands/read_command.rb +11 -15
- metadata +35 -10
data/CHANGELOG.markdown
CHANGED
data/Rakefile
CHANGED
@@ -19,6 +19,7 @@ begin
|
|
19
19
|
|
20
20
|
# Testing
|
21
21
|
s.test_files = FileList["test/**/*_test.rb"]
|
22
|
+
s.add_dependency 'launchy', '~> 0.3.5'
|
22
23
|
s.add_development_dependency 'mocha', '~> 0.9.5'
|
23
24
|
end
|
24
25
|
|
@@ -32,4 +33,4 @@ Rake::TestTask.new do |t|
|
|
32
33
|
t.verbose = false
|
33
34
|
end
|
34
35
|
|
35
|
-
task :default => :test
|
36
|
+
task :default => :test
|
data/VERSION.yml
CHANGED
@@ -33,9 +33,9 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def open_gem(path)
|
36
|
-
editor = options[:command] || ENV['GEM_OPEN_EDITOR'] || ENV['EDITOR']
|
36
|
+
editor = options[:command] || ENV['GEM_OPEN_EDITOR'] || ENV['VISUAL'] || ENV['EDITOR']
|
37
37
|
if !editor
|
38
|
-
say "Either set $EDITOR, or use -c <command_name>"
|
38
|
+
say "Either set $GEM_OPEN_EDITOR, $VISUAL, $EDITOR, or use -c <command_name>"
|
39
39
|
else
|
40
40
|
command_parts = Shellwords.shellwords(editor)
|
41
41
|
command_parts << path
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'launchy'
|
1
2
|
# ReadCommand will open a gem's rdoc
|
2
3
|
class Gem::Commands::ReadCommand < Gem::Command
|
3
4
|
include OpenGem::CommonOptions
|
@@ -40,22 +41,17 @@ class Gem::Commands::ReadCommand < Gem::Command
|
|
40
41
|
Gem::DocManager.new(spec).generate_rdoc
|
41
42
|
end
|
42
43
|
|
43
|
-
def rdoc_reader
|
44
|
-
options[:command] || case RUBY_PLATFORM.downcase
|
45
|
-
when /darwin/ then 'open'
|
46
|
-
when /mswin/ then 'explorer'
|
47
|
-
when /linux/ then 'firefox'
|
48
|
-
else 'firefox' # Come on, if you write ruby, you probably have firefox installed ;)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
44
|
def read_gem(path)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
45
|
+
if options[:command]
|
46
|
+
command_parts = Shellwords.shellwords(options[:command])
|
47
|
+
command_parts << path
|
48
|
+
success = system(*command_parts)
|
49
|
+
if !success
|
50
|
+
raise Gem::CommandLineError, "Could not run '#{rdoc_reader} #{path}', exit code: #{$?.exitstatus}"
|
51
|
+
end
|
52
|
+
else
|
53
|
+
Launchy::Browser.run("file://"+path)
|
58
54
|
end
|
59
55
|
end
|
60
56
|
|
61
|
-
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 4
|
8
|
+
- 2
|
9
|
+
version: 1.4.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Adam Sanderson
|
@@ -9,19 +14,37 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-04-23 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: launchy
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 3
|
30
|
+
- 5
|
31
|
+
version: 0.3.5
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
15
34
|
- !ruby/object:Gem::Dependency
|
16
35
|
name: mocha
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
20
38
|
requirements:
|
21
39
|
- - ~>
|
22
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 9
|
44
|
+
- 5
|
23
45
|
version: 0.9.5
|
24
|
-
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
25
48
|
description: " Open a gem's source directory with either the default editor, or a specified command.\n"
|
26
49
|
email: netghost@gmail.com
|
27
50
|
executables: []
|
@@ -40,7 +63,7 @@ files:
|
|
40
63
|
- lib/rubygems/commands/read_command.rb
|
41
64
|
- lib/rubygems_plugin.rb
|
42
65
|
- test/open_command_test.rb
|
43
|
-
has_rdoc:
|
66
|
+
has_rdoc: false
|
44
67
|
homepage: http://github.com/adamsanderson/open_gem
|
45
68
|
licenses: []
|
46
69
|
|
@@ -53,18 +76,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
76
|
requirements:
|
54
77
|
- - ">="
|
55
78
|
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 0
|
56
81
|
version: "0"
|
57
|
-
version:
|
58
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
83
|
requirements:
|
60
84
|
- - ">="
|
61
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
62
88
|
version: "0"
|
63
|
-
version:
|
64
89
|
requirements: []
|
65
90
|
|
66
91
|
rubyforge_project: opengem
|
67
|
-
rubygems_version: 1.3.
|
92
|
+
rubygems_version: 1.3.6
|
68
93
|
signing_key:
|
69
94
|
specification_version: 3
|
70
95
|
summary: Gem Command to easily open a ruby gem with the editor of your choice.
|