提交 2e63151d 编写于 作者: C Chris Wanstrath

start rocking `hub install update`

上级 e4513bdd
...@@ -190,7 +190,20 @@ help ...@@ -190,7 +190,20 @@ help
def install(args) def install(args)
command, subcommand, target = args command, subcommand, target = args
if subcommand.to_s == 'check' if subcommand.to_s == 'update'
begin
if up_to_date?
puts "*".green + " hub is up to date"
elsif rubygems?
puts "*".red + " hub is " + "not".bold.underline + " up to date"
else
update
end
rescue Object => e
puts "*".bold.yellow + " error updating hub: #{e.class}"
end
elsif subcommand.to_s == 'check'
begin begin
if up_to_date? if up_to_date?
puts "*".green + " hub is up to date" puts "*".green + " hub is up to date"
...@@ -200,13 +213,15 @@ help ...@@ -200,13 +213,15 @@ help
rescue Object => e rescue Object => e
puts "*".bold.yellow + " error checking status: #{e.class}" puts "*".bold.yellow + " error checking status: #{e.class}"
end end
else else
puts <<-output puts <<-output
usage: hub install COMMAND [ARGS] usage: hub install COMMAND [ARGS]
Commands: Commands:
check Checks if the current installation is up to date check Checks if the current installation is up to date
by phoning home. by phoning home.
update Updates hub if a newer version is available.
output output
end end
...@@ -216,7 +231,7 @@ output ...@@ -216,7 +231,7 @@ output
private private
# #
# Helper methods are private so they cannot be invoked # Helper methods are private so they cannot be invoked
# from the command line # from the command line.
# #
# Is the current running version of hub up to date? # Is the current running version of hub up to date?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册