bin/vclog in vclog-1.0.0 vs bin/vclog in vclog-1.1

- old
+ new

@@ -1,131 +1,4 @@ #!/usr/bin/env ruby +load 'vclog/command' +VCLog.run -# vclog -# -# SYNOPSIS -# -# VCLog provides cross-vcs ChangeLogs. It works by -# parsing the native changelog a VCS system produces -# into a common model, which then can be used to -# produce Changelogs in a variety of formats. -# -# VCLog currently support SVN and Git. CVS, Darcs and -# Mercurial/Hg are in the works. -# -# EXAMPLES -# -# To produce a GNU-like changelog: -# -# $ vclog -# -# For XML format: -# -# $ vclog --xml -# -# Or for a micorformat-ish HTML: -# -# $ vclog --html -# -#To use the library programmatically, please see the API documentation. -# -# LICENSE -# -# VCLog Copyright (c) 2008 Tiger Ops -# VCLog is distributed under the terms of the GPLv3. - -require 'vclog/vcs' -require 'getoptlong' - -# TODO: rev option. -# -def vclog - - opts = GetoptLong.new( - [ '--help' , '-h', GetoptLong::NO_ARGUMENT ], - [ '--debug', GetoptLong::NO_ARGUMENT ], - [ '--typed', GetoptLong::NO_ARGUMENT ], - [ '--rev' , GetoptLong::NO_ARGUMENT ], - [ '--gnu' , GetoptLong::NO_ARGUMENT ], - [ '--xml' , GetoptLong::NO_ARGUMENT ], - [ '--html' , GetoptLong::NO_ARGUMENT ], - [ '--rel' , GetoptLong::REQUIRED_ARGUMENT ], - [ '--style', GetoptLong::REQUIRED_ARGUMENT ], - [ '--output', '-o', GetoptLong::REQUIRED_ARGUMENT ] - ) - - format = :gnu - typed = false - rev = false - vers = nil - style = nil - output = nil - - opts.each do |opt, arg| - case opt - when '--help' - puts "vclog [--gnu|--html|--xml|--rel] [--typed]" - exit - when '--debug' - $DEBUG = true - when '--typed' - typed = true - when '--rev' - rev = true - when '--xml' - format = :xml - when '--html' - format = :html - when '--rel' - format = :rel - vers = arg - when '--style' - style = arg - when '--output' - output = arg - end - end - - vcs = VCLog::VCS.new - - changelog = vcs.changelog - - if typed - changelog = changelog.typed - end - - case format - when :xml - log = changelog.format_xml(style) # xsl stylesheet url - when :html - log = changelog.format_html(style) # css stylesheet url - when :rel - if output && File.file?(output) - file = output - else - file = Dir.glob('change{s,log}{,.txt}', File::FNM_CASEFOLD).first - end - log = changelog.format_rel(file, vers) - else #:gnu - log = changelog.to_s - end - - if output - File.open(output, 'w') do |f| - f << log - end - else - puts log - end - -end - -begin - vclog -rescue => err - if $DEBUG - raise err - else - puts err.message - exit -1 - end -end