Class: Twigg::Command::GitHost

Inherits:
Twigg::Command show all
Defined in:
lib/twigg/command/git_host.rb

Overview

This is an abstract superclass the holds code common to the “gerrit” and “github” subcommands.

Direct Known Subclasses

Git, GitHub

Constant Summary

Constants inherited from Twigg::Command

EASTER_EGGS, PUBLIC_SUBCOMMANDS, SUBCOMMANDS

Instance Method Summary collapse

Methods inherited from Twigg::Command

run, #run!

Constructor Details

#initialize(*args) ⇒ GitHost

Returns a new instance of GitHost.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/twigg/command/git_host.rb', line 6

def initialize(*args)
  super
  @sub_subcommand = @args.first

  unless (1..2).cover?(@args.size) &&
    sub_subcommands.include?(@sub_subcommand)
    # eg. "Twigg::Command::{Gerrit,GitHub}" -> "gerrit/github"
    Help.new(self.class.to_s.split('::').last.downcase).run!
  end

  @repositories_directory = @args[1] || Config.repositories_directory
end

Instance Method Details

#runObject



19
20
21
# File 'lib/twigg/command/git_host.rb', line 19

def run
  send @sub_subcommand
end