Class: Gitcycle

Inherits:
Object
  • Object
show all
Includes:
Assist, Branch, Checkout, Commit, Discuss, Incident, Open, Pull, Push, QA, Ready, Review, Setup
Defined in:
lib/gitcycle.rb,
lib/gitcycle/qa.rb,
lib/gitcycle/open.rb,
lib/gitcycle/pull.rb,
lib/gitcycle/push.rb,
lib/gitcycle/ready.rb,
lib/gitcycle/setup.rb,
lib/gitcycle/assist.rb,
lib/gitcycle/branch.rb,
lib/gitcycle/commit.rb,
lib/gitcycle/review.rb,
lib/gitcycle/discuss.rb,
lib/gitcycle/checkout.rb,
lib/gitcycle/incident.rb

Defined Under Namespace

Modules: Assist, Branch, Checkout, Commit, Discuss, Incident, Open, Pull, Push, QA, Ready, Review, Setup

Constant Summary collapse

API =
if ENV['ENV'] == 'test'
  "http://127.0.0.1:3000/api"
else
  "http://gitcycle.bleacherreport.com/api"
end
ERROR =
{
  :unrecognized_url => 1,
  :could_not_find_branch => 2,
  :told_not_to_merge => 3,
  :cannot_qa => 4,
  :conflict_when_merging => 5,
  :something_went_wrong => 6,
  :git_origin_not_found => 7,
  :last_command_errored => 8,
}

Instance Method Summary collapse

Methods included from Setup

#setup

Methods included from Review

#review

Methods included from Ready

#ready

Methods included from QA

#qa

Methods included from Push

#push

Methods included from Pull

#pull

Methods included from Open

#open

Methods included from Incident

#incident

Methods included from Discuss

#discuss

Methods included from Commit

#commit

Methods included from Checkout

#checkout

Methods included from Branch

#branch

Methods included from Assist

#assist

Constructor Details

#initialize(args = nil) ⇒ Gitcycle

Returns a new instance of Gitcycle.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/gitcycle.rb', line 66

def initialize(args=nil)
  $remotes = {}

  if ENV['CONFIG']
    @config_path = File.expand_path(ENV['CONFIG'])
  else
    @config_path = File.expand_path("~/.gitcycle.yml")
  end

  load_config
  load_git

  start(args) if args
end

Instance Method Details

#start(args = []) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/gitcycle.rb', line 81

def start(args=[])
  command = args.shift

  `git --help`.scan(/\s{3}(\w+)\s{3}/).flatten.each do |cmd|
    if command == cmd && !self.respond_to?(command)
      exec_git(cmd, args)
    end
  end

  if command.nil?
    puts "\nNo command specified\n".red
  elsif command =~ /^-/
    command_not_recognized
  elsif self.respond_to?(command)
    send(command, *args)
  else
    command_not_recognized
  end
end