root / bin / info.rb

Revision 547:fd80af68bedc, 0.6 kB (checked in by Sean Russell <ser@…>, 5 months ago)

Fixes more 1.9 - related syntax
Changes ftools to FileUtils?

  • Property exe set to *
Line 
1#!/usr/bin/env ruby
2
3HELP = "USAGE: info <url|revision|author|date>"
4
5info = {}
6`svn info`.split("\n").each {|line|
7  line =~ /(\w+):(.*)/
8  info[$1.downcase] = $2.strip
9}
10
11info['tag'] = info['url'].split("/")[-1]
12info['date'] = info['date'].split(" ")[0,3].join(" ")
13
14if ARGV.length < 1
15  puts info.collect {|k,v| "#{k}=#{v}"}.join("\n")
16  exit 0
17end
18
19k = case ARGV[0]
20    when /^t/ then 'tag'
21    when /^u/ then 'url'
22    when /^r/ then 'revision'
23    when /^a/ then 'author'
24    when /^d/ then 'date'
25    else
26      puts %Q{Unrecognized command "#{ARGV[0]}"}
27      puts HELP
28      exit 1
29    end
30
31puts info[k]
32
33
Note: See TracBrowser for help on using the browser.