Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 09a653443479c531ea7baae7e4d8e40abfd1a14f 0 parents
@kballard authored
1  .gitignore
@@ -0,0 +1 @@
+pkg
18 LICENSE
@@ -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 README
@@ -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 Rakefile
@@ -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 bin/openri
@@ -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 openri.gemspec
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.