Skip to content

Commit

Permalink
move rip-package-* handlers to rip-package-handle-*
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Aug 12, 2010
1 parent ebfa32c commit 5227237
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion bin/rip-package
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ args = (ARGV * ' ').split(' ')

debug "packaging #{args * ' '}"

commands.grep(/^package-/).each do |handler|
commands.grep(/^package-handle-/).each do |handler|
out = rip(handler.chomp, args)

if $?.exitstatus == 3
Expand Down
2 changes: 1 addition & 1 deletion bin/rip-package-gem → bin/rip-package-handle-gem
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# Usage: rip-package-gem NAME VERSION
# Usage: rip-package-handle-gem NAME VERSION

require 'rip/script'

Expand Down
2 changes: 1 addition & 1 deletion bin/rip-package-git → bin/rip-package-handle-git
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# Usage: rip-package-git URL VERSION
# Usage: rip-package-handle-git URL VERSION

require 'rip/script'

Expand Down
2 changes: 1 addition & 1 deletion bin/rip-package-ripfile → bin/rip-package-handle-ripfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# Usage: rip-package-ripfile FILE
# Usage: rip-package-handle-ripfile FILE

$-e = true

Expand Down
2 changes: 1 addition & 1 deletion bin/rip-package-sub → bin/rip-package-handle-sub
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# Usage: rip-package-sub NAME PATH VERSION
# Usage: rip-package-handle-sub NAME PATH VERSION

require 'rip/script'

Expand Down
16 changes: 8 additions & 8 deletions man/rip-package-git.1.ronn → man/rip-package-handle-git.1.ronn
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
rip-package-git(1) -- rip git package handler
=============================================
rip-package-handle-git(1) -- rip git package handler
====================================================

## SYNOPSIS

rip-package-git <url> [<version>]
rip-package-handle-git <url> [<version>]

## DESCRIPTION

`rip-package-git` is a handler for fetching and unpacking git
`rip-package-handle-git` is a handler for fetching and unpacking git
repositories. Prints package path on success. Exits with non-zero on
failure.

Expand All @@ -19,8 +19,8 @@ failure.

## EXAMPLES

You should not use `rip-package-git` directly. Use `rip-package` which
delegates to `rip-package-git`.
You should not use `rip-package-handle-git` directly. Use `rip-package` which
delegates to `rip-package-handle-git`.

Fetch a commit SHA (full and partial) or tags

Expand All @@ -38,15 +38,15 @@ If no branch or ref is given, "master" is fetched

## PERFORMANCE

`rip-package-git` uses some nifty caching techniques to fetch your
`rip-package-handle-git` uses some nifty caching techniques to fetch your
package quickly. For best results avoid floating versions like
branches and stick to fixed references like tags or full
SHAs. Floating versions will always perform slow network checks. For a
more nerdy overview of how this works see the internals section.

## INTERNALS

A very simple and naive version of `rip-package-git` would reclone the
A very simple and naive version of `rip-package-handle-git` would reclone the
entire repository every time.

To avoid full repository clones, a bare repository is keep in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
rip-package-ripfile(1) -- create packages from a ripfile
========================================================
rip-package-handle-ripfile(1) -- create packages from a ripfile
===============================================================

## SYNOPSIS

`rip-package-ripfile` deps.rip
`rip-package-ripfile` package
`rip-package-handle-ripfile` deps.rip
`rip-package-handle-ripfile` package

## DESCRIPTION

