kballard-openri 0.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/LICENSE +18 -0
- data/README +19 -0
- data/bin/openri +17 -0
- data/lib/openri.rb +24 -0
- data/openri.gemspec +21 -0
- metadata +63 -0
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2008 Kevin Ballard
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= openri
|
2
|
+
by Kevin Ballard <kevin@sb.org>
|
3
|
+
|
4
|
+
== DESCRIPTION
|
5
|
+
|
6
|
+
openri is a script that opens the documentation
|
7
|
+
for the given gem in your browser.
|
8
|
+
|
9
|
+
The gem can be specified either by gem name or by require name.
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
$ openri gemname
|
14
|
+
|
15
|
+
=== Examples
|
16
|
+
|
17
|
+
$ openri activerecord
|
18
|
+
|
19
|
+
Opens the documentation for ActiveRecord
|
data/bin/openri
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + "/../lib/openri"
|
4
|
+
|
5
|
+
def usage
|
6
|
+
puts <<-EOF
|
7
|
+
usage: openri gem
|
8
|
+
|
9
|
+
Opens the generated rdoc HTML for the specified gem.
|
10
|
+
EOF
|
11
|
+
end
|
12
|
+
|
13
|
+
if ARGV.empty? or ARGV[0] == '-h' or ARGV[0] == '--help'
|
14
|
+
usage
|
15
|
+
else
|
16
|
+
OpenRi.open ARGV[0]
|
17
|
+
end
|
data/lib/openri.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
module OpenRi
|
4
|
+
# Opens the documentation for the specified gem
|
5
|
+
def self.open(name)
|
6
|
+
gems = Gem.source_index.find_name(name)
|
7
|
+
if gems.empty?
|
8
|
+
# try and find based on require name
|
9
|
+
gem = Gem.searcher.find(name)
|
10
|
+
if gem.nil?
|
11
|
+
raise "No gems matched '#{name}'"
|
12
|
+
end
|
13
|
+
else
|
14
|
+
gem = gems[0]
|
15
|
+
end
|
16
|
+
open_url("file://#{gem.installation_path}/doc/#{gem.full_name}/rdoc/index.html")
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.open_url(url)
|
20
|
+
# this works on OS X
|
21
|
+
# I don't know what's necessary for other platforms
|
22
|
+
exec "open", url
|
23
|
+
end
|
24
|
+
end
|
data/openri.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "openri"
|
3
|
+
s.version = "0.1"
|
4
|
+
|
5
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version
|
8
|
+
s.authors = ["Kevin Ballard"]
|
9
|
+
s.date = "2008-05-14"
|
10
|
+
s.default_executable = "openri"
|
11
|
+
s.description = "Quickly open documentation for your Gems in your browser"
|
12
|
+
s.email = "kevin@sb.org"
|
13
|
+
s.executables = ["openri"]
|
14
|
+
s.extra_rdoc_files = ["LICENSE", "README", "bin/openri"]
|
15
|
+
s.files = ["bin/openri", "lib/openri.rb", "LICENSE", "README", "openri.gemspec"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = "http://github.com/kballard/openri"
|
18
|
+
s.rubygems_version = "1.1.1"
|
19
|
+
s.summary = s.description
|
20
|
+
s.rdoc_options = ["--inline-source", "--title", "openri", "--main", "README"]
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kballard-openri
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Ballard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-14 00:00:00 -07:00
|
13
|
+
default_executable: openri
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Quickly open documentation for your Gems in your browser
|
17
|
+
email: kevin@sb.org
|
18
|
+
executables:
|
19
|
+
- openri
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README
|
25
|
+
- bin/openri
|
26
|
+
files:
|
27
|
+
- bin/openri
|
28
|
+
- lib/openri.rb
|
29
|
+
- LICENSE
|
30
|
+
- README
|
31
|
+
- openri.gemspec
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://github.com/kballard/openri
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options:
|
36
|
+
- --inline-source
|
37
|
+
- --title
|
38
|
+
- openri
|
39
|
+
- --main
|
40
|
+
- README
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
version:
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
requirements: []
|
56
|
+
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 1.0.1
|
59
|
+
signing_key:
|
60
|
+
specification_version: 2
|
61
|
+
summary: Quickly open documentation for your Gems in your browser
|
62
|
+
test_files: []
|
63
|
+
|