Module: GitScf
- Extended by:
- GitScf
- Included in:
- GitScf
- Defined in:
- lib/git_scf.rb,
lib/git_scf/jira.rb,
lib/git_scf/ticket.rb,
lib/git_scf/version.rb,
lib/git_scf/env_config.rb,
lib/git_scf/subcommands/show.rb,
lib/git_scf/subcommands/start.rb,
lib/git_scf/subcommands/finish.rb,
lib/git_scf/subcommands/review.rb
Defined Under Namespace
Classes: EnvConfig, Finish, Jira, Review, Show, Start, Ticket
Constant Summary collapse
- REPO_PATH =
'.'
- VERSION =
'0.0.8'
Instance Method Summary collapse
-
#execute(*args) ⇒ Object
Parses command line arguments and does what needs to be done.
Instance Method Details
#execute(*args) ⇒ Object
Parses command line arguments and does what needs to be done.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/git_scf.rb', line 16 def execute(*args) = {} opts = OptionParser.new do |opts| # Set a banner, displayed at the top of the help screen. opts. = "Usage: git scf (start|show|review|finish) [issue_number]" # Define the options, and what they do [:verbose] = false opts.on( '-v', '--verbose', 'Output more information' ) do [:verbose] = true end # Displays the help screen. opts.on( '-h', '--help', 'Display this screen' ) do puts opts exit end end opts.parse! if ARGV.empty? puts "ERROR: you must specify a subcommand" puts opts exit end begin repo = Rugged::Repository.new(REPO_PATH) rescue puts "ERROR: Invalid git directory" puts opts exit end config = EnvConfig.new(repo) jira = Jira.new(config) ticket = Ticket.new(jira) case ARGV.first when 'start' Start.new(ticket) when 'show' Show.new(ticket, [:verbose]) when 'review' Review.new(ticket) when 'finish' Finish.new(ticket) end.execute end |