`rip-package-ripfile` downloads all dependencies for the passed
`rip-package-handle-ripfile` downloads all dependencies for the passed
package or packages (if it's a ripfile).

Each dependency's dependencies are downloaded, and so forth. An
Expand Down
8 changes: 4 additions & 4 deletions man/rip-package.5.ronn → man/rip-package-handle.5.ronn
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
rip-package(5) -- rip package handler convention
================================================
rip-package-handle(5) -- rip package handler convention
=======================================================

Package handlers must implement "rip-package-$type" that accepts
Package handlers must implement "rip-package-handle-$type" that accepts
"source", "path", "version" arguments.

Handlers are discovered by grepping the load path for
"rip-package-\w+".
"rip-package-handle-\w+".

Handlers are always tested in alphabetical order. If a handler can't
handle a source, it must quickly exit with an error code of "3" so the
Expand Down
8 changes: 4 additions & 4 deletions man/rip.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ Low level commands for fetching and building packages.

rip-package(1)

rip-package-gem(1)
rip-package-handle-gem(1)

rip-package-git(1)
rip-package-handle-git(1)

rip-package-ripfile(1)
rip-package-handle-ripfile(1)

rip-package-sub(1)
rip-package-handle-sub(1)

rip-parse(1)

Expand Down
10 changes: 5 additions & 5 deletions test/build_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BuildTest < Rip::Test
end

test "build returns original path if the package has no extensions" do
out = rip "package-git git://localhost/cijoe"
out = rip "package-handle-git git://localhost/cijoe"
assert_exited_successfully out
path = out.chomp

Expand All @@ -21,7 +21,7 @@ class BuildTest < Rip::Test
end

test "build extconf" do
out = rip "package-git git://localhost/yajl-ruby"
out = rip "package-handle-git git://localhost/yajl-ruby"
assert_exited_successfully out
path = out.chomp

Expand All @@ -37,7 +37,7 @@ class BuildTest < Rip::Test
end

test "rebuild extconf package" do
out = rip "package-git git://localhost/yajl-ruby"
out = rip "package-handle-git git://localhost/yajl-ruby"
assert_exited_successfully out
path = out.chomp

Expand All @@ -49,7 +49,7 @@ class BuildTest < Rip::Test
end

test "writes .ripparent symlink" do
out = rip "package-git git://localhost/yajl-ruby"
out = rip "package-handle-git git://localhost/yajl-ruby"
assert_exited_successfully out

path = out.chomp
Expand All @@ -60,7 +60,7 @@ class BuildTest < Rip::Test
end

test "writes build.rip" do
out = rip "package-git git://localhost/yajl-ruby"
out = rip "package-handle-git git://localhost/yajl-ruby"
assert_exited_successfully out

path = out.chomp
Expand Down
4 changes: 2 additions & 2 deletions test/info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class InfoTest < Rip::Test
test "info" do
path = rip "package-gem repl 0.1.0"
path = rip "package-handle-gem repl 0.1.0"
rip "import #{path}"
write(path.chomp + '/deps.rip') { "ambition ~> 0.5.4" }

Expand All @@ -20,7 +20,7 @@ class InfoTest < Rip::Test
end

test "info key" do
path = rip "package-gem repl 0.1.0"
path = rip "package-handle-gem repl 0.1.0"
rip "import #{path}"
write(path.chomp + '/deps.rip') { "ambition ~> 0.5.4" }

Expand Down
2 changes: 1 addition & 1 deletion test/metadata_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class MetaData < Rip::Test
test "metadata" do
package = rip "package-gem repl 0.1.0"
package = rip "package-handle-gem repl 0.1.0"
assert_equal "repl 0.1.0\n", rip("metadata #{package}")
end
end
20 changes: 10 additions & 10 deletions test/package_gem_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ def setup
end

test "can't handle unknown protocol" do
out = rip "package-gem git://localhost/cijoe"
out = rip "package-handle-gem git://localhost/cijoe"
assert_exited_with_error out
end

test "fetch gem with no version" do
out = rip "package-gem repl"
out = rip "package-handle-gem repl"
target = "#{@ripdir}/.packages/repl-21df4eaf07591b07688973bad525a215"

assert_equal target, out.chomp
Expand All @@ -21,7 +21,7 @@ def setup
end

test "fetch gem with version" do
out = rip "package-gem repl 0.1.0"
out = rip "package-handle-gem repl 0.1.0"
target = "#{@ripdir}/.packages/repl-21df4eaf07591b07688973bad525a215"

assert_equal target, out.chomp
Expand All @@ -30,22 +30,22 @@ def setup
end

test "fetch gem with unknown version" do
out = rip "package-gem repl 3.0.0"
out = rip "package-handle-gem repl 3.0.0"
assert_exited_with_error out

assert_equal "repl 3.0.0 not found", out.chomp
end

test "fetch same gem twice" do
out = rip "package-gem repl"
out = rip "package-handle-gem repl"
assert_exited_successfully out

out = rip "package-gem repl"
out = rip "package-handle-gem repl"
assert_exited_successfully out
end

test "writes package.rip" do
out = rip "package-gem repl '>=0.0.1'"
out = rip "package-handle-gem repl '>=0.0.1'"
target = "#{@ripdir}/.packages/repl-21df4eaf07591b07688973bad525a215"

assert_equal target, out.chomp
Expand All @@ -55,7 +55,7 @@ def setup
end

test "writes deps.rip if it needs to" do
out = rip "package-gem ambition"
out = rip "package-handle-gem ambition"
target = "#{@ripdir}/.packages/ambition-23537c5d0c31d3a0b0e3bcfa225a2dca"

assert_equal target, out.chomp
Expand All @@ -65,15 +65,15 @@ def setup
end

test "doesn't write deps.rip if it doesn't need to" do
out = rip "package-gem repl"
out = rip "package-handle-gem repl"
target = "#{@ripdir}/.packages/repl-21df4eaf07591b07688973bad525a215"

assert_equal target, out.chomp
assert !File.exist?("#{target}/deps.rip")
end

test "repackage" do
out = rip "package-gem repl"
out = rip "package-handle-gem repl"
target = "#{@ripdir}/.packages/repl-21df4eaf07591b07688973bad525a215"

assert_equal target, out.chomp
Expand Down
Loading

0 comments on commit 5227237

Please sign in to comment.