Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyball committed May 14, 2008
0 parents commit 09a6534
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2008 Kevin Ballard

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 changes: 19 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
= openri
by Kevin Ballard <kevin@sb.org>

== DESCRIPTION

openri is a script that opens the documentation
for the given gem in your browser.

The gem can be specified either by gem name or by require name.

== Usage

`openri gemname`

=== Examples

$ openri activerecord

Opens the documentation for ActiveRecord
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'rubygems'
require 'rubygems/installer'
require 'rake'
require 'rake/gempackagetask'

spec = eval(File.read("openri.gemspec"), binding, "openri.gemspec")

gemtask = Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
# pkg.need_zip = true
end

desc 'Install openri'
task :install_gem => :gem do
Gem::Installer.new("#{gemtask.package_dir}/#{gemtask.gem_file}").install
end
31 changes: 31 additions & 0 deletions bin/openri
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env ruby

require 'rubygems'

def usage
puts <<-EOF
usage: openri gem
Opens the generated rdoc HTML for the specified gem.
EOF
end

def openri(name)
gems = Gem.source_index.find_name(name)
if gems.empty?
# try and find based on require name
gem = Gem.searcher.find(name)
if gem.nil?
raise "No gems matched '#{name}'"
end
else
gem = gems[0]
end
exec 'open', "file://#{gem.installation_path}/doc/#{gem.full_name}/rdoc/index.html"
end

if ARGV.empty? or ARGV[0] == '-h' or ARGV[0] == '--help'
usage
else
openri ARGV[0]
end
19 changes: 19 additions & 0 deletions openri.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Gem::Specification.new do |s|
s.name = "openri"
s.version = "0.1"

s.specification_version = 2 if s.respond_to? :specification_version=

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version
s.authors = ["Kevin Ballard"]
s.date = "2008-05-14"
s.default_executable = "openri"
s.description = "Quickly open documentation for your Gems in your browser"
s.email = "kevin@sb.org"
s.executables = ["openri"]
s.files = ["bin/openri", "LICENSE", "README", "openri.gemspec"]
s.has_rdoc = false
s.homepage = "http://github.com/kballard/openri"
s.rubygems_version = "1.1.1"
s.summary = s.description
end

0 comments on commit 09a6534

Please sign in to comment.