#!/usr/bin/env ruby # == Synopsis # git post-receive hook for integration with FogBugz # # == Examples # This command takes standard input from git's post-receive hook # git-fogbugz foo.txt # # Other examples: # git-fogbugz --passthrough # # == Usage # git-fogbugz [options] source_file # # For help use: git-fogbugz -h # # == Options # -h, --help Displays help message # -v, --version Display the version, then exit # -q, --quiet Output as little as possible, overrides verbose # -V, --verbose Verbose output # -p, --passthrough Push stdtin to stdout for chaining # # == Author # Roy W. Black # # == Copyright # Copyright (c) 2007 Roy W. Black. Licensed under the MIT License: # http://www.opensource.org/licenses/mit-license.php require 'optparse' require 'ostruct' require 'date' require 'net/https' require 'uri' require 'grit' include Grit class App VERSION = '0.1.0' attr_reader :options def initialize(arguments, stdin) @arguments = arguments @stdin = stdin # Set defaults @options = OpenStruct.new @options.verbose = false @options.quiet = false @options.quiet = false @options.passthrough = false @options.repo = "C:/clients/MattMuresan/source/scenengine" # TO DO - add additional defaults @options.host = "https://onebrave.fogbugz.com" @options.port = 443 @options.repo_id = 4 end # Parse options, check arguments, then process the command def run if parsed_options? && arguments_valid? $stderr.puts "Start at #{DateTime.now}\n\n" if @options.verbose output_options if @options.verbose # [Optional] process_arguments process_command $stderr.puts "\nFinished at #{DateTime.now}" if @options.verbose else output_usage end end protected def parsed_options? opts = OptionParser.new do |opts| opts.banner = <