From 50442baf997639b13a707a9f450c0388fc56136a Mon Sep 17 00:00:00 2001 From: Eric Gjertsen Date: Mon, 18 Mar 2013 11:01:35 -0400 Subject: [PATCH 1/2] remove __FILE__=$0 condition to work with rubygems bin wrapper --- bin/dep | 58 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/bin/dep b/bin/dep index 9be029d..28063e4 100755 --- a/bin/dep +++ b/bin/dep @@ -146,43 +146,41 @@ private end end -if __FILE__ == $0 - Dep::CLI.file = File.join(Dir.pwd, ".gems") - Dep::CLI.prerelease = false +Dep::CLI.file = File.join(Dir.pwd, ".gems") +Dep::CLI.prerelease = false - on("-f") do |file| - Dep::CLI.file = file - end - - on("--pre") do - Dep::CLI.prerelease = true - end +on("-f") do |file| + Dep::CLI.file = file +end - on("--help") do - IO.popen("less", "w") { |f| f.write(DATA.read) } - exit - end +on("--pre") do + Dep::CLI.prerelease = true +end - Dep::CLI.list = Dep::List.new(Dep::CLI.file) - - FileUtils.touch(Dep::CLI.list.path) unless File.exist?(Dep::CLI.list.path) - - case ARGV[0] - when "add" - Dep::CLI.add(ARGV[1]) - when "rm" - Dep::CLI.rm(ARGV[1]) - when "install", "i" - Dep::CLI.install - when nil - Dep::CLI.check - else - Dep::CLI.abort - end +on("--help") do + IO.popen("less", "w") { |f| f.write(DATA.read) } + exit +end +Dep::CLI.list = Dep::List.new(Dep::CLI.file) + +FileUtils.touch(Dep::CLI.list.path) unless File.exist?(Dep::CLI.list.path) + +case ARGV[0] +when "add" + Dep::CLI.add(ARGV[1]) +when "rm" + Dep::CLI.rm(ARGV[1]) +when "install", "i" + Dep::CLI.install +when nil + Dep::CLI.check +else + Dep::CLI.abort end + __END__ DEP(1) From 1fc3ff97a669c033e5f6332f748304f2a50b61c1 Mon Sep 17 00:00:00 2001 From: Eric Gjertsen Date: Mon, 18 Mar 2013 11:04:23 -0400 Subject: [PATCH 2/2] allow 'dep check' as synonym for 'dep' and update man docs --- bin/dep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/dep b/bin/dep index 28063e4..dcf81c0 100755 --- a/bin/dep +++ b/bin/dep @@ -174,7 +174,7 @@ when "rm" Dep::CLI.rm(ARGV[1]) when "install", "i" Dep::CLI.install -when nil +when nil, "check" Dep::CLI.check else Dep::CLI.abort @@ -189,13 +189,13 @@ NAME dep -- Basic dependency tracking SYNOPSIS - dep + dep [check] dep add libname [--pre] dep rm libname dep install DESCRIPTION - dep + dep [check] Checks that all dependencies are met. dep add [gemname